top of page

Building a Sample Player

Firstly, some context...

When I was initially considering building a sample player, I wanted to try and package it as an audio plugin and spent hours researching the best software, coding-framework and tutorials to help me on my way. The most obvious choice seemed to be JUCE, though after installing it and completing the tutorials, I quickly realised this needed an enormous amount of existing C++ knowledge (which I don't have). After considering a few more options and realising that this idea was too fetched, I decided to accept that I would be unable to make an audio plugin and turned to Pure Data (a software I was vaguely familiar).


My only previous experience with Pure Data (Pd) consisted of creating a drum machine as part of a university project, so my knowledge was still relatively limited. I figured I should re-familiarise myself with the software and, whilst browsing the forums, I came across Camomile, an audio plugin with the Pd code embedded, allowing users to open and control Pd patches from within a DAW. After reading through Camomile's documentation, I realised this was my solution to building a sample player that could function as an audio plugin and got to work on creating the sample player.


Creating the Sample Player...

Creating the sample player was a continuous process that took approximately six months to complete. This section discusses the inner-workings of the final configuration.


Loading the Audio Files

When you open the project, a trigger (referred to as a bang) is sent a comment box that tells Pd to load a certain length of an audio file from its location to two tables (for the left and right channels).










Note Routing and Sample Selection

I used an object named notein which receives the note and velocity value from a MIDI input and routes it to one of 50 cloned patches (allowing multiple voices to occur simultaneously). The values are then separated, with the velocity value controlling which dynamic layer is selected alongside its playback volume and the note value choosing the appropriate note.


From here, the appropriate sample is played back from the table storing it. The entire sample is not stored in memory, however, so once the table has been requested for playback the sampler prepares the rest of the sample from the computer's hard drive and continues playing it from here until stopped. This process is called disk streaming, and is used to save gigabytes of RAM that the user may not have.


The same process is used to play the hammer and pedal samples.


GUI & Reverb

The Graphical User Interface (GUI) of my plugin was designed in accordance with Camomile's documentation (this will be covered further in a future blog post). To keep the GUI clutter-free, I compiled the workings of the plugin into a single patch and defined it in the main patch.


The only feature I did not completely design myself was the reverb patch, which was designed by Katja Vetter and uploaded to the Pd forums. The reason I didn't create this myself was that patch is an imitation of the Pd-Extended Freeverb object, which I would've been using if it wasn't due limitations with Camomile.




Comments


bottom of page