Any reason NOT to create one voice per note?

Hello,

I’m creating a simple synthesiser where each midi note within a specified range has its own unique voice object, and I’ve overridden the ‘noteOn()’ method of the synthesiser class to explicitly select the voice with the correct midi note number, instead of finding a free voice.

I’m wondering if there is any good reason not to do this?

it means you can have 128 voices, which is nice. however it also means a note can’t still release while the same note value is played again, which is not so nice

1 Like

It is one possible approach and it has advantages: no need to worry about voice stealing, for example. With each voice playing a fixed note, your voice management code can be quite simple.

As @Mrugalla pointed out, there can be only one instance of any particular note playing. Whether this is an issue or not depends on the kind of synth you’re building.

You may still want to keep a list of active voices, so you don’t need to loop through the entire array of 128 voices on every sample to figure out which ones to render.

1 Like

You would need some mechanism so that when playing the same note while it is playing, there is no discontinuity. Maybe it would be something like starting with the same current phase, frequency, and volume and transforming to the new note in the first few milliseconds. or maybe you would need two generators per note and alternate them, sounding simultaneously during the release of the previous one

2 Likes

I was running into issues with pops and cracks when playing the same note very quickly and this suggestion helped me figure out why so thanks for that!

as a general rule of thumb, it can always help to run an oscilloscope behind your plugins while debugging them. that often reveals discontinuities like these and gives you ideas about their origins

1 Like

Oh okay I hadn’t thought of that. Do you mean a physical oscilloscope or would a software one be fine? Do you have a recommendations for one?

Here’s a free plugin that I’ve used a few times: Oscilloscope – SocaLabs

3 Likes

If you have any notes that have long release times they can become truncated if that note is played again - which in some performances they might. Also depends on the CPU cost of your voice DSP.

You could potentially support a /large/ number of voices by having a linked list of voices at each of the 128 notes. So, when you play a note you just add it to the linked list. This will remove the ceiling on the number of voices played altogether except when your voice processing starts exceeding available CPU power.

Or, you could just do what everyone else does and have a pool of available voices with a reasonable scoring algorithm for voice stealing.

1 Like

Janus Thorborg's audio portal i use this one. windows only but tons of options

actually this just reminded me of a video i made lately about a MIDI processor that seperates input MIDI into the 16 midi channels so that polyphonic inputs can become up to 16 monophonic inputs:

If you combined this with your “each note is its own voice” approach, you’d have 128 * 16 = 2048 voices, the wet dream of probably this guy, if he was a software dude:

3 Likes