I’m starting to count the days… I was hoping to be done with the plumbing-type instrument building by this weekend, and spend the next couple weeks before I go to Texas just practicing and developing the instrument script. I’m not too far off, but there are still some wildcards:
- I haven’t dealt with the remaining memory leaks. I’m back on the framework laptop which has enough RAM to let me play for quite a long time before I need to shut down the instruments and reclaim shared memory… It would still make me feel better to get that properly sorted.
- There have been some odd shutdown bugs I haven’t bothered to look into. I realized this morning when adding a new message type that I’d forgotten to update the cython header to match the enum of message types, which could have easily caused problems on shutdown since the shutdown message had the wrong value. Hopefully that’s all it was, but I guess it’s not a big deal if I have to kill the process manually on shutdown sometimes for now.
- I’ve been happily using the new shared memory sampler for both relaying renders from python to the audio thread, and as a shared memory circular buffer for sampling from the ADC… but I’d like to build out the python interfaces to it so that I can add some more resampling capabilities, capture internal buffers and stash them for use later, and so on from within instrument scripts.
- It’s still easy enough to get serial communication to break mysteriously that I’ve decided to abandon it again for now. I love the feel of the daisy controls but I don’t want my main interface for control to be unstable and I’ve spent enough time on it at this point.
That said, thankfully I got MIDI control working again today after work already! This morning I was struggling to get the python rtmidi callback to behave inside of instrument scripts. It seemed like the simplest path to just adapt one of the many python implementations for MIDI handling I’d already done while I think about future adaptations. Callback messages were getting backed up somewhere in python, likely due to a threading problem. Python concurrency still confuses me. Maybe eventually I’ll spend enough time with cpython internals and the standard library source to understand the magic, but in the meantime I decided to try using the ALSA API for the first time to add MIDI support in C, and it turned out to be super easy! No mysteries, just added a new MIDI listener thread to astrid instruments and passed a pointer to the instrument struct into it. No crazy scoping issues or mysterious silences and throttled logging etc etc – it more or less just worked on the first try.
This also means I’m switching back to my bigger MIDI controller (the faderfox MX12 which I love – so many controls!) and that means I get to map waaaaay more params of the littlefield instruments to direct control. :-)