[Solved] An misunderstanding with the times of adding addVoice in midi synth tutorial

Hi JUCE fellows,

I’m experimenting with midi synth tutorial.
I tried to change the for loop time regarding addVoice. For example if I set it to 1.
for (auto i = 0; i < 1; ++i)
synth.addVoice (new SineWaveVoice());
Is it correct that there should be only 1 midi key pressed generating a tone at each time? However no matter how I set the for loop counter, I can have up to 6 midi key tones at most. Am I understanding addVoice in the wrong way? Or I messed up with other code?

Thank you!

What exactly happens when you try using more than 6 notes? The 7th note isn’t played at all or the playback messes up? If it’s the latter, that would probably be too much CPU being used by the voices.

The 7th key won’t be recognized. No tone generated. The playback sound from the other 6 keys are alright.

What are you using to generate the MIDI notes? DAW application, MIDI keyboard controller, computer keyboard…?

With computer keyboard, 6 keys at most. I just tried with my MIDI keyboard. It looks like I can press as many keys as I want. The for loop counter is irrelevant.

It is not, that ultimately determines how many voices your synth can play.

My bad. I should have listened more carefully. The synth generates exactly as the loop counter. The MidiKeyboardComponent can be triggered up to 6 keys with computer keyboard and seemingly unlimited keys with an actual MIDI keyboard. The tones follow how many times I implement addVoice. Thanks for you help anyway.