Jacob Vosmaer's blog

Recurse Center projects

2023-12-07

I am currently participating in the Recurse Center programming retreat. I am using my time there to work on projects that bring me joy and help me grow my programming skills. I hope to write blog posts about each of these but to get myself started I will give an overview of the projects I have worked on so far, in chronological order.

Most of these projects are running on the Daisy embedded audio platform.

Update: also see part 2 and part 3.

DaisyAudioMangler: slowing and reversing audio

GitHub

I've been listening to Aphex Twin a lot and I notice that he regularly uses an effect where part of the sound gets reversed for 1 or 2 beats. It should be straightforward to implement this in a Digital Audio Workstation (DAW) but with my music setup I don't have the option to do that. Because the Daisy has audio in, audio out and plenty of sample memory, I wondered if I could have it continuously record all incoming sound, and reverse it on demand.

Once I got that working I also added the ability to slow the sound down and to stop it and "scratch" back and forth.

Right now this works on the Daisy Pod hardware. The physical controls of Daisy Pod trigger the various effects. To make this usable in my music, which is all MIDI sequenced, I will have to make the effects MIDI-controllable.

Here is a demo of the mangler mangling some of my own music.

FV1toDaisy: run FV-1 DSP code on Daisy hardware (unfinished)

GitHub

I'm curious about how reverb effects work. I really like the Alesis MidiVerb so when I found out that its creator, the late Keith Barr, had developed a DSP platform specifically for audio effects I wanted to know more about it. That platform is the Spin FV-1. You could think of the FV-1 as a precursor of the Daisy platform except with less CPU horsepower and a custom assembly programming language specifically designed for audio effects. (Daisy, in comparison, has a general purpose processor.)

Because I have Daisy hardware but no FV-1, I thought it would be a nice challenge to write a program that takes FV-1 assembly and somehow outputs a Daisy C++ program that sounds the same. I bailed out after a couple of days because it felt like too much work, and I was being challenged on too many fronts.

DaisyX7: real-time tweakable DX7 sound engine running on Daisy

GitHub

The Yamaha DX7 was a popular synthesizer keyboard in the mid-1980s. It uses a digital synthesis method that Yamaha called "Frequency Modulation" (but which really is phase modulation) which allowed for a level of expressiveness that is not achievable with the dominant synthesis paradigm of its time (substractive synthesis). Yamaha FM synthesis can produce a wide range of timbres ("sound colours") using a small number of parameters and it can vary the timbre of the sound in unique ways.

Concretely, it allowed you to program sounds that sound really different depending on whether you play quiet or loud on the keyboard, as opposed to just having the sound be quieter and a bit duller when you play softly.

The DX7 was a best-selling product in its time and people still love it today out of nostalgia for the songs of the time it was used in. Among synthesizer enthusiasts it is notorious however for the difficulty of making your own sounds with it. There are lots of presets available for it but a big part of the fun of synthesizers is being able to create and sculpt your own sounds.

Inspired by the reverse engineering work of Ken Shirriff, I decided it would be fun to implement the DX7 synthesis engine in C on the Daisy. At first just to see if it would sound more or less correct. I later ported the code to the Daisy Field so that I could break out more sound parameters onto physical knobs.

I don't expect to use this project as a synthesizer. My goal is to improve my mental model of what is possible with the DX7 sound engine. I can then apply my knowledge when I program my own (real) DX7.

Here is a demo of me making weird drone sounds with the DaisyX7. Warning: there are abrupt jumps in volume.

sineko: a Linux kernel module that generates sine wave PCM data

See this post.

MidiRecorder: record raw MIDI UART data

GitHub

I found a bug in a new synthesizer I bought which I could trigger by just playing a MIDI keyboard into it. I reached out to the manufacturer and we had a hard time figuring out where the problem was coming from. I had a very strong suspicion that it had to do with their software incorrectly handling incoming MIDI data.

It sounded like they developed the firmware and only tested it with USB MIDI. The original MIDI protocol is from 1983 and there are some differences between the original UART protocol and the USB version.

The difficulty now was that all the methods at my disposal for recording MIDI data to share with the manufacturer went through a USB device at some point in the chain, which would then hide (convert) the non-USB behavior.

The Daisy Pod has a MIDI in port that uses the original UART protocol. It also has a MicroSD slot. So, I made a Daisy program that records incoming MIDI to RAM until you tell it to stop. Then it gets written to the SD card as a file that you can inspect on the computer.

This revealed that in my studio, MIDI note-on message were getting fragmented by MIDI clock messages. This is allowed in the original protocol because it has a low data rate (31250 bits per second) and by giving the clock messages higher priority you achieve better clock accuracy. USB 1.1 has a data rate of 12 million bits per second, so there is little to gain by fragmenting messages. The USB MIDI protocol does not have fragmented messages so if you only ever test with USB MIDI, your code may not handle these fragmented messages correctly.

Being able to see that raw UART bytes was really helpful in analyzing this problem.

CZengine: run the Casio CZ engine on Daisy

GitHub

Although I'm not done yet working on DaisyX7, I got curious if I could build something similar for a contemporary of the DX7: the Casio CZ series synthesizers. This is still work in progress but the software is already able to synthesize some of the waveforms by applying piecewise linear transformations to the phase of a cosine wave.

Tags: music dx7 recurse yamaha

IndexContact