[linux-audio-dev] Re: Tuning

Mario Lang mlang at delysid.org
Sat Jan 29 15:17:52 UTC 2005


Stefan Turner <stefan_turner at yahoo.co.uk> writes:

> The other suggestions should good, but alternatively
> you write a patch in Pure Data to do this, using the
> built-in object fiddle~, which estimates pitch (fairly
> accurate with tweaking) and a LADSPA pitch shifter
> (the best I've found is pitchScaleHQ from the
> collection at www.plugin.org.uk). PD takes a while to
> learn how to use, but once you have it's great for
> doing stuff like this quickly.

Note that SuperCollider can do this as well, as long as you are limiting
the requirements to monophony.  I guess that would hold for
Pd as well anyway.  And its a *very* simple patch!

s.boot;
(
{ var signal, freq, hasFreq, newFreq;
    signal = AudioIn.ar(1);
    # freq, hasFreq = Pitch.kr(signal, ampThreshold: 0.02, median: 7);
    newFreq = freq.cpsmidi.round(hasFreq).midicps;
    PitchShift.ar(signal,
        0.1,            // grain size
        newFreq/freq,   // ratio
        0,              // pitch dispersion
        0.004           // time dispersion
    )
}.play(s);
)

That is all you need.  Use this with a guitar as input, and try
to slide or vibrato.  It will always correct to the nearest semitone.

Note how nicely SuperColliders language can be used to capture the underlying
idea.  If hasFreq is 0 (i.e., Pitch has no idea what freq the signal has),
round does not do anything.  If hasFreq is 1, newFreq
will be rounded to the nearest semitone, automagically.

-- 
CYa,
  Mario



More information about the Linux-audio-dev mailing list