This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Original C++ code: | |
# | |
# Created by Nigel Redmon on 12/18/12. | |
# EarLevel Engineering: earlevel.com | |
# Copyright 2012 Nigel Redmon | |
# | |
# For a complete explanation of the ADSR envelope generator and code, | |
# read the series of articles by the author, starting here: | |
# http://www.earlevel.com/main/2013/06/01/envelope-generators/ | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import std/[math, random] | |
import iterit, iterkspercussion | |
const | |
SampleRate {.intdefine.} = 44100 | |
SRate* = SampleRate.float | |
type | |
Trigger* = object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, random, math | |
import iterit | |
const | |
SampleRate {.intdefine.} = 44100 | |
SRate* = SampleRate.float | |
MaxKSDelay* = (SampleRate / 20.0).int #Hz delay line length: SampleRate / Frequency | |
type | |
Ticker* = object | |
tick: uint |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math, random | |
import iterit | |
const | |
SampleRate {.intdefine.} = 44100 | |
SRate* = SampleRate.float | |
MaxKSDelay* = (SampleRate / 20).int #Hz delay line length: SampleRate / Frequency | |
proc iterKS[Tf: float or iterator:float]( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.musicdsp.org/en/latest/Synthesis/11-weird-synthesis.html | |
# "Karplus-Strong-inspired comb filter effect?" | |
# Processes incoming audio continuously, not just initial excitation | |
import std/[math, random] | |
import iterit | |
import iteroscillator | |
const | |
SampleRate {.intdefine.} = 44100 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math, sugar | |
import iterit | |
const | |
SampleRate {.intdefine.} = 44100 | |
SRate* = SampleRate.float32 | |
proc linOsc*[Tf, Tp: float or iterator:float]( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
const | |
SampleRate {.intdefine.} = 44100 | |
SRate* = SampleRate.float | |
LutSize = 256 # Quarter sine wave | |
Lut = static: | |
var arr: array[LutSize, float] | |
for i in 0..<LutSize: | |
let angle = (i.float / LutSize.float) * (PI / 2.0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Modal synthesis in Nim with a pool for modes, so one excite fast and they still properly decay. Cheesy bell, gong & mallet modes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# FFT Stockham | |
# http://wwwa.pikara.ne.jp/okojisan/otfft-en/optimization1.html | |
# original source of scalar Nim version by "Amb" : | |
# https://gist.github.com/amb/4f70bcbea897024452d683b40d18be1f | |
# Timings | |
# === Scalar float64 === | |
# FFT/IFFT test on 4096 points |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import strutils | |
import math | |
import complex | |
const | |
SampleRate = 8000.0 # 8kHz | |
TargetFrequency = 941.0 # 941 Hz | |
FFTSize = 205 | |
N = FFTSize # Block size |
NewerOlder