COMPONENT 01 · INSTRUMENT
Drum
synthesizer.
A complete kit, with independent voices.
Component owner: Shrikha Atchutuni
Nineteen drum sounds use short waveform tables generated in code. The kick is synthesized directly during playback using a swept sinusoid and a decaying envelope. The sequencer can trigger all 20 sounds on demand.
Hear the instrument alone
This 13.85-second demo uses only the drum component, with dry="1" send="0" on every note. The effects are bypassed.
The first 20 hits follow the sound order below, one hit every half second. The pitch comparison plays the same woodblock table at 0.75× and 1.5×. The envelope comparison plays the same snare with different note durations.
How it generates a frame
- Trigger a voice. A
DrumInstrumentnote creates aCDrumInstrument. Its duration in beats is converted to seconds using the score BPM. - Read or generate a sample. Table voices hold a fractional playback position and linearly interpolate neighboring source samples. The kick computes its oscillator sample directly.
- Shape the note. A 2 ms attack and a release over the final 15 ms of the note avoid abrupt boundaries. Amplitude scales the result. Source tables also have their own decay and edge fades.
- Mix active voices. Each voice returns one stereo frame. The system sums active voices into the dry path and effects send.
Pitch and playback rate
The source position advances by pitch × 44100 / outputSampleRate per output frame. Fractional positions use linear interpolation. A pitch of 2 plays twice as fast and an octave higher; 0.5 plays at half speed and an octave lower. The note ends when its duration or source table ends, whichever occurs first.
The live synthesized kick
The kick’s frequency starts high and quickly falls: f(t) = (45 + 105 exp(−t / 0.025)) × pitch. A phase accumulator integrates that frequency. The sine output is multiplied by exp(−6t / duration) and the note’s attack/release envelope. This sound is computed frame by frame rather than played from a stored recording.
Generated source tables
CDrumSamples builds a shared bank once. It combines sinusoids, deterministic noise, pitch sweeps, and decays to create 19 reusable tables. Bright noise is produced by subtracting the preceding noise sample. Each table is normalized to a peak of 0.9 before per-note amplitude is applied. Voices reference shared tables rather than copying them.
All twenty sounds
| # / XML name | Sound construction | Playback |
|---|---|---|
01 · kick | Swept sine + exponential decay | Live synthesis |
02 · snare | Noise + inharmonic sine components | Table |
03 · snare_soft | Shorter snare definition | Table |
04 · rimshot | High, rapidly decaying impact | Table |
05 · clap | Three noise bursts + noise tail | Table |
06 · closed_hat | Short bright noise + metallic partials | Table |
07 · open_hat | Longer bright noise decay | Table |
08 · pedal_hat | Short metallic hat decay | Table |
09 · tom_low | Low pitch sweep + impact noise | Table |
10 · tom_mid | Mid pitch sweep + impact noise | Table |
11 · tom_high | High pitch sweep + impact noise | Table |
12 · floor_tom | Deep pitch sweep + longer decay | Table |
13 · crash | Noise + inharmonic metallic partials | Table |
14 · ride | Metallic partials + noise | Table |
15 · ride_bell | Higher bell partials | Table |
16 · cowbell | Inharmonic bell partials | Table |
17 · woodblock | Damped wooden impact partials | Table |
18 · clave | High, short impact partials | Table |
19 · tambourine | Modulated noise + partials | Table |
20 · shaker | Short bright noise | Table |
Rubric coverage
| Level | Supported feature | Evidence |
|---|---|---|
| 10 | Waveform playback from tables | 19 tables triggered by XML notes. |
| 20 | Envelope generation | Source decay/fades and per-voice attack/release; demo at 11 s. |
| 30 | Polyphony | Independent active voices; overlapping demo hits from 12 s. |
| 35 | Varying pitch playback | Fractional resampling; same-table comparison at 10 s. |
| 40 | At least 20 distinct sounds | All 20 appear in both demo and main score. |
| 50 | Synthesized drum sound | Kick generated live with swept oscillator and envelope. |
These are implemented features claimed for this component; the instructor and TA determine the awarded grade.
Relevant source files
CDrumInstrument.h/.cpp, CDrumSamples.h/.cpp, and shared CInstrument and CSynthesizer code.