Page 1 of 2

Mono to Poly and back?

PostPosted: Mon Aug 11, 2014 9:49 pm
by Perfect Human Interface
Hey, why doesn't this pass audio?

mono poly mono.PNG
mono poly mono.PNG (10.91 KiB) Viewed 21511 times


MonoToPoly.PNG
MonoToPoly.PNG (35.82 KiB) Viewed 21511 times


I swear I was just starting to work with something that converted to Poly, did some stuff, and then back to mono, and it was passing audio but then all of a sudden it stopped. Now I can't get audio through these modules, even in new projects. :?

Re: Mono to Poly and back?

PostPosted: Mon Aug 11, 2014 11:01 pm
by trogluddite
You need a poly output from a MIDI to Poly to make poly streams do anything at all - the channels in poly streams are switched on and off by the MtoP assigning and releasing the MIDI notes.

The mono to poly would usually be used if you have a common signal that you want to pass to every voice of a synth. For example. if you wanted to have an LFO that had the same phase for every voice, you could feed in a mono LFO using the mono to poly.

The voices don't have to come from a MIDI driver though - you could use the MIDI Event primitive or Ruby to create notes to feed into the MtoP if you need a way to control the turning on and off of voices.

Re: Mono to Poly and back?

PostPosted: Mon Aug 11, 2014 11:04 pm
by KG_is_back
Poly streams are created by midi to poly primitive. Mono stream has SSE channels running always (the initiate when FS is loaded, code is recompiled or when "clear audio primitive" receives trigger). Poly stream can have any number of channels (including none at all), but they are created and stopped by midi to poly primitive.

Mono to poly module is basically a hack. Mono stream is written into memory (by mono write), and in poly stream the value is read from the memory (by wave read primitive). However, when no poly channels are initiated, the value is still written by mono, but there is no poly to read it. Mono to poly module doesn't create new voices on it's own.

I have used this same way, to create chorus effect, with adjustable number of voices (basically a flanger in poly, with unique modulation parameters per poly channel/voice). Note that using green to create midi notes this way is inaccurate - if you connect multiple "midi event" prims with "afterload" prim, the actual notes will be created with slight delay form each other. This may be fixed using ruby I believe.

Re: Mono to Poly and back?

PostPosted: Mon Aug 11, 2014 11:12 pm
by trogluddite
KG_is_back wrote:I have used this same way, to create chorus effect, with adjustable number of voices

Very neat! :o

Re: Mono to Poly and back?

PostPosted: Mon Aug 11, 2014 11:17 pm
by Perfect Human Interface
Thanks again both of you. :)

I'm hoping to make a polyphonic, MIDI note-following filter (notch, bandpass) effect. So the filter cutoff is controlled by MIDI notes. That should be doable, right?

Re: Mono to Poly and back?

PostPosted: Mon Aug 11, 2014 11:26 pm
by Perfect Human Interface
Oh, and if I need to find the pitch/frequency of the lowest note currently played, does that require using poly (or voices)?

Re: Mono to Poly and back?

PostPosted: Tue Aug 12, 2014 12:14 am
by KG_is_back
You will have to do that with ruby. poly voices can not interact with each other, so it is complicated to find the "lowest pitched" one.

I do not know ruby, but I know that ruby can convert midi event to array of 4 integers (one for status byte, second for channel, rest two for parameter bytes - the same way as on midi event primitive). The thing will have to store midi notes in an array and output the pitch of the smallest one. It would add note on each midi note on event and remove on each midi off event.

Re: Mono to Poly and back?

PostPosted: Tue Aug 12, 2014 12:48 am
by Perfect Human Interface
So do modules like the Signal analyzer just add the data together if there's more than one stream on the input at a time?

You'd think you could do it in MIDI data before it even hits poly, but I don't see a way to do that with existing modules either.


Actually... There. That should do it. :D

MIDI split.PNG
MIDI split.PNG (38.52 KiB) Viewed 21487 times

Re: Mono to Poly and back?

PostPosted: Tue Aug 12, 2014 1:51 am
by KG_is_back
Perfect Human Interface wrote:So do modules like the Signal analyzer just add the data together if there's more than one stream on the input at a time?


Yes, default behavior of all connectors is to sum all connectors that are connected (after conversion to the receivers format). That is true for floats, integers, their array versions, booleans and also all types of streams. Strings, texts and are appended (based on connector order) and triggers and midi are queued (based on connector order). For poly and mono4 values that are in the same channels/voices get added.

Signal analyzer is a completely different story though. It has it's own connector type (it is not really poly, although it is colored as poly). It basically creates a short buffer and uses connected stream to fill it in. It is as if it created a poly voice for certain amount of samples. However it seems to be not synced with running audio - the Signal Analyzer calculation is instantaneous -calculated all at once - not spliced into ASIO buffers as standard streams - you can even freeze FS by entering extremely big NS (that takes long to calculate). Basically it lets you use stream code as if it was green.

Re: Mono to Poly and back?

PostPosted: Tue Aug 12, 2014 3:02 am
by Perfect Human Interface
KG_is_back wrote:Signal analyzer is a completely different story though.


That's interesting.


So um... is there a better way? I'm getting scared.
aaaaaaa.PNG
aaaaaaa.PNG (82.72 KiB) Viewed 21482 times