Which is the correct way to use streamboolout in a codebox?
Archive · 201210 old posts
From the original SynthMaker forum (2004–2014), with its members’ names and dates.
distante ·
Continuing with my slowwwwwww learning, I'm trying to add a clip lead to a hard limiter that I made with oddson's help, I'm trying to change the status of the lead using streamboolout in the codebox but the connector is a blue one that doesn't connect to the regular bool one
look:
To which primitive do I have to connect the streambool out? 😕
oddson ·
You cannot connect streams to 'green' data-types without a triggered convertion primitve called Mono To Float.
For StreamBoolOut there is a module called Mono Boolean Readout... I think it's part of the stock toolbox (because I have it and I only use the stock toolbox). Inside it is the M2F primitive to make it work.
oddson ·
It occurs to me that if you're using it with a limiter you may be looking for a visual display of clipping.
The problem with turning a boolean stream into green data is it is sample when triggered which may or may not be when clipping is occuring... so you need to have a boolean value that holds the fact that it's been triggered for some period of time so that the green sampling process can capture it.
Also, the readout module mentioned above is of little use to you except to see how the M2F primitive is used to extract the data from the stream.
I'm sure there are posts here somewhere that show what I'm talking about without having to reinvent the wheel...
distante ·
Yeap! I looked in the forum and found a thread about a "simple peak" or so. But It was a manual reset peak lead meter.
I manage to do the peak meter (stereo) in this way (Outside and before the codebox)
Is a little bit messy right now, but Look like is working, once I had it finish I will upload the osm here, hopping that isn't very stupid osm 😊
distante ·
So...
This is the osm:
But I think I'm doing something wrong, the osm works with the test tone (either just one mono signal or 2 ) the lead turn on when a clip is detected and changes the size amplitude to the limited set (Ceiling)
BUT! I'm not quite sure if the way that I'm cutting the Amplitude is correct because when I feed a wave file into the module I can hear the changes very presents.
Other thing that wasn't clear in this topic is the intersamples peak.
😝
oddson ·
distante wrote: BUT! I'm not quite sure if the way that I'm cutting the Amplitude is correct because when I feed a wave file into the module I can hear the changes very presents.
Not sure what this means...
Looking at a scope of the output it seems to be clipping to the threshold. This will cause aliasing however.
The other issue is your peak detector cannot work this way.
The M2F primitive cannot capture the peaks if it's sampling is uncorrelated with the phase of the wave (which it always will be!)... it might hit the peak but it's very unlikely that it will.
distante ·
oddson wrote: Not sure what this means...
I mean that the wave sounds estrange, like an overdrive but since this is a hard clip, I suppose this is normal... don't?
oddson wrote: Looking at a scope of the output it seems to be clipping to the threshold. This will cause aliasing however.
Is this for the way that the wave is been cut?
The M2F primitive cannot capture the peaks if it's sampling is uncorrelated with the phase of the wave... it might hit the peak but it's very unlikely that it will.
No idea how to stream mono to Float without the M2F really 🙁
infuzion ·
oddson wrote:
distante wrote: BUT! I'm not quite sure if the way that I'm cutting the Amplitude is correct because when I feed a wave file into the module I can hear the changes very presents.
The M2F primitive cannot capture the peaks if it's sampling is uncorrelated with the phase of the wave (which it always will be!)... it might hit the peak but it's very unlikely that it will.
You have to write some Stream Code to capture & hold the peaks so the M2F can read them.
distante ·
So the correct way to do this will be use a stay-on led don't?
Send a streamout with a bool value (1) if the peak was detected ... but in each sample this will change and because the M2F primitive only works by ticks other samples can be lost...
mmm
oddson ·
This will give a stream Boolean output that is stable enough to be sampled by the M2F primitive.
peak = peak | x>lim;
// peak will be true if either it was true last pass
// or if the current value of x is above the limit
i = i + 1; //increment a counter
i = i - (i>44100 & i); // reset the counter every so often
peak = peak & (i>0); //set the peak to true only if it already is AND the counter hasn't just been reset.
Reset is every second at 44100 Hz sample rate, but it doesn't have to be.
Second peak assignment is needed otherwise it would stay on forever once you hit a peak.
Wrote something here? To have a post removed or your name hidden, write to [email protected].