esluyter / super-bufrd

UGens for accessing long buffers with subsample accuracy
GNU General Public License v3.0
26 stars 3 forks source link

.arDetails playhead position in frames instead of seconds #27

Closed esluyter closed 3 years ago

esluyter commented 3 years ago

from readme:

(
~synth = {
    var pos = \pos.skr(0);
    var trig = \trig.tr(0);
    var rate = MouseX.kr(-12, 12);
    var lpf_freq = rate.abs.linlin(1, 3, 20000, 5000); // make fast forward less grating on ears
    var sig, playhead, isPlaying;
    #sig, playhead, isPlaying = SuperPlayBufX.arDetails(2, ~buf, rate, trig, start: pos);
    SendReply.ar(Impulse.ar(10), '/playhead', playhead.components); // send both components of playhead
    LPF.ar(sig, lpf_freq);
}.play;

// print the elapsed time:
OSCdef(\playhead, { |msg|
    ("Playhead: %       BufDur: %".format(
        ~buf.atPair(*msg[3..4]).asTimeString,
        ~buf.duration.asTimeString)
    ).postln;
}, '/playhead');
)