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
How can I get input audio "value" and make a decision?
22 posts
• Page 2 of 3 • 1, 2, 3
Re: How can I get input audio "value" and make a decision?
KG_is_back wrote:tulamide wrote:Changing the volume knob does nothing
I'm sure I didn't write that!
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: How can I get input audio "value" and make a decision?
tulamide wrote:Hey Nowhk,
I'm not sure if all details are clear to you. So pardon my descriptions, if already known:
What you see from the meter is not the actual value from the stream for several reasons.
1) The bi-directional meter is buggy. There's a "minmax" module inside it that maps all values to the 0-1 range of two directions of the meter.
2) A meter always shows as positive values. A signal of -0.5 will be shown as 0.5 just as a signal of +0.5.
3) A meter is just a slow peek at the values. Approx. 25 times per second is the signal evaluated. But a signal has 22050 values per second at least.
A signal consists of values in the range -1..+1, where 0 means no amplitude. At first I thought you'd try to establish some kind of persistent peak level meter (where the last peak is shown until a stronger peak comes in). But you are only interested in positive values in your example. Could you please tell a little bit more? What is the final goal of this test?
Yeah in fact that means nothing. Envelope follower should do the task (because doesn't take care of +/-, right?).
Basically, when I get any signal (i.e. > -INF) I should open a gate, that will do somethings (in my case, trigger a MIDI). And this gate must be opened until I reach again -INF (where I close the gate). And so on.
So, every time I get a signal (from > -INF, or a fixed value, such as >0.5) I trigger a MIDI.
Here for example:
I will trigger 5 MIDI note. Is it more clear what I'm looking for?
tulamide wrote:KG_is_back wrote:tulamide wrote:Changing the volume knob does nothing
I'm sure I didn't write that!
Hahah! Yeah of course for my "vision" it does nothing Where am I wrong? In Mono Boolean Module I'm sure...
- Nowhk
- Posts: 275
- Joined: Mon Oct 27, 2014 6:45 pm
Re: How can I get input audio "value" and make a decision?
Yes, that makes it more clear, thanks!
Sadly, I suck at dsp code, but in generic-pseudo-code it would look somewhat like this (assuming a gate at 0.5 and a width of 0.2):
To prevent the gate being switched off right after being switched on, some kind of envelope would also be needed. You can't use any of these informations directly, but maybe the dsp gurus can build something from this?
Sadly, I suck at dsp code, but in generic-pseudo-code it would look somewhat like this (assuming a gate at 0.5 and a width of 0.2):
- Code: Select all
input float signal
output boolean gate
boolean last
if abs(signal) > 0.49 and abs(signal) < 0.51
gate = not last
last = gate
end
To prevent the gate being switched off right after being switched on, some kind of envelope would also be needed. You can't use any of these informations directly, but maybe the dsp gurus can build something from this?
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: How can I get input audio "value" and make a decision?
tulamide wrote:To prevent the gate being switched off right after being switched on, some kind of envelope would also be needed. You can't use any of these informations directly, but maybe the dsp gurus can build something from this?
But this refers to the signal after Envelope follower, right? Envelope follower should just send signal Unipolar, so I don't have -3/+3, -4+4, and so on... so why do I need an envelope? I don't think I need abs?
______________________________
EDIT: Oh no, now I see using the example suggested by KG_is_back. True/False into the Mono Boolean Readout is heavy swapping between True and False with values over 0.5. That's why it process values at different clock, so sometimes is >0.5, sometimes not (since Bipolar, >-0.5).
But that's strange, because neither abs fix the problem; it seems that also with Envelope follower (attack 0, release 50%) sometimes it reads values between the signal. Uhm...
______________________________
I would use a gate of 0.1 (without any width). Once the signal exist (there is sound) this means (for me) that I need to trigger a MIDI. This because I pre-process signal before the Envelope Follower: a bandpass filter + noise gate. So I really get the waveform as I posted above. Signal (from 0.1 or more to 0db or more; else, silence).
It seems I can only make things with DSP code? I believe on using existing modules, but maybe is even better (fast process at low-level code).
I'm a programmer, I think I could do something with DSP code (I'm reading the manual right now).
A thing that I don't get is that "streambool", and how to convert in "just" bool true/false (so I can link to external modules). And also: how can I assign a value to a variable? So at the next clock/stream in/out I can check the state of it. The concepts of "functions" does not exist
Anyone can help me, masters?
- Nowhk
- Posts: 275
- Joined: Mon Oct 27, 2014 6:45 pm
Re: How can I get input audio "value" and make a decision?
At the moment, I'm here:
So, once I go over 0.5 (and index is never used, 0), thanks to pivot I set index to 1. Else it is always 0.
But seems it doesn't works ahahh
- Code: Select all
streamin in;
streamboolout out;
float index = 0;
float pivot = 2;
stage(2)
{
index = pivot - (out > 0.5 & index != 1) & 1.0;
}
stage(3)
{
out = index == 1;
}
So, once I go over 0.5 (and index is never used, 0), thanks to pivot I set index to 1. Else it is always 0.
But seems it doesn't works ahahh
- Nowhk
- Posts: 275
- Joined: Mon Oct 27, 2014 6:45 pm
Re: How can I get input audio "value" and make a decision?
KG_is_back wrote:There is something wrong with the formula in the DSPcode part.
- Code: Select all
out = (out|(in<0.5))&(in<1);
Unless the initial value is in 0.5-1 range this statement is always true for values below 1 and stays that way until in>1
No, why? The expression is true if in < 0.5, and is false if in >= 1. In between, i.e. 0.5 <= in < 1, out remains unchanged true or false, whatever it was previously. That's called hysteresis, I thought that was the OP's intention.
-
martinvicanek - Posts: 1328
- Joined: Sat Jun 22, 2013 8:28 pm
Re: How can I get input audio "value" and make a decision?
Guys, no one can help me a little more?
- Nowhk
- Posts: 275
- Joined: Mon Oct 27, 2014 6:45 pm
Re: How can I get input audio "value" and make a decision?
Here you go. I set the volume properties so that the output can now be >1. Also set Attack and Release controls to some value >0 to get a smoother envelope.
- Attachments
-
- Test2.fsm
- (159.21 KiB) Downloaded 750 times
-
martinvicanek - Posts: 1328
- Joined: Sat Jun 22, 2013 8:28 pm
Re: How can I get input audio "value" and make a decision?
I don't know if the OP will be able to work with that test2.fsm, but I see that it is not exactly what was asked for. Currently a gate opens at some value and closes at some other value. But according to the description it should be a gate that opens at a value and closes at the same value some time later.
I hate that I am not able to do this in dsp code, but my pseudo code example (some posts above) would do just that, only that it lacks a timer that makes sure the gate isn't closed right after opening. Is it not possible to do something like my example (plus timing) in dsp code?
I hate that I am not able to do this in dsp code, but my pseudo code example (some posts above) would do just that, only that it lacks a timer that makes sure the gate isn't closed right after opening. Is it not possible to do something like my example (plus timing) in dsp code?
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: How can I get input audio "value" and make a decision?
Refer to [url]Schmitt trigger[/url].
Tulamide, your pseudocode has two issues: Tt will not trigger if the signal jumps rightaway from, say, 0.43 to 0.5.3. Conversely, if the signal moves slowly through the (0.49,0.51) band, you'll get multiple triggers back and forth.
A code with a timer is of course possible as an alternative to the Schmitt Trigger. This is what I use as a clipping indicator (unoptimized for clarity):
Tulamide, your pseudocode has two issues: Tt will not trigger if the signal jumps rightaway from, say, 0.43 to 0.5.3. Conversely, if the signal moves slowly through the (0.49,0.51) band, you'll get multiple triggers back and forth.
A code with a timer is of course possible as an alternative to the Schmitt Trigger. This is what I use as a clipping indicator (unoptimized for clarity):
- Code: Select all
streamin in;
streamout clip;
float timer;
float T=4410; // 1/10 second
clip = 1&(timer<T);
timer = timer + clip;
timer = timer&(abs(in)<1)
-
martinvicanek - Posts: 1328
- Joined: Sat Jun 22, 2013 8:28 pm
22 posts
• Page 2 of 3 • 1, 2, 3
Who is online
Users browsing this forum: No registered users and 39 guests