SynRand

SynRand: Additive Synthesis MIDI Instrument w/ Parameter Randomization

SynRand is a basic additive synthesizer that allows you to control a variable number of partials that each generate their own, independent waveform. When a midi note is played, all of the enabled partials generate their own waveforms and are added together. Each individual partial has these parameters affecting their waveform: waveform type, frequency offset (from the given midi note frequency), volume, low-frequency-oscillator, and separate ADSR envelopes for volume and freqency. Additionally, each partial can be turned on or off at will, and there is a global volume parameter as well. The plugin comes in the form of an Audio Unit Musical Instrument, and all the parameters are exposed and grouped together by waveform for fine automation control in the DAW of your choice.

The titular feature of SynRand is a built-in parameter randomizer that can randomize all parameters at once. The range parameter (shown above on the top right) controls how much randomization is desired; since each parameter has their own value range, the range parameter controls the percentage of change allowed within that range. For example, the max range of the Semitone Offset value is -96 to 96, or 192 in total. So if your semitone offset value is currently at +12, and the random range is set at 25%, you can expect a randomized value anywhere between -12 and +36 (since 25% of -96 to 96 is -24 to 24). This is also applied to all parameters, so the potential randomization is quite high.

I built SynRand in 3 months as a part of a class on CoreAudio’s Audio Unit API. I decided to go for an Audio Unit Musical Instrument (AUMU) because I’ve used a lot of parameter randomization while making sound effects for games, and I thought it would be interesting to add that feature to a MIDI instrument. I’m quite satisfied with how it turned out, as the really fine control you can get over each waveform isn’t something that a lot of other MIDI instruments do. There are some features I’d like to add, though. Here’s a list:

Better support for multi-partial editing. When I was creating some audio unit presets to use in my presentation of SynRand, I found that for a lot of partials, it would be super helpful to have a copy & paste functionality so that you don’t have to set ALL the parameters each time. Additionally, some of the UI elements have a serious lack of fine control; since this class wasn’t about UI, I didn’t allocate a lot of time for user testing it, so there’s definitely a lot of improvement to be made there. I made sure to add editable text boxes to everything though, so that helps a bit.

Also, as a bit of a nitpick, the partials are all automatically averaged to the same volume level, and it’d be better to not do that, and to allow you to change their volume separately on a larger range. This would mean that adding more partials makes it louder by default, so it’d be really easy to peak the volume if you’re not managing the volume carefully. I don’t enjoy making it harder to use, but I’d rather give the user more fine control, rather than assume that they don’t know what they’re doing.

Partial-by-partial toggles for randomization. This was also something I immediately noticed when I started using it; as I mentioned, the randomization range is calculated separately so that it’s proportional to the max range of each parameter, but some parameters have larger ranges than others. The range of semitones may be -96 to 96, but the range of attack durations is from 0 to 20000ms; a 5% randomization would be a range of +/-4.8 semitones AND +/- 500ms; so not all ranges are created equal. In addition to that, what if you only want to randomize your ADSR and not anything else? Being able to disable the randomization on a parameter-by-parameter basis would, again, help in making this MIDI instrument more usable. The next one is a bit related:

Separate the randomization feature and use it to host other plugins. Halfway through the randomization feature, I realized that all of my randomization code was in the UI host, and was completely unrelated to the actual AUMU features. If I ported the randomization feature to an AudioUnit that did nothing but host other AudioUnits, then I could actually just randomize any Audio Unit plugin in existence, without any of the source for it. That would be way more cool! The only issue is that, since other Audio Units would be hosted inside this one, none of their parameters would be available for automation, which is kind of a big loss. To counterbalance this, if I added the ability to export AU Presets, then you’d be able to host any plugin, randomize parameters until you get something that sounds cool, and then export the preset for that parameter arrangement and load it into the actual plugin in your DAW. Then you’d have automation access, which would solve that problem.

I’m very happy with this project; I learned a bunch about AU / CoreAudio programming and got to brush up on a lot of DSP knowledge in the process.  If you have any cool ideas for or questions about SynRand, feel free to email me at izzyabdussabur@gmail.com or contact me at @BBQSteakTips on twitter. If you’d like to toy around with the source or build it yourself, the github repository is here: https://github.com/izzy-sabur/synrand

Thanks for reading!