I have written a simple sound player that uses the `table3' opcode controlled by OSC messages. In this example I send the OSC messages from my linux console. # some alias alias cs_play='oscsend localhost 57112 /play i' alias cs_speed='oscsend localhost 57112 /speed f' alias cs_pos='oscsend localhost 57112 /position f' # start csound in another console nohup xterm -e csound test.csd >/dev/null & cs_play 1 # start cs_speed 1.5 # set the speed; 1=normal cs_speed 0.75 cs_pos 45 # set the position in seconds cs_pos 99 cs_play 0 # pause cs_play 1 # resume cs_speed 2 cs_pos 0 cs_pos 148 cs_play 0 cs_speed 0.3 cs_play 1 cs_play 0 # finish pkill csound unalias cs_play cs_speed cs_pos -d -m0 -odac sr = 44100 ksmps = 64 nchnls = 2 0dbfs = 1 zakinit 1, 1 gihandle OSCinit 57112 gapha init 0 gkspeed init 1 gkplaying init 0 gidur = 151 ; duration of the loop (sec) instr 1 isamps = gidur*sr gkplaying = 1 kphs zkr 1 iphs = p4 ptr: gapha phasor gkspeed/gidur, iphs rireturn if (kphs != 0) then phase: iphs = i(kphs) - 1 rireturn reinit phase reinit ptr endif andx = gapha * isamps al table3 andx, 1 ar table3 andx, 2 out al, ar zkcl 0, 1 endin instr 2 ; control kstatus init 0 ksval init 0 kpval init 0 nxtmsg: kplay OSClisten gihandle, "/play", "i", kstatus kspeed OSClisten gihandle, "/speed", "f", ksval kpos OSClisten gihandle, "/position", "f", kpval if (kplay == 0) goto position if (kstatus == 1) then if (gkplaying != 0) kgoto nxtmsg kpha downsamp gapha event "i", 1, 0, 36000, kpha else turnoff2 1,0,0 gkplaying = 0 endif position: if (kpos == 0) goto speed zkw kpval/gidur + 1, 1 speed: if (kspeed == 0) goto ex gkspeed = ksval kgoto nxtmsg ex: endin f1 0 8388608 1 "stornello.wav" 0 0 1 f2 0 8388608 1 "stornello.wav" 0 0 2 i2 0 36000 e tito On Wed, Dec 28, 2011 at 04:54:13PM -0800, Thomas Hass wrote: > Hi everyone, > > This is my first post to the list, but I've been loving Csound ever since > Dr. B introduced it to me last year at Berklee. > > I'm trying to develop some additional transport controls to work with > diskin2 based off the example, SF_Play_from_HD_2.csd. The main problem > that I'm encountering is that this csd keeps track of the current position > in a file based off a clock. This approach doesn't account for the user > changing the pitch of the file (which also alters the rate at which the > file is read). So if the user presses play, raises the pitch, pauses, then > resumes, the file starts at a position prior to where it should. I'm also > having problems implementing a seek functionality for the same reasons. > Does anyone have any examples of a file player with more transport > controls? > > Any help would be much appreciated. > > -Thomas > > Send bugs reports to the Sourceforge bug tracker > https://sourceforge.net/tracker/?group_id=81968&atid=564599 > Discussions of bugs and features can be posted here > To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" > Send bugs reports to the Sourceforge bug tracker https://sourceforge.net/tracker/?group_id=81968&atid=564599 Discussions of bugs and features can be posted here To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"