With Pro Punk Drums, I created a system for loading drum samples into a digital audio workstation (DAW) plugin, using the JUCE framework, which is a popular choice for developing audio applications. The core objective here was to get a digital instrument I could use to quickly demo ideas without using my drums and all the recording gear. Moreover, I wanted the ability to mix the drums using EQ filtering and dynamic range compression to achieve a superior sound quality. Admittedly, if everything goes well, I can even repurpose the code for other samples if possible.
The initial step was a technical endeavor of a different kind—recording and editing all the different drum instruments I wanted for the sampler. After accounting for multiple shells, cymbals, microphones, variations, articulations, and velocities, there were 360 individual samples. This number may seem large to some, or perhaps modest in comparison to other samplers, but I assure you it was extremely laborious to edit. Despite a deliberate effort to keep the collection manageable, it indeed felt overwhelming.
Loading Samples
After exporting the edited samples, I stored them in a directory and began work on the plugin itself. I started by iterating through a list of binary resources generated by the JUCE framework when files are placed in a special folder (JUCE’s BinaryData
system). These files are named in a way that allows my program to infer their content and how to load them into a custom synthesizer. This synthesizer then understands how to playback the samples, accounting for characteristics such as velocity and variation. This involves parsing the sample name to identify the type of drum sound it represents, as well as any specific characteristics like the velocity layer or variation it belongs to. This is crucial for enabling dynamic playback in the plugin, where different samples might be triggered based on how hard or soft a note is played, or to introduce variation in the drum sounds.
In this process, I compare each sample’s name against a list of known drum sounds, choosing a naming convention based on the General Midi’s “Percussion” specification. Although it’s probably the oldest and most well-known MIDI specification for drum sounds, it’s perfectly suited for my needs with a little creative mapping. Once a match is found, I dissect the sample name further to extract metadata such as the variation index, velocity index, and an optional microphone identifier, all encoded in the filenames during the sample creation process.
Once a sample is successfully identified and its properties determined, I proceed to configure audio parameters like default gain, pan, and phase for each sample. These parameters are essential for how the sample sounds in the mix, allowing adjustments in volume, stereo positioning, and phase inversion, respectively. Finally, each sample is added to a synthesizer object corresponding to its determined MIDI note, effectively loading the sample into the plugin’s synthesizer, ready for MIDI-triggered playback.
Processing the Playback
In this audio plugin, the processBlock
function transforms incoming MIDI messages into sound akin to a natural drum kit. The function handles 8 main channels, which are independent audio streams including Kick, Snare, Toms, High Hat, Cymbals, Other, Room, and Output. Except for special channels like Output and Room, each channel processes MIDI messages using additional processors, stored in internal buffers. Effects such as reverb, equalization (EQ), and compression are dynamically adjusted per channel based on user input. The resulting audio for each channel is then mixed into the main output buffer, crafting the nuanced, expressive output heard by users.
Shipping It
When distributing the plugin, it’s important to note that different DAWs support various plugin formats. Most support the Virtual Studio Technology (VST) format, while Avid Pro Tools and Apple’s Logic Pro use Audio Units (AU) and Avid Audio eXtension (AAX) formats, respectively. JUCE abstracts these formats into a unified API, facilitating the generation of these files. Additional steps are required on macOS due to Apple’s security policies, including code-signing and notarization to comply with macOS Gatekeeper requirements. This ensures the software doesn’t contain malicious content and verifies its integrity even without an internet connection. The notarization process, combined with a seamless workflow provided by JUCE, ensures Pro Punk Drums is accessible and secure for users across both Windows and macOS platforms.
In summary, Pro Punk Drums is a digital instrument plugin that captures the essence of a live drum kit for digital audio workstations. By meticulously sampling and editing the drum sounds, and integrating them into a sophisticated digital instrument using JUCE, this plugin offers an authentic and versatile rock drum sound, available for free download and compatible with most DAWs.