Thanks, Iain, this is great. I have found that I can use kp2, not just manually put 2 in. The fact that it can't handle two notes at the exact same time will probably lead me to put each instrument in its own table, though. I see what I was doing wrong- only that I put 2 instead of -2 for the gen number! This opcode is exactly what I need, though, thanks! -Chuckk On Tue, Feb 26, 2008 at 2:51 AM, Iain McCurdy wrote: > > Here you go. Save the following as two files: first the .csd and then a > text file "scale.txt". It just plays a major scale at different tempi. Note > durations are interpretted as beats which I think is one of the things you > mentioned. > > > --------timedseq.csd--------------------------------------------------------------------------------------------------------------------------------------------------- > > > > -odevaudio > > > > > sr = 44100 > ksmps = 10 > nchnls = 2 > > gisine ftgen 0,0,4096,10,1 ;A SINE WAVE > giscale ftgen 0,0,128,-23,"scale.txt" ;PHRASE FROM > EXTERNAL TEXT FILE > > instr 1 ;NOTE TRIGGERING INSTRUMENT > itempo = p4 ;TEMPO VALUE FROM p4 > kBPS = itempo/60 ;DERIVE BEATS-PER-SECOND > ibeats = 4 ;NUMBER OF BEATS IN LOOP > kphase phasor kBPS/ibeats ;DEFINE PHASOR ACCORDING TO > BEATS-PER-SECOND AND NUMBER OF BEAT IN PHRASE > kpointer = kphase * ibeats ;MULTIPLY PHASE VALUE BY NUMBER OF > BEATS > kp1 init 0 ;INITIALISE P-FIELD VARIABLES > kp2 init 0 ;INITIALISE P-FIELD VARIABLES > kp3 init 0 ;INITIALISE P-FIELD VARIABLES > kp4 init 0 ;INITIALISE P-FIELD VARIABLES > ktrigger timedseq kpointer, giscale, kp1, kp2,kp3, kp4 ;READ CURRENT > TRIGGER AND P-FIELDS FROM FUNCTION TABLE > schedkwhen ktrigger, 0, 0, 2, 0, kp3/kBPS, kp4 ;p3 VALUES ARE SCALED > ACCORDING TO TEMPO (ALTHOUGH THEY COULD BE LEFT UNSCALED > endin > > instr 2 ;SOUND GENERATING INSTRUMENT > aenv line 1,(p3),0 ;AMPLITUDE ENVELOPE > asig oscili 5000*aenv, cpspch(p4), gisine ;OSCILLATOR > outs asig, asig ;SEND AUDIO TO OUTPUTS > endin > > > > > i 1 0 4 60 ;PLAY PHRASE ONCE AT 60BPM > i 1 5 2 120 ;PLAY PHRASE ONCE AT 120BPM > i 1 8 4 240 ;PLAY PHRASE FOUR TIMES AT 240BPM > e > > > > ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > > ---------scale.txt----------- > instr strt dur pch > 2 0 0.5 8.00 > 2 0.5 0.5 8.02 > 2 1 0.5 8.04 > 2 1.5 0.5 8.05 > 2 2 0.5 8.07 > 2 2.5 0.5 8.09 > 2 3 0.5 8.11 > 2 3.5 0.5 9.00 > 2 4 0.5 8.00 > -1 4 -1 -1 > ------------------------------- > > Bye, > Iain > > > Date: Tue, 26 Feb 2008 01:22:15 +0200 > > > From: badmuthahubbard@gmail.com > > To: csound@lists.bath.ac.uk > > Subject: [Csnd] Re: RE: macros for csoundapi~? > > > > > > Hi again Iain. > > Finally, yes, I'd appreciate any working examples you could share. > > This attached file isn't one! > > It tells me that shedkwhen is trying to use 0 as instr number. > > Doesn't seem like that should be possible, if both the trigger and the > > instr number are directly from the output of timedseq... > > > > Thanks, I think you were right from the beginning. > > -Chuckk > > > > On Sat, Feb 23, 2008 at 1:55 PM, Iain McCurdy > wrote: > > > > > > Hi Chuckk, > > > You can trigger lists of score events at any time using timedseq. Scores > can > > > be stored either in function tables or in separate text files which are > > > loaded into GEN 23 tables. Scores can also be looped. Let me know if > you'd > > > like an example. > > > Bye, > > > Iain > > > > > > > Date: Sat, 23 Feb 2008 11:53:21 +0200 > > > > From: badmuthahubbard@gmail.com > > > > To: csound@lists.bath.ac.uk > > > > Subject: [Csnd] macros for csoundapi~? > > > > > > > > > > > > > > Hi. > > > > I'm using csoundapi~ to send score events from Pd, and I'd like to > > > > make a percussion track in .sco format to accompany, rather than > > > > adding drum sequencing to my Pd patch. I have my sequencer now > > > > sending tempo control events, and sending p3 in beats instead of > > > > seconds, and now I'm wondering how I can make a section of .sco that > > > > will only play when the Pd sequencer starts, instead of when the .sco > > > > loads. I initially thought to put the percussion .sco events right in > > > > the .csd, and send something like "run 0" to csoundapi~ when it loads; > > > > but now I'm wondering if it would be possible to put score macros in > > > > the .csd file and trigger them through csoundapi~. Something like > > > > "event $PATTERN01"... > > > > Any possibilities for something like this? > > > > > > > > Maybe I could write all the percussion .sco events as event_i commands > > > > in a separate instrument that could be called whenever the Pd > > > > sequencer starts? > > > > Let me know if I'm not explaining this well enough. > > > > Thanks. > > > > > > > > -Chuckk > > > > > > > > -- > > > > http://www.badmuthahubbard.com > > > > > > > > > > > > Send bugs reports to this list. > > > > To unsubscribe, send email sympa@lists.bath.ac.uk with body > "unsubscribe > > > csound" > > > > > > ________________________________ > > > Climb to the top of the charts! Play the word scramble challenge with > star > > > power. Play now! > > > > > > > > -- > > http://www.badmuthahubbard.com > > > > > > Send bugs reports to this list. > > To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe > csound" > > ________________________________ > Shed those extra pounds with MSN and The Biggest Loser! Learn more. -- http://www.badmuthahubbard.com