i am sorry for the reply posting, i am kind if new
to posting to this list and to SuperCollier.
I'll make a new thread.
Thank you Fredrik for your reply! I was only
adjusting the TempoClock in my code and not the RedMst.clock.
And thank you for the example code it can help me
make my code better!
Grtz,
Maurice
Earlier replies:
25 dec 2008 kl. 16.39 skrev Maurice van
Loon:
> Dear list, > > I am working on a kind of track player with tempo adjusting by > tapping on the spacebar. I am working with the nice RedMst class > but when a RedTrk is playing it is not possible to change its > tempo. It is only possible to define each RedTrk in a RedGrandMst > as a different song, but that is not handy. Does have anyone a > suggestion? you are doing something wrong. of course you can change the tempo while your redtrk is playing. post your code. RedMst.clock.tempo= 1.0.rrand(3.0); //set random tempo example > Does have anyone has seriously worked on a tapper to adjust a tempo > in live performances? The only class I found is TapTimer.sc. > > Thank you for any help. > > Maurice here's an example. takes the average of the last n taps. change TempoClock.default to your own clock. i'm sure other people have made more intricate ones. ( var n= 4; //number of taps to collect var timeout= 3; //timeout until restart in seconds var times= 0.dup(n), counter, lastTime= 0; var win= GUI.window.new("redTap", Rect(100, 200, 180, 80), false); var but= GUI.button.new(win, win.view.bounds).states_([["bpm= 120.00", Color.black, Color.clear]]) .action_{ var newTempo, nowTime= SystemClock.seconds; if(nowTime-timeout>lastTime, { "timedout".postln; counter= 0; }); if(counter<(n-1), { times= times.put(counter, SystemClock.seconds); counter= counter+1; }, { times= times.put(counter, SystemClock.seconds); newTempo= times.differentiate.drop(1).mean; ("setting new tempo"+newTempo).postln; TempoClock.default.tempo= 1/newTempo; but.states= [["bpm="+(60/newTempo).round(0.01), Color.black, Color.clear]]; times= times.rotate(-1); }); lastTime= nowTime; }; win.view.background= "">win.front; CmdPeriod.doOnce({if(win.isClosed.not, {win.close})}); TempoClock.default.tempo= 2; Pbind(\legato, 0.2).play; ) #| fredrikolofsson.com klippav.org musicalfieldsforever.com |# _______________________________________________ sc-users mailing list info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml archive: https://listarc.bham.ac.uk/marchives/sc-users/ search: https://listarc.bham.ac.uk/lists/sc-users/search/ |