Input mappings
Looper
/* context: sampleRate Sample rate of synthesis note Integer giving note offset in semitones from A4 velocity float giving note velocity in range [0-1] x Integer sample index from beginning of note pressed Boolean indicating if the note key is being pressed state Object persisted between calls, separate for each note T Object containing helper functions - saw: sawtooth waveform function, cyclic on [0-sampleRate) - triangle: triangle waveform function, cyclic on [0-sampleRate) - pulse: pulse waveform function, cyclic on [0-sampleRate) - sine: sine waveform function, cyclic on [0-sampleRate) - noise: random noise waveform function - noteFreq: convert note in semitones from A4 to frequency (equal temper) - exp(x,k): exponential extinction enveloppe function - adsr(x,pressed,state,attack,decay,sustain,release): ADSR enveloppe function return: array of two floats in range [-1,1] for left and right channels */
let freq=T.noteFreq(note); state.amplitude = pressed ? Math.exp((-2.5-0.05*note)*x/sampleRate) : 0.9995*(state.amplitude||0); return [ 0.5*state.amplitude*0.2*T.sine(freq*x + 0.2*sampleRate*T.sine(freq*1.01*x)), 0.5*state.amplitude*0.2*T.sine(freq*x + 0.2*sampleRate*T.sine(freq*0.99*x)) ];
Really delete synth?
Yes
No
Lowest note
Highest note
Shift