Though the rubrik is ’news’ I had originaly intended on doing something akin to blogging, here. Well, here goes.
As a fan of 8 bit foo and having been happy with Felix from https://wgdmodular.de/module/ Smoothie mixer, I thought I’d try his colab utf-8-samplified.
It’s after my heart, being stripped down to essentials. 8 inputs. 1 output. Basta.
Ok, but, the samples question is always a deeply personal one. And how those samples are produced! But first, some examples of the kits I’ve built for it:
Jungle kit:
An 808:
Bad bass electro:
And finally the only one I’m happy with …. dilectro (a drill sample krept into an electro kit):
However, the main reason I wanted to blog, was to record two parts of the process. These often consume so much time, that you neglect the aesthetics while trying to work out the details of the audio processing. So, here, the process which works to allow you to focus on the important bit.
I’m a linux and comand line user, so, with that in mind … Given a folder with .WAV files, assuming they are some higher bit depth (eg. 16bit) and frequencny (44khz):
for file in *.WAV; do sox $file -r 10000 -D -c 1 -b 8 "$(basename $file .wav).wav" trim 0 -0.4 norm -0.2; done
This will convert to 10khz (-r 10000) and 8 bit (-b 8) unsigned audio. Note that I’m starting with .WAV files and producing .wav files. This is intentional. I want copies to easily compare.
The command also trims (trim 0 -0.4, whole file, from the end), so you first need to find out how much (from the end) you want gone and test that first. If you have wildly different lengths, you will need to trim the files otherwise. I often have files of identical length where more than half is empty.
It also normalizes, in this case, -0.2, not too much so that you’ll clip (generally).
To summarize: sox inputfile.WAV -r RATEINHZ -c 1MONO -b BITS outfile.wav trim START -END norm -0.1
now this is only an example for unsigned 8 bit arrays. I started with an example from the mozzi library, but they do this to completely differnt ends. They want 16khz signed (swinging -/+) values. Which is also useful, but not for samplified which wants 0-255. So, I re-wrote it. It’s easy to invoke.
for file in *.wav; do ../wav2c.py "$(basename ${file%})" ${file%.*}.h "${file%.*}" 11000 ; done
so ./wav2c.py my.wav my.h my 11000 (name of script, name of input file, name of output header file, name of array, frequency).
Note that I’m now operating on the previously downsampled .wav files. just so we don’t clobber the originals.
Here we just loop through all wav files with the name of the file “$(basename $file%}) (one.wav) an output specifier ${file%.}. (the %. turns one.wav into one) and the name for the array name in the produced header file. So, “${file%.*}” here produces ‘one’ for the array name. Result is that one.wav is input, producing one.h header file wherein the array of values is named one[LENGTH]
In some respects, I’m just writing this to have a note to self. In another, I’m hoping it’ll help someone speed up the sample processing they do.
Now, having heard the mixed quality above, you know why I need to have a good toolchain. Back to work getting those samples fun to play!
The wav2c.py file may be found at: https://github.com/poetaster/utf-8-samplified/blob/main/firmware/wav2c.py
I said it last time, I’m building a drum in a box. It’ll be analog. I need a break from typing :)