Skip to content

Instantly share code, notes, and snippets.

@halldorel
Created July 25, 2014 17:53
Show Gist options
  • Save halldorel/beeb84a392eb3ac66de9 to your computer and use it in GitHub Desktop.
Save halldorel/beeb84a392eb3ac66de9 to your computer and use it in GitHub Desktop.
BassDrum()
{
SineWave osc1 = SineWave().freq(50);
ControlGenerator speed = addParameter("speed", 0.5);
ControlGenerator pitch = addParameter("pitch", 0.5);
ControlMetro metro = ControlMetro().bpm(100 + 80 * speed);
ADSR envelope = ADSR(0.01, 0.25, 0.0, 0.1).trigger(metro).doesSustain(true).legato(false);
ADSR pitchEnvelope = ADSR(0.01, 0.06, 0, 0.0).trigger(metro).doesSustain(false).legato(false);
ADSR filterEnvelope = ADSR(0.01, 0.17, 0, 0.1).trigger(metro).doesSustain(false).legato(false);
ADSR noiseEnvelope = ADSR(0.0, 0.02, 0, 0.0).trigger(metro).doesSustain(false).legato(false);
ADSR noiseFilterEnvelope = ADSR(0.0, 0.001, 0, 0.0).trigger(metro).doesSustain(false).legato(false);
Generator sawtooth = SineWave().freq( 40 + 200 * pitch * pitchEnvelope ) >> LPF24().cutoff(400 * filterEnvelope + 100);
Generator noise = Noise() >> LPF12().cutoff(6000 * noiseFilterEnvelope + 100);
noise = noise * noiseEnvelope;
sawtooth = sawtooth * envelope;
setOutputGen(((sawtooth * 0.4 + noise * 0.2) >> LPF24().cutoff(700)) * 0.7);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment