Zack Scholl

zack.scholl@gmail.com

Generating automatically tuned drums for OP-Z and OP-1

 / #music #til 

A bank of drum samples can be tuned and spliced and turned into a TE device patch with just a little bit of code.

I recently came upon these amazing drum samples recorded by @postsolarpunk on a Pulsar-23. I was interested in utilizing these for the OP-Z and OP-1. I already reverse engineered OP-1/OP-Z patches but I wanted to take things a step further and automatically tune all the drum hits to a specific key.

All the code is on my github: schollz/opkit.

But basically, all I did was first trim off silence from the end of each sample using sox:

sox sample.wave new_sample.wave reverse silence 1 0.1 -50d reverse

That command will trim any silence over 100 ms at the end of the file, where silence is defined by anything at or below -50 dB.

Then I determined the pitch of each hit using aubio to calculate the most fundamental pitch:

aubio pitch -i new_sample.wav -m schmitt -u midi

That results in a list, and I used the mode to find the most common rounded midi note and then took the overage of +/-2 notes away from the mode. This worked out to be accurate in demo sounds using the “mcomb” or “schmitt” algorithms.

After that I just wrote some Golang glue that selected random files, re-pitched them to whatever note I want (say “C”), and then randomly included up to 11.5 seconds (that’s the OP limit on the sampler) and used schollz/teoperator to splice them together.

Here’s the result of a patch made from splicing kick sounds in the key of C:

The patch has extra information in the header file that tells the OP-Z and OP-1 how to calculate the sample start/end points.

And here’s a little example track I made with kick, snare, hat and bass sounds from the Pulsar-23, all pitched to “C”. Made on an OP-Z:

In the schollz/opkit there are instructions for generating your own kits, but I generated a bunch of C-based kits if you want to just try: Pulsar-23 OP-1/OP-Z kits.