Close

Memory Problems

A project log for PolyMod 2: modular digital synthesizer

New, improved version of the PolyMod modular digital synthesizer, which was a Hackaday Prize semi-finalist in 2018.

matt-bradshawMatt Bradshaw 01/03/2019 at 13:540 Comments

A little summary of progress over the past week or so:

I've briefly diverted my attention to developing a stripped-down version of PolyMod, because I'm writing a magazine tutorial on how to build a digital synth. This version fits on two breadboards, has 16 patchable sockets, a few knobs, a couple of LEDs, a miniature keyboard and a MIDI input. This has been a useful experience, because I've gone right back to basics with the design and code.

The stripped-down version uses a Teensy 3.2, which has forced me to think about memory usage. With the Teensy 3.6, I was able to be quite cavalier with the amount of memory I used. I tried more and more complex patches, and the 3.6 never struggled. However, with the 3.2 I soon started running into problems. After a bit of experimentation, I realised that there was a memory leak in the Teensy audio library when disconnecting a virtual patch cable. This is now in the process of being fixed in the core code - more details on this forum thread: https://forum.pjrc.com/threads/54760-Audio-stops-working-when-repeatedly-creating-disconnecting-AudioConnections

A helpful user on the forum also pointed out that dynamically creating unlimited audio connections is a recipe for disaster on the Teensy. As an alternative, he suggested a series of mixers to connect the different modules. I don't know whether I've understood his suggestion correctly, but I tried implementing a version of this approach with the stripped-down breadboard PolyMod, and it worked really nicely. Basically, everything is permanently connected to everything else - a mixer is placed before every module input, and every possible module output is routed into each mixer, with the patching being controlled by adjusting the volume of each mixer channel. This creates a huge number of audio connections but, crucially, the connections are known at compile time, meaning that the issue of dynamically creating too many patch cables is solved.

This approach is probably not feasible for a full PolyMod design, partly because the module types are not known at compile time, and partly because it doesn't scale very well as the number of sockets increases (my maths-lecturer friend seemed to think it scaled quadratically, although we were in the pub at the time). However, it's an interesting alternative approach.

Anyway, I'll post the magazine article here when it's published, probably in February - might be an interesting (and less daunting) way into the PolyMod project than building a big eight-module synth.

Oh, and the MIDI input works really well - I borrowed the code and circuit from the official Teensy site: https://www.pjrc.com/teensy/td_libs_MIDI.html

Discussions