Polyphonic sequences
Closed this issue · 5 comments
Hello. Ive been using the lib for a few motnths and it sounds good.
BTW i dont figure out how to perform polyphonic melodies with sequencer objetct. The examples just cover "midi imput" and "keyboard" polyphonic output but not sequencer ones.
It is possible?
Thanck you!
Luigi
yes, you just have to output to multiple out_trig( int index )
and out_value( int index )
, Remember that you cannot use the same index, so something like
for ( size_t i = 0; i<voices.size(); ++i ){
engine.sequencer.sections[0].out_trig( i*2 ) >> voices[i].in("trig");
engine.sequencer.sections[0].out_value( i*2 + 1 ) >> voices[i].in("pitch");
}
would be the correct way.
In this case you have to send messages in the sequence taking care of the fact that even outputs go to trigger and odd to pitch. Or you could do something like this
int voicenum = voices.size();
for ( int i = 0; i<voicenum; ++i ){
engine.sequencer.sections[0].out_trig( i ) >> voices[i].in("trig");
engine.sequencer.sections[0].out_value( i + voicenum ) >> voices[i].in("pitch");
}
and take care of the fact that there is an offset equal to the voices number between triggers and pitch outputs.
Thanck you Nicola.
It works nice.
BTW the aproach is still like having many voices in the sequence and not just one polyphonic voice with overlaped notes. Something like binding each event with a voice with a trigger, and other atributes and a duration for that event is possible?
in pdsp the you should think the sequencer is designed much more as an hardware CV sequencer with multiple outputs than a classic midi sequencer, so yes by design it looks like multiple monophonic voices controlled by the same sequence ( and it is like this also inside the midi keys object ).
You can achieve the result you want, but it will feel much more like scoring for a voice quartet than for a piano.
If you want something like sending event to a generic note instead to a specific section output it could be possible but you should extend pdsp::Sequence
to make your own class with some methods to distribute the events to multiple out port (and do note stealing), but it's not something i want in the pdsp core classes.
(you will want to have multiple preallocated synth voices anyway for the audio synthesis part, allocating and deallocating DSP in realtime will most surely lead to audio clicks and undefined behavior, it's not thread safe)
Thanck you!
I am having nice results with this aproach btw.
The lib sounds amazing
All the best.
thank you very much for using it! i should take some time to clarify the examples as soon as possible,
Cheers!