Being a relative non-programmer, I'm not quite sure if this is even possible... My goal is a quick and dirty program that will measure the time between two large audio events (in the input sound buffer, live recording.) Essentially what I want to do is use ChucK for practical demonstrations of simple physics... IE demonstrating average velocity of a falling object (that generates a sufficiently loud event when it is released and when it hits the floor.) Any tips where to start on this project? Ryan
2009/2/17 rkramer
Being a relative non-programmer, I'm not quite sure if this is even possible... My goal is a quick and dirty program that will measure the time between two large audio events (in the input sound buffer, live recording.) Essentially what I want to do is use ChucK for practical demonstrations of simple physics... IE demonstrating average velocity of a falling object (that generates a sufficiently loud event when it is released and when it hits the floor.)
Any tips where to start on this project?
This can be really easy depending on how shady you mind the results being. For example, this seems to be a pretty good hand-clap detector with my MacBook mic: now => time lastnoise; while(1::samp => now) { if(adc.last() > 0.8 && now - lastnoise > second/10) { <<< "bang!", (now - lastnoise)/second >>>; now => lastnoise; } } That just waits for the microphone to report a value greater than 0.8 (where 1.0 is considered the "max" even though it can sometimes be higher). It will print "bang!" and the number of seconds since the last bang, if such a high value is heard and it's been at least 1/10 of a second since the last clap (so that the clap isn't detected in the room's echo or in repeated oscillations of the sound). I am usually satisfied with the easiest, shady solution, but if this kind of detection isn't good enough, there are plenty of ways to make it more robust which we can help you with if you need it. There's no "correct" solution that I know of, though. -- Tom Lieber http://AllTom.com/
Tom's solution is probably the easiest and most effective.
For other reasons, I've been thinking that it would be cool to have some
kind of gate UGen (though it doesn't necessarily output anything) that
triggers events depending on what has been chucked into it. Something like
this:
--------------------------
adc => GateTrigger gate;
0.01 => gate.threshold;
1::ms => gate.release;
gate.event => now;
-----------------------------
Here the gate.event would receive a signal when whatever is coming from adc
goes over 0.01 or below 0.01. You'd need some kind of filter or release so
the thing doesn't go off every time the signal crosses zero.
Maybe a digression...
On Tue, Feb 17, 2009 at 9:43 PM, rkramer
Being a relative non-programmer, I'm not quite sure if this is even possible... My goal is a quick and dirty program that will measure the time between two large audio events (in the input sound buffer, live recording.) Essentially what I want to do is use ChucK for practical demonstrations of simple physics... IE demonstrating average velocity of a falling object (that generates a sufficiently loud event when it is released and when it hits the floor.)
Any tips where to start on this project?
Ryan
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
-- Release me, insect, or I will destroy the Cosmos!
check out the "follower.ck" file in smelt (smelt.cs.princeton.edu). dt On Feb 17, 2009, at 4:24 PM, Stefan Blixt wrote:
Tom's solution is probably the easiest and most effective.
For other reasons, I've been thinking that it would be cool to have some kind of gate UGen (though it doesn't necessarily output anything) that triggers events depending on what has been chucked into it. Something like this:
-------------------------- adc => GateTrigger gate;
0.01 => gate.threshold; 1::ms => gate.release;
gate.event => now; -----------------------------
Here the gate.event would receive a signal when whatever is coming from adc goes over 0.01 or below 0.01. You'd need some kind of filter or release so the thing doesn't go off every time the signal crosses zero.
Maybe a digression...
On Tue, Feb 17, 2009 at 9:43 PM, rkramer
wrote: Being a relative non-programmer, I'm not quite sure if this is even possible... My goal is a quick and dirty program that will measure the time between two large audio events (in the input sound buffer, live recording.) Essentially what I want to do is use ChucK for practical demonstrations of simple physics... IE demonstrating average velocity of a falling object (that generates a sufficiently loud event when it is released and when it hits the floor.) Any tips where to start on this project?
Ryan
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
-- Release me, insect, or I will destroy the Cosmos! _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
participants (4)
-
Daniel Trueman
-
rkramer
-
Stefan Blixt
-
Tom Lieber