Multi voice mobile sampler
Idea
I set out wanting to create an intuitive and playable looping interface, based on live recording of samples through analog input. My main motivation behind this project was to learn Pure Data (Pd), as well as to create an interface that affords to dabble with spontaneous audio recordings in a way that is fun and interactable to a non-musician. As a person who is still in the early process of learning about music production myself, I really enjoy interfaces that let you explore manipulation of sounds. Also inspired by granular synthesis, I wanted the user of my interface to be able to explore the little details of the recorded sound material.
Setup
The final project can be found on my GitHub page. To run it, open the patch main.pd in the folder grains/mobmuplat/, which should contain all the relevant externals. Alternatively, you can download the zip file grains/mobmuplat/mobmuplat.zip to your phone and open it in MobMuPlat to get the full mobile experience. A third option is to use the Pd patch on a desktop and then open the grains.mmp file in the MobMuPlat Editor to simulate the mobile experience. Anyhow, all the functionality is available through GUI in the standalone patch.
Overview of the interface
The result consists of a four voice sampler. Each voice can be either 1, 2 or 4 seconds long. The sample slots are visualized in a horizontal green radio bar, with the selection indicating the current sample slot. All the effects except the mix and the total gain affect the currently selected sample slot (note that it can be tricky to perceive this due to the effect not being reset when a different slot is selected). Below are figures showing the Pd interface and the mobile interface, respectively.
Implementation
The actual sampling is done by writing from and reading to arrays via tabread4~ and tabwrite~, and controlling the index with a phasor~ object. I initialize one instance of the sampler per voice. I added functionality to divide the sample in up to 32 parts, and to offset the playhead by a chosen percentage of the total sample length. One interesting way of using this feature is to “scan” through the sample with a slider for interesting grains, for instance by looping the sample at 1/16 of the sample length. I also added an LFO to modulate the playhead position. If the LFO is set to anything greater than zero, it will modulate the playhead position at the rate of the chosen frequency. In order for the playhead index to stay within the array length, I multiplied the unipolar LFO value with half of the current sample rate times the chosen offset percentage. In other words, an offset of 100% with an LFO rate of 0.5 and a sample rate of 44100 oscillates the playhead position between 0 and 44100 every 2 seconds. Upping the LFO rate even more, this creates interesting artifacts that remind of the sound of scratching a vinyl record. This actually makes a lot of sense, as it is essentially oscillating between playing nothing and playing the full sample.
An important part of the application was to able to control four voices with the same set of GUI objects, i.e. not have four sliders per effect per voice. The way I implemented this was through the routing abstraction showed in the figure below. When a new value comes in in the left inlet, it gets routed and forwarded to the outlet that corresponds to the correct sample slot. The trigger object was initially connected to the prepend object to trigger a routing when a new slot was selected. However, I figured out that it made more sense interaction-wise to only let new values trigger the routing. In order to have more than four voices, I could simply have extended the amount of slots and added some outlets in the router abstraction.
Reflection
Looking back, I’m quite satisfied with the interface that I made, considering the time spent and my initial skill level in Pd. I tested out my interface on the bus after the presentation, and it is indeed quite fascinating to create soundscapes by manipulating the sounds that are in your immediate presence. It is not an interface I would believe to have very high value in a music production setting, but I believe the interface affords what I wanted it to do. However, there is always room for improvement.
For future projects, I want to dive deeper into the actual signal processing part of Pd. Working with audio signals is very interesting, and I’m for sure going to spend more time looking into it in the future. My next step will likely be to learn more about sound at even smaller chunks of samples, and to manipulate grains of sounds to create rich textures.