[sc-users] Amplitude.kr settings for pitch/beat tracking

Dan Stowell danstowell at gmail.com
Wed Dec 13 22:14:52 PST 2006


Fabrice -

Not sure exactly what you're trying to achieve. Your example doesn't
use the "ampli" value anywhere, despite calculating it. Are you trying
to detect the beginnings of "events" (i.e. musical onsets) in the
incoming audio?

If so, I think you'll find that using the Amplitude UGen is not really
satisfactory for onset detection. In theory it's not so bad if you
have a monophonic source (as opposed to polyphonic), but the
performance (as you've found) includes many false positives and false
negatives and that can really get in the way of a decent musical
interaction.

Most of the reliable onset-detection methods tend to be FFT-based. For
example, it's straightforward to use my "FFTFlux" UGen to build an
onset detector based on spectral flux (which is what a lot of apps
seem to use these days; it's computationally not too expensive and it
works well enough for most). However, by far the easiest way to get
decent onset detection in SC is to use Nick Collins' OnsetDetection
UGen, so that should be the first thing to try. It doesn't have a
helpfile so here's how to use it:

  OnsetDetection.ar(z, tres)

Difficult eh?

Best
Dan


2006/12/13, Fabrice Mogini <fabrice.mogini at virgin.net>:
> Hi,
>
> I was wondering if anyone who has worked on beat/pitch tracking can give me
> tips on how to set attack and decay with the Amplitude UGen?
> I  keep on getting many values for the same long note in the AudioIn ( I
> only wanted to track the attack of each sound).
> Is it a good idea to use a Compander to get the attack and ignore the
> sustain portion of the sound and then detect the next event?
> Cheers
> Fabrice Mogini
>
> (
> SynthDef(\amptrack, {arg in=1, buffer, offset=0, run=0, loop=0, trigger=0,
> reclevel1=1, reclevel2=0, att=0.2, dec=0.2, tres=0.1;
>  var z, ampli;
>  z = Mix(AudioIn.ar([1,2]));
>
>
>  ampli = Amplitude.kr(z, att, dec);
>  //Compander.ar(z, z, MouseX.kr(0.1, 1), 1, 0.5, 0.01, 0.01);
>
>  SendTrig.kr(z > tres, 0,  z);
>
>
> }).load(s);
>
> OSCresponder(s.addr,'/tr',{ arg time, responder, msg; msg.postln }).add;
> )
>
> ~testamptrack = Synth.new(\amptrack); ~testamptrack.play;
>
> ~testamptrack.set([\att, 0.2, \dec, 0.2, \tres, 0.1]); //bad
> ~testamptrack.set([\att, 0.05, \dec, 0.05, \tres, 0.03]); //much better
> ~testamptrack.stop;
> //////////////////////////////////////////////
>
>
> Fabrice Mogini
>
> Phone: +447834279698
> Email: fabrice.mogini at virgin.net
>
>
>
> _______________________________________________
> sc-users mailing list
> sc-users at create.ucsb.edu
> http://www.create.ucsb.edu/mailman/listinfo/sc-users
>
>
>


-- 
http://www.mcld.co.uk


More information about the sc-users mailing list