Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Mono display from a poly modulation source

Post any examples or modules that you want to share here

Mono display from a poly modulation source

Postby Spogg » Wed Mar 21, 2018 3:30 pm

Hi guys!

This is a demo I put together which gives a solution to showing a mono display from a polyphonic synth.

The problem:
You can convert a poly stream to mono, then to a float, for showing a poly modulation level graphically, for example.
However, when you play more than one note at a time, the poly stream is summed by the Poly to Mono prim (or “Combiner”). So then the resulting float becomes meaningless (unless you want an overall summed level for audio metering).

My previous solution was to give a float output based on channel i.d. and in this case the float was derived only from the first note played (i.d. = 0). With this method though, if you play C, then add E, then add G and then release C, channel 0 will no longer be active, so the display will be zero. But the synth is still sounding even though the modulation display is dead.

A solution:
Firstly note that Flowstone 4 will have highest/lowest note poly to mono prims so there’ll be no more need for my method.

In the meantime, see my attached basic demo synth which displays a poly LFO the whole time any sound is being made by the synth, irrespective of note order or what channels are sounding at any time. The display only goes off when the last sounding note from the synth has expired.

I hope this is useful for someone, until Flowstone 4 becomes available.

Comments and improvements are always welcome!

EDIT: see posts from Martin Vicanek and KG below for much improved solutions!
EDIT: Also see the solution from Adam below which can account for stolen notes.

Cheers

Spogg
Attachments
Max CURRENT channel id demo v1.01.fsm
(1.53 MiB) Downloaded 1086 times
User avatar
Spogg
 
Posts: 3358
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England

Re: Mono display from a poly moduation source

Postby laci835 » Wed Mar 21, 2018 11:58 pm

Thanks Spogg!
Tried it and works very well, better than dividing with Max(Midi Mono played notes ; 1).
In your setup that gives similar result when pressing more keys in the same time, but decreasing values if starting with 1 key and adding more, 1 by 1 - strange.
When releasing the keys, in your version the signal dies nicely, while in the other it reaches extreme peaks when there are still channel values (the poly sound not finished), but the played notes number falls to 1 (in place of 0). A float limiter helps a bit, but not as good as yours.
Several times I wished something like this. The modulation arc is a good example, the other was an x-y pad when wanted to show the modulation, using 2 general purpose poly LFOs. Surely there are other uses too.
Am curious what will be the new functions in the FS4...
laci835
 
Posts: 2
Joined: Fri Feb 03, 2017 9:54 am
Location: Hungary

Re: Mono display from a poly moduation source

Postby martinvicanek » Thu Mar 22, 2018 12:56 am

Cool!
Perhaps a little heavy on CPU (yeah, I know, my PC is outdated).
Here is my proposal fo sonme CPU savings:
1. You have 32 comparisons and evaluations per sample. However, the result is needed only some 25 times per second, so you could hop that code.
2. The use of 32 combiners is perhaps even worse. You don't have to do it in parallel, though, there is plenty of time for multiplexing and doing the conversion one by one.

I have implemented those two modifications in the schematic below for those of us who can't afford decent harware. ;)
Attachments
Max CURRENT channel id demo v1.02.fsm
(223.58 KiB) Downloaded 1054 times
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Re: Mono display from a poly moduation source

Postby tulamide » Thu Mar 22, 2018 2:23 am

You could speed up the graphics, too. There's no need to draw the icons for the combiners, for example. You could exclude them from drawing in a plugin. The main interface is a view that is inside another, totally empty view. Take it out of there for another speed-up.

I had a look at the preset manager and found a serious issue. The VST protocol only is defined for 256 byte strings (255 data bytes + NULL byte). Your "long comment" field saves to a VST string, but doesn't check for length, which means, you can enter strings that are longer than defined. You may see DAWs working with it, but you're outside of the VST definition, so you won't be 100% compatible with all DAWs (those who expect a C-string, won't work correctly)
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Mono display from a poly moduation source

Postby KG_is_back » Thu Mar 22, 2018 7:47 am

Don't what to be a dick for pointing this out, but this can be done much easier...
Attachments
max current ID.fsm
(8.27 KiB) Downloaded 1063 times
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Mono display from a poly moduation source

Postby Spogg » Thu Mar 22, 2018 9:03 am

Wow!!

Martin and KG, thank you so much. Both are fantastic and elegant solutions, much better than mine. I can’t claim to understand how KG’s one works but maths isn’t a strong point for me, so it just looks like magic :lol:

I wouldn’t be able to decide which the “better” one is, but once more it illustrates that there are often many ways to achieve the desired goal. And both of yours are just so much better than mine.
I’ll put an edit in the first post to refer visitors to the better ones.

Tulamide, thanks for the tip on drawing, another area I struggle to make complete sense of. Also I’d forgotten about the string length limit for VST so I shall need to address that.

I feel so lucky to share the company of so much cleverness and generosity of time, and I want you and all others who help me to know it’s really appreciated.

Cheers

Spogg
User avatar
Spogg
 
Posts: 3358
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England

Re: Mono display from a poly moduation source

Postby KG_is_back » Thu Mar 22, 2018 11:40 am

It is actually very simple. Poly to mono sums up all values. To be able to reliably tell which voice has the highest number, you need to make that number way higher than all lower values. That way after the summation the highest voice is the dominant and all the lower voices are just fractional garbage that you can throw out.
It just so happens to be that 2^n has precisely that property. 2^n is always at least 1 greater than sum of any combo of lower powers of 2.
Code: Select all
n:    0  1  2  3  4  5     6
2^n:  1+ 2+ 4+ 8+ 16+32=63<64

To extract the voice ID you just take base 2 logarithm. The lower voices will still contribute fractionally, but they always add up to less than 1, so you can just round down the number to get the actual ID of the voice.

This could also be adapted to get the lowest voice ID, but I can't quite figure out how at the moment.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Mono display from a poly moduation source

Postby tulamide » Thu Mar 22, 2018 11:42 am

Spogg wrote:I can’t claim to understand how KG’s one works but maths isn’t a strong point for me, so it just looks like magic :lol:

It's not that I wouldn't know something about math, yet I also struggle. I know that the logarithm to the base 2 of x is the inverse function of the exponential function 2^x, but I don't understand the need to do these two steps - and why it works.

Ok, just read KG's explanation above.
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Mono display from a poly moduation source

Postby tulamide » Thu Mar 22, 2018 11:49 am

KG_is_back wrote:This could also be adapted to get the lowest voice ID, but I can't quite figure out how at the moment.

When doing 2^x, every voice id has its own bit, which would scream for bitwise logicals, no?
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Mono display from a poly moduation source

Postby martinvicanek » Thu Mar 22, 2018 2:00 pm

Since the Combiner prim works with floats, you have only 23 mantisa bits to work with. So you would need two floats to fully encode which of the 32 voices are active.
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Next

Return to User Examples

Who is online

Users browsing this forum: No registered users and 56 guests