Re: How can I get input audio "value" and make a decision?
Posted: Fri Apr 17, 2015 10:59 am
KG_is_back wrote:tulamide wrote:Changing the volume knob does nothing
DSP Robotics and FlowStone Graphical Programming Software Support and Forums
https://dsprobotics.com/support/
KG_is_back wrote:tulamide wrote:Changing the volume knob does nothing
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?
tulamide wrote:KG_is_back wrote:tulamide wrote:Changing the volume knob does nothing
I'm sure I didn't write that!
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
endtulamide 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?
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;
}
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
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)