Csound Csound-dev Csound-tekno Search About

[Csnd] Step Sequencer problem

Date2010-12-02 17:34
FromEd Costello
Subject[Csnd] Step Sequencer problem
Hi,

I'm trying to create a step sequencer type instrument, this uses to instruments with one triggering the other when a table value of 1 is read, unfortunately I'm getting a weird high pitched noise when I run the patch and can't figure out why its happening,

<CsoundSynthesizer>

<CsOptions>

</CsOptions>

<CsInstruments>

0dbfs = 1

nchnls = 2

instr clock

k_clock phasor 1/2

gk_clock = k_clock

endin

instr 1

ilength = 16

ktamp table gk_clock * ilength, p4, 0, 0, 1

if ktamp == 1 then

event "i",2, 0, .1

endif

endin

instr 2

a1 oscili .2, 100, 1

outs a1,a1

endin

</CsInstruments>

<CsScore>

f 1 0 1024 10 1

f100 0 16 2 1 0 0 1 0 0 1 0 0 1 0 1 0 1 0 1

i"clock" 0 90

i1 0 2 100

</CsScore>

</CsoundSynthesizer>


Anyone any ideas?

Thanks

Ed


Date2010-12-02 17:57
FromRory Walsh
Subject[Csnd] Re: Step Sequencer problem
You're instrument is being triggered over and over again. The easiest
albeit limited way to create a step sequencer is like this:



-odac


sr = 44100
nchnls = 2

instr 100
kcnt phasor p4
kcnt = int(kcnt*16)
ktrig changed kcnt

;hihat		
;1	2	3	4	5	6	7	8	9	10	11	12	13	14	15	16
;X 	- 	X	- 	X 	- 	X	- 	X	- 	X	- 	-	- 	X	-
;snare
;-	-	- 	- 	X 	-	-	- 	-	-	- 	-	X 	-	-	-
;kick
;X 	- 	-	X 	- 	- 	X 	-	- 	- 	X 	- 	-	- 	-	X


if(ktrig ==1 && (kcnt==1 || kcnt==4 || kcnt == 7 || kcnt ==11 || kcnt==15)) then
	event "i", 3, 0, .5, 20000, 100, 1		;Kick
endif
if(ktrig ==1 && (kcnt==1 || kcnt==3 || kcnt == 5 || kcnt ==7 || kcnt
==9 || kcnt ==11 || kcnt ==15)) then
	event "i", 1, 0, 1, 5000, 10000				;Hihat
endif
if(ktrig ==1 && (kcnt==5 || kcnt ==13)) then
	event "i", 2, 0, .5, 10000, 1000, 140, 1 	;Snare
endif

endin

;---------------------------------------------
instr 1; hihat closed
k1 expon p4, p3*.1, 1000
a1 randi k1, 10000
a2 oscili a1, p5, 1
outs a2, a2
endin

;----------------------------------------------
instr 2;snare
aenv1  expon  p4, 0.3, .5
a1   oscili aenv1, p6, p7
aamp      expon     p5,  0.2,   10
arand     rand      aamp
outs a1+arand, a1+arand
endin
;----------------------------------------------
instr 3; kick
k1  expon    p5, 0.2, 50
aenv expon p4, p3, 0.01
a1  poscil    aenv, k1, p6
outs a1, a1
endin



f1 0 1024 10 1
i100 0 100 .5



I have a more complex example that uses tables if you want to take a
look, it's not really done but should provide you with a starting
point. Saying that my students and I have knocked a lot of fun out of
the above instrument.


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"

Date2010-12-02 18:36
FromEd Costello
Subject[Csnd] Re: Re: Step Sequencer problem
Hey thanks for the reply, I wouldn't mind looking at the table version actually, I have other instruments in a score that use tables in a step sequencer way but the table is only being used to change the pitch, I ran into trouble with this because I'm now trying to make percussion instruments and you can't just have one long note playing with them.

On 2 December 2010 17:57, Rory Walsh <rorywalsh@ear.ie> wrote:
You're instrument is being triggered over and over again. The easiest
albeit limited way to create a step sequencer is like this:

<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>
sr = 44100
nchnls = 2

instr 100
kcnt phasor p4
kcnt = int(kcnt*16)
ktrig changed kcnt

;hihat
;1      2       3       4       5       6       7       8       9       10      11      12      13      14      15      16
;X      -       X       -       X       -       X       -       X       -       X       -       -       -       X       -
;snare
;-      -       -       -       X       -       -       -       -       -       -       -       X       -       -       -
;kick
;X      -       -       X       -       -       X       -       -       -       X       -       -       -       -       X


if(ktrig ==1 && (kcnt==1 || kcnt==4 || kcnt == 7 || kcnt ==11 || kcnt==15)) then
       event "i", 3, 0, .5, 20000, 100, 1              ;Kick
endif
if(ktrig ==1 && (kcnt==1 || kcnt==3 || kcnt == 5 || kcnt ==7 || kcnt
==9 || kcnt ==11 || kcnt ==15)) then
       event "i", 1, 0, 1, 5000, 10000                         ;Hihat
endif
if(ktrig ==1 && (kcnt==5 || kcnt ==13)) then
       event "i", 2, 0, .5, 10000, 1000, 140, 1        ;Snare
endif

endin

;---------------------------------------------
instr 1; hihat closed
k1 expon p4, p3*.1, 1000
a1 randi k1, 10000
a2 oscili a1, p5, 1
outs a2, a2
endin

;----------------------------------------------
instr 2;snare
aenv1  expon  p4, 0.3, .5
a1   oscili aenv1, p6, p7
aamp      expon     p5,  0.2,   10
arand     rand      aamp
outs a1+arand, a1+arand
endin
;----------------------------------------------
instr 3; kick
k1  expon    p5, 0.2, 50
aenv expon p4, p3, 0.01
a1  poscil    aenv, k1, p6
outs a1, a1
endin

</CsInstruments>
<CsScore>
f1 0 1024 10 1
i100 0 100 .5
</CsScore>
</CsoundSynthesizer>

I have a more complex example that uses tables if you want to take a
look, it's not really done but should provide you with a starting
point. Saying that my students and I have knocked a lot of fun out of
the above instrument.


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"



Date2010-12-02 18:47
FromRory Walsh
Subject[Csnd] Re: Re: Re: Step Sequencer problem
Here you go. I choose to write a special UDO that outputs a trigger
pulse whenever it comes across a 1 in a function table. Let me know if
it works ok.



;-+rtaudio=alsa -odac:hw:1,0
-odac


sr = 44100
nchnls = 2
;written by Rory Walsh 2010

giFreq init 1

opcode triggerTable, k, ki;
kfreq, ifn xin
kout = 0
k1 phasor kfreq
kcnt = int(k1*ftlen(ifn))
kgo changed kcnt
ktab tab k1, ifn, 4

if(kgo==1 && (ktab==1||kcnt==0)) then
kout = 1
endif
xout kout
endop
;---------------------------------------------------------------------------
instr 100	;instr 100 controls the drums
ifreq = p4

ihihattable = p5
isnaretable = p6
ikicktable = p7

;hihat
khihat triggerTable ifreq, p5
if(khihat==1)  then
event "i", 1, 0, .25, 10
endif

;snare
ksnare triggerTable ifreq, p6
if(ksnare==1)  then
;			dur	amp
event "i", 2, 	0, 	1, 	1000
endif

;kick
kkick triggerTable ifreq, p7
if(kkick==1)  then
event "i", 3, 0, .25, 100, 1
endif

endin

;---------------------------------------------------------------------------
instr 1; hihat closed
aamp      expon     1000,  0.1,   p4
arand     rand      aamp
outs arand, arand
endin
;---------------------------------------------------------------------------
instr 2;snare
aenv1  expon  p4, 0.03, 0.5
a1   oscili aenv1, 147, 1
aamp      expon     1000,  0.2,   10
arand     rand      aamp
outs a1+arand, a1+arand
endin
;---------------------------------------------------------------------------
instr 3; kick
k1  expon    p4, 0.2, 50
aenv expon 1, p3, 0.01
a1  poscil    10000, k1, p5
outs a1*aenv, a1*aenv
endin
;---------------------------------------------------------------------------
instr 5; melody
kenv expon p4, p3, 0.001
a1 oscil kenv, p5, p6
outs a1, a1
endin



f1 0 1024 10 1
f9 0 1024 10 1 0.5 0.25 0.17
;hihat		0		.25		.50		.75		1		.25		.50	.	75
f2 0 16 2 	1 	0 	1	0 	1 	0 	1 	0	1 	0	1	0	1	0	1	0
f5 0 16 2 	1 	0 	1	0 	1 	0 	1 	0	1 	0	1	0	1	1	1	1
;snare
f3 0 16 2 	0 	0 	0 	0 	1 	0 	0 	0	0 	0 	0 	0 	1 	0 	0 	0
;kick
f4 0 16 2 	1 	0 	0 	1 	0 	0 	1 	0	0 	0 	1 	0 	0 	0 	0 	0

;drums		freq	hhft	snft	kft
i100 0 4 	.5	2	3	4	
i100 4 4 	.5	5	3	4
i100 8 4 	.5	2	3	4





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"

Date2010-12-02 19:09
FromEd Costello
Subject[Csnd] Re: Re: Re: Re: Step Sequencer problem
Fantastic! That works perfectly, I was able to slot that in with what I had already no problem, Thanks Rory

On 2 December 2010 18:47, Rory Walsh <rorywalsh@ear.ie> wrote:
Here you go. I choose to write a special UDO that outputs a trigger
pulse whenever it comes across a 1 in a function table. Let me know if
it works ok.

<CsoundSynthesizer>
<CsOptions>
;-+rtaudio=alsa -odac:hw:1,0
-odac
</CsOptions>
<CsInstruments>
sr = 44100
nchnls = 2
;written by Rory Walsh 2010

giFreq init 1

opcode triggerTable, k, ki;
kfreq, ifn xin
kout = 0
k1 phasor kfreq
kcnt = int(k1*ftlen(ifn))
kgo changed kcnt
ktab tab k1, ifn, 4

if(kgo==1 && (ktab==1||kcnt==0)) then
kout = 1
endif
xout kout
endop
;---------------------------------------------------------------------------
instr 100       ;instr 100 controls the drums
ifreq = p4

ihihattable = p5
isnaretable = p6
ikicktable = p7

;hihat
khihat triggerTable ifreq, p5
if(khihat==1)  then
event "i", 1, 0, .25, 10
endif

;snare
ksnare triggerTable ifreq, p6
if(ksnare==1)  then
;                       dur     amp
event "i", 2,   0,      1,      1000
endif

;kick
kkick triggerTable ifreq, p7
if(kkick==1)  then
event "i", 3, 0, .25, 100, 1
endif

endin

;---------------------------------------------------------------------------
instr 1; hihat closed
aamp      expon     1000,  0.1,   p4
arand     rand      aamp
outs arand, arand
endin
;---------------------------------------------------------------------------
instr 2;snare
aenv1  expon  p4, 0.03, 0.5
a1   oscili aenv1, 147, 1
aamp      expon     1000,  0.2,   10
arand     rand      aamp
outs a1+arand, a1+arand
endin
;---------------------------------------------------------------------------
instr 3; kick
k1  expon    p4, 0.2, 50
aenv expon 1, p3, 0.01
a1  poscil    10000, k1, p5
outs a1*aenv, a1*aenv
endin
;---------------------------------------------------------------------------
instr 5; melody
kenv expon p4, p3, 0.001
a1 oscil kenv, p5, p6
outs a1, a1
endin

</CsInstruments>
<CsScore>
f1 0 1024 10 1
f9 0 1024 10 1 0.5 0.25 0.17
;hihat          0               .25             .50             .75             1               .25             .50     .       75
f2 0 16 2       1       0       1       0       1       0       1       0       1       0       1       0       1       0       1       0
f5 0 16 2       1       0       1       0       1       0       1       0       1       0       1       0       1       1       1       1
;snare
f3 0 16 2       0       0       0       0       1       0       0       0       0       0       0       0       1       0       0       0
;kick
f4 0 16 2       1       0       0       1       0       0       1       0       0       0       1       0       0       0       0       0

;drums          freq    hhft    snft    kft
i100 0 4        .5      2       3       4
i100 4 4        .5      5       3       4
i100 8 4        .5      2       3       4

</CsScore>
</CsoundSynthesizer>


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"



Date2010-12-02 19:21
FromRory Walsh
Subject[Csnd] Re: Re: Re: Re: Re: Step Sequencer problem
I'm glad it worked. I'm sure others could probably propose better ways
of doing this, and perhaps easier ways too..

On 2 December 2010 19:09, Ed Costello  wrote:
> Fantastic! That works perfectly, I was able to slot that in with what I had
> already no problem, Thanks Rory
>
> On 2 December 2010 18:47, Rory Walsh  wrote:
>>
>> Here you go. I choose to write a special UDO that outputs a trigger
>> pulse whenever it comes across a 1 in a function table. Let me know if
>> it works ok.
>>
>> 
>> 
>> ;-+rtaudio=alsa -odac:hw:1,0
>> -odac
>> 
>> 
>> sr = 44100
>> nchnls = 2
>> ;written by Rory Walsh 2010
>>
>> giFreq init 1
>>
>> opcode triggerTable, k, ki;
>> kfreq, ifn xin
>> kout = 0
>> k1 phasor kfreq
>> kcnt = int(k1*ftlen(ifn))
>> kgo changed kcnt
>> ktab tab k1, ifn, 4
>>
>> if(kgo==1 && (ktab==1||kcnt==0)) then
>> kout = 1
>> endif
>> xout kout
>> endop
>>
>> ;---------------------------------------------------------------------------
>> instr 100       ;instr 100 controls the drums
>> ifreq = p4
>>
>> ihihattable = p5
>> isnaretable = p6
>> ikicktable = p7
>>
>> ;hihat
>> khihat triggerTable ifreq, p5
>> if(khihat==1)  then
>> event "i", 1, 0, .25, 10
>> endif
>>
>> ;snare
>> ksnare triggerTable ifreq, p6
>> if(ksnare==1)  then
>> ;                       dur     amp
>> event "i", 2,   0,      1,      1000
>> endif
>>
>> ;kick
>> kkick triggerTable ifreq, p7
>> if(kkick==1)  then
>> event "i", 3, 0, .25, 100, 1
>> endif
>>
>> endin
>>
>>
>> ;---------------------------------------------------------------------------
>> instr 1; hihat closed
>> aamp      expon     1000,  0.1,   p4
>> arand     rand      aamp
>> outs arand, arand
>> endin
>>
>> ;---------------------------------------------------------------------------
>> instr 2;snare
>> aenv1  expon  p4, 0.03, 0.5
>> a1   oscili aenv1, 147, 1
>> aamp      expon     1000,  0.2,   10
>> arand     rand      aamp
>> outs a1+arand, a1+arand
>> endin
>>
>> ;---------------------------------------------------------------------------
>> instr 3; kick
>> k1  expon    p4, 0.2, 50
>> aenv expon 1, p3, 0.01
>> a1  poscil    10000, k1, p5
>> outs a1*aenv, a1*aenv
>> endin
>>
>> ;---------------------------------------------------------------------------
>> instr 5; melody
>> kenv expon p4, p3, 0.001
>> a1 oscil kenv, p5, p6
>> outs a1, a1
>> endin
>>
>> 
>> 
>> f1 0 1024 10 1
>> f9 0 1024 10 1 0.5 0.25 0.17
>> ;hihat          0               .25             .50             .75
>>       1               .25             .50     .       75
>> f2 0 16 2       1       0       1       0       1       0       1       0
>>       1       0       1       0       1       0       1       0
>> f5 0 16 2       1       0       1       0       1       0       1       0
>>       1       0       1       0       1       1       1       1
>> ;snare
>> f3 0 16 2       0       0       0       0       1       0       0       0
>>       0       0       0       0       1       0       0       0
>> ;kick
>> f4 0 16 2       1       0       0       1       0       0       1       0
>>       0       0       1       0       0       0       0       0
>>
>> ;drums          freq    hhft    snft    kft
>> i100 0 4        .5      2       3       4
>> i100 4 4        .5      5       3       4
>> i100 8 4        .5      2       3       4
>>
>> 
>> 
>>
>>
>> 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"


Date2010-12-02 20:42
FromVictor Lazzarini
Subject[Csnd] Re: Re: Step Sequencer problem
Easiest, but not that elegant!

If Ed changes his code to this:

instr 1
ktampold init 0
ilength = 16
ktamp table gk_clock * ilength, p4, 0, 0, 1
if ktamp == 1 && ktamp != ktampold then
event "i",2, 0, .5
endif
ktampold = ktamp
endin

He has a more general step sequencer without all those ifs and elses

Victor

On 2 Dec 2010, at 17:57, Rory Walsh wrote:

> You're instrument is being triggered over and over again. The easiest
> albeit limited way to create a step sequencer is like this:
>
> 
> 
> -odac
> 
> 
> sr = 44100
> nchnls = 2
>
> instr 100
> kcnt phasor p4
> kcnt = int(kcnt*16)
> ktrig changed kcnt
>
> ;hihat		
> ;1	2	3	4	5	6	7	8	9	10	11	12	13	14	15	16
> ;X 	- 	X	- 	X 	- 	X	- 	X	- 	X	- 	-	- 	X	-
> ;snare
> ;-	-	- 	- 	X 	-	-	- 	-	-	- 	-	X 	-	-	-
> ;kick
> ;X 	- 	-	X 	- 	- 	X 	-	- 	- 	X 	- 	-	- 	-	X
>
>
> if(ktrig ==1 && (kcnt==1 || kcnt==4 || kcnt == 7 || kcnt ==11 ||  
> kcnt==15)) then
> 	event "i", 3, 0, .5, 20000, 100, 1		;Kick
> endif
> if(ktrig ==1 && (kcnt==1 || kcnt==3 || kcnt == 5 || kcnt ==7 || kcnt
> ==9 || kcnt ==11 || kcnt ==15)) then
> 	event "i", 1, 0, 1, 5000, 10000				;Hihat
> endif
> if(ktrig ==1 && (kcnt==5 || kcnt ==13)) then
> 	event "i", 2, 0, .5, 10000, 1000, 140, 1 	;Snare
> endif
>
> endin
>
> ;---------------------------------------------
> instr 1; hihat closed
> k1 expon p4, p3*.1, 1000
> a1 randi k1, 10000
> a2 oscili a1, p5, 1
> outs a2, a2
> endin
>
> ;----------------------------------------------
> instr 2;snare
> aenv1  expon  p4, 0.3, .5
> a1   oscili aenv1, p6, p7
> aamp      expon     p5,  0.2,   10
> arand     rand      aamp
> outs a1+arand, a1+arand
> endin
> ;----------------------------------------------
> instr 3; kick
> k1  expon    p5, 0.2, 50
> aenv expon p4, p3, 0.01
> a1  poscil    aenv, k1, p6
> outs a1, a1
> endin
>
> 
> 
> f1 0 1024 10 1
> i100 0 100 .5
> 
> 
>
> I have a more complex example that uses tables if you want to take a
> look, it's not really done but should provide you with a starting
> point. Saying that my students and I have knocked a lot of fun out of
> the above instrument.
>
>
> 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"

Date2010-12-03 17:21
FromAidan Collins
Subject[Csnd] Re: Re: Re: Step Sequencer problem
Another option would be using the reinit opcodes.
I don't have an example with me here that I can post (I could dig one
up later), but I've had some success using a table to store pitch
values and another to store the time value for the "timout" portion of
the reinit cycle.
Or if you want to use a constant step size, you could just store
amplitudes and pitches in the tables.
Either way, reinit could let you avoid needing all the if statements.




On Thu, Dec 2, 2010 at 3:42 PM, Victor Lazzarini
 wrote:
> Easiest, but not that elegant!
>
> If Ed changes his code to this:
>
> instr 1
> ktampold init 0
> ilength = 16
> ktamp table gk_clock * ilength, p4, 0, 0, 1
> if ktamp == 1 && ktamp != ktampold then
> event "i",2, 0, .5
> endif
> ktampold = ktamp
> endin
>
> He has a more general step sequencer without all those ifs and elses
>
> Victor
>
> On 2 Dec 2010, at 17:57, Rory Walsh wrote:
>
>> You're instrument is being triggered over and over again. The easiest
>> albeit limited way to create a step sequencer is like this:
>>
>> 
>> 
>> -odac
>> 
>> 
>> sr = 44100
>> nchnls = 2
>>
>> instr 100
>> kcnt phasor p4
>> kcnt = int(kcnt*16)
>> ktrig changed kcnt
>>
>> ;hihat
>> ;1      2       3       4       5       6       7       8       9       10
>>      11      12      13      14      15      16
>> ;X      -       X       -       X       -       X       -       X       -
>>       X       -       -       -       X       -
>> ;snare
>> ;-      -       -       -       X       -       -       -       -       -
>>       -       -       X       -       -       -
>> ;kick
>> ;X      -       -       X       -       -       X       -       -       -
>>       X       -       -       -       -       X
>>
>>
>> if(ktrig ==1 && (kcnt==1 || kcnt==4 || kcnt == 7 || kcnt ==11 ||
>> kcnt==15)) then
>>        event "i", 3, 0, .5, 20000, 100, 1              ;Kick
>> endif
>> if(ktrig ==1 && (kcnt==1 || kcnt==3 || kcnt == 5 || kcnt ==7 || kcnt
>> ==9 || kcnt ==11 || kcnt ==15)) then
>>        event "i", 1, 0, 1, 5000, 10000                         ;Hihat
>> endif
>> if(ktrig ==1 && (kcnt==5 || kcnt ==13)) then
>>        event "i", 2, 0, .5, 10000, 1000, 140, 1        ;Snare
>> endif
>>
>> endin
>>
>> ;---------------------------------------------
>> instr 1; hihat closed
>> k1 expon p4, p3*.1, 1000
>> a1 randi k1, 10000
>> a2 oscili a1, p5, 1
>> outs a2, a2
>> endin
>>
>> ;----------------------------------------------
>> instr 2;snare
>> aenv1  expon  p4, 0.3, .5
>> a1   oscili aenv1, p6, p7
>> aamp      expon     p5,  0.2,   10
>> arand     rand      aamp
>> outs a1+arand, a1+arand
>> endin
>> ;----------------------------------------------
>> instr 3; kick
>> k1  expon    p5, 0.2, 50
>> aenv expon p4, p3, 0.01
>> a1  poscil    aenv, k1, p6
>> outs a1, a1
>> endin
>>
>> 
>> 
>> f1 0 1024 10 1
>> i100 0 100 .5
>> 
>> 
>>
>> I have a more complex example that uses tables if you want to take a
>> look, it's not really done but should provide you with a starting
>> point. Saying that my students and I have knocked a lot of fun out of
>> the above instrument.
>>
>>
>> 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"
>
>


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"


Date2010-12-03 19:44
FromRory Walsh
Subject[Csnd] Re: Re: Re: Re: Step Sequencer problem
I'd like to see a version using reinit if you have it. Great.


On 3 December 2010 17:21, Aidan Collins  wrote:
> Another option would be using the reinit opcodes.
> I don't have an example with me here that I can post (I could dig one
> up later), but I've had some success using a table to store pitch
> values and another to store the time value for the "timout" portion of
> the reinit cycle.
> Or if you want to use a constant step size, you could just store
> amplitudes and pitches in the tables.
> Either way, reinit could let you avoid needing all the if statements.
>
>
>
>
> On Thu, Dec 2, 2010 at 3:42 PM, Victor Lazzarini
>  wrote:
>> Easiest, but not that elegant!
>>
>> If Ed changes his code to this:
>>
>> instr 1
>> ktampold init 0
>> ilength = 16
>> ktamp table gk_clock * ilength, p4, 0, 0, 1
>> if ktamp == 1 && ktamp != ktampold then
>> event "i",2, 0, .5
>> endif
>> ktampold = ktamp
>> endin
>>
>> He has a more general step sequencer without all those ifs and elses
>>
>> Victor
>>
>> On 2 Dec 2010, at 17:57, Rory Walsh wrote:
>>
>>> You're instrument is being triggered over and over again. The easiest
>>> albeit limited way to create a step sequencer is like this:
>>>
>>> 
>>> 
>>> -odac
>>> 
>>> 
>>> sr = 44100
>>> nchnls = 2
>>>
>>> instr 100
>>> kcnt phasor p4
>>> kcnt = int(kcnt*16)
>>> ktrig changed kcnt
>>>
>>> ;hihat
>>> ;1      2       3       4       5       6       7       8       9       10
>>>      11      12      13      14      15      16
>>> ;X      -       X       -       X       -       X       -       X       -
>>>       X       -       -       -       X       -
>>> ;snare
>>> ;-      -       -       -       X       -       -       -       -       -
>>>       -       -       X       -       -       -
>>> ;kick
>>> ;X      -       -       X       -       -       X       -       -       -
>>>       X       -       -       -       -       X
>>>
>>>
>>> if(ktrig ==1 && (kcnt==1 || kcnt==4 || kcnt == 7 || kcnt ==11 ||
>>> kcnt==15)) then
>>>        event "i", 3, 0, .5, 20000, 100, 1              ;Kick
>>> endif
>>> if(ktrig ==1 && (kcnt==1 || kcnt==3 || kcnt == 5 || kcnt ==7 || kcnt
>>> ==9 || kcnt ==11 || kcnt ==15)) then
>>>        event "i", 1, 0, 1, 5000, 10000                         ;Hihat
>>> endif
>>> if(ktrig ==1 && (kcnt==5 || kcnt ==13)) then
>>>        event "i", 2, 0, .5, 10000, 1000, 140, 1        ;Snare
>>> endif
>>>
>>> endin
>>>
>>> ;---------------------------------------------
>>> instr 1; hihat closed
>>> k1 expon p4, p3*.1, 1000
>>> a1 randi k1, 10000
>>> a2 oscili a1, p5, 1
>>> outs a2, a2
>>> endin
>>>
>>> ;----------------------------------------------
>>> instr 2;snare
>>> aenv1  expon  p4, 0.3, .5
>>> a1   oscili aenv1, p6, p7
>>> aamp      expon     p5,  0.2,   10
>>> arand     rand      aamp
>>> outs a1+arand, a1+arand
>>> endin
>>> ;----------------------------------------------
>>> instr 3; kick
>>> k1  expon    p5, 0.2, 50
>>> aenv expon p4, p3, 0.01
>>> a1  poscil    aenv, k1, p6
>>> outs a1, a1
>>> endin
>>>
>>> 
>>> 
>>> f1 0 1024 10 1
>>> i100 0 100 .5
>>> 
>>> 
>>>
>>> I have a more complex example that uses tables if you want to take a
>>> look, it's not really done but should provide you with a starting
>>> point. Saying that my students and I have knocked a lot of fun out of
>>> the above instrument.
>>>
>>>
>>> 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"
>>
>>
>
>
> 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"


Date2010-12-03 20:47
Fromjoachim heintz
Subject[Csnd] Re: Re: Re: Re: Re: Step Sequencer problem
one suggestion:


0dbfs = 1
nchnls = 2
instr 1
indx = 0
itim = .2 ;time for one step
clock: timout 0, itim, go
reinit clock
go:
itamp table indx, 100, 0, 0, 1
if itamp == 1 then
event_i "i",2, 0, .1
endif
indx = indx+1
endin
instr 2
a1 oscili .2, 400, 1
outs a1,a1
endin


f 1 0 1024 10 1
f100 0 16 2 1 0 0 1 0 0 1 0 0 1 0 1 0 1 0 1
i1 0 20



this does need one "if", but as far as i understood ed, he wants to  
trigger an instrument IF there is a 1 in the table, so i think this is  
needed?
	joachim


Am 03.12.2010 um 20:44 schrieb Rory Walsh:

> I'd like to see a version using reinit if you have it. Great.
>
>
> On 3 December 2010 17:21, Aidan Collins   
> wrote:
>> Another option would be using the reinit opcodes.
>> I don't have an example with me here that I can post (I could dig one
>> up later), but I've had some success using a table to store pitch
>> values and another to store the time value for the "timout" portion  
>> of
>> the reinit cycle.
>> Or if you want to use a constant step size, you could just store
>> amplitudes and pitches in the tables.
>> Either way, reinit could let you avoid needing all the if statements.
>>
>>
>>
>>
>> On Thu, Dec 2, 2010 at 3:42 PM, Victor Lazzarini
>>  wrote:
>>> Easiest, but not that elegant!
>>>
>>> If Ed changes his code to this:
>>>
>>> instr 1
>>> ktampold init 0
>>> ilength = 16
>>> ktamp table gk_clock * ilength, p4, 0, 0, 1
>>> if ktamp == 1 && ktamp != ktampold then
>>> event "i",2, 0, .5
>>> endif
>>> ktampold = ktamp
>>> endin
>>>
>>> He has a more general step sequencer without all those ifs and elses
>>>
>>> Victor
>>>
>>> On 2 Dec 2010, at 17:57, Rory Walsh wrote:
>>>
>>>> You're instrument is being triggered over and over again. The  
>>>> easiest
>>>> albeit limited way to create a step sequencer is like this:
>>>>
>>>> 
>>>> 
>>>> -odac
>>>> 
>>>> 
>>>> sr = 44100
>>>> nchnls = 2
>>>>
>>>> instr 100
>>>> kcnt phasor p4
>>>> kcnt = int(kcnt*16)
>>>> ktrig changed kcnt
>>>>
>>>> ;hihat
>>>> ;1      2       3       4       5       6       7       8        
>>>> 9       10
>>>>      11      12      13      14      15      16
>>>> ;X      -       X       -       X       -       X       -        
>>>> X       -
>>>>       X       -       -       -       X       -
>>>> ;snare
>>>> ;-      -       -       -       X       -       -       -        
>>>> -       -
>>>>       -       -       X       -       -       -
>>>> ;kick
>>>> ;X      -       -       X       -       -       X       -        
>>>> -       -
>>>>       X       -       -       -       -       X
>>>>
>>>>
>>>> if(ktrig ==1 && (kcnt==1 || kcnt==4 || kcnt == 7 || kcnt ==11 ||
>>>> kcnt==15)) then
>>>>        event "i", 3, 0, .5, 20000, 100, 1              ;Kick
>>>> endif
>>>> if(ktrig ==1 && (kcnt==1 || kcnt==3 || kcnt == 5 || kcnt ==7 ||  
>>>> kcnt
>>>> ==9 || kcnt ==11 || kcnt ==15)) then
>>>>        event "i", 1, 0, 1, 5000,  
>>>> 10000                         ;Hihat
>>>> endif
>>>> if(ktrig ==1 && (kcnt==5 || kcnt ==13)) then
>>>>        event "i", 2, 0, .5, 10000, 1000, 140, 1        ;Snare
>>>> endif
>>>>
>>>> endin
>>>>
>>>> ;---------------------------------------------
>>>> instr 1; hihat closed
>>>> k1 expon p4, p3*.1, 1000
>>>> a1 randi k1, 10000
>>>> a2 oscili a1, p5, 1
>>>> outs a2, a2
>>>> endin
>>>>
>>>> ;----------------------------------------------
>>>> instr 2;snare
>>>> aenv1  expon  p4, 0.3, .5
>>>> a1   oscili aenv1, p6, p7
>>>> aamp      expon     p5,  0.2,   10
>>>> arand     rand      aamp
>>>> outs a1+arand, a1+arand
>>>> endin
>>>> ;----------------------------------------------
>>>> instr 3; kick
>>>> k1  expon    p5, 0.2, 50
>>>> aenv expon p4, p3, 0.01
>>>> a1  poscil    aenv, k1, p6
>>>> outs a1, a1
>>>> endin
>>>>
>>>> 
>>>> 
>>>> f1 0 1024 10 1
>>>> i100 0 100 .5
>>>> 
>>>> 
>>>>
>>>> I have a more complex example that uses tables if you want to  
>>>> take a
>>>> look, it's not really done but should provide you with a starting
>>>> point. Saying that my students and I have knocked a lot of fun  
>>>> out of
>>>> the above instrument.
>>>>
>>>>
>>>> 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"
>>>
>>>
>>
>>
>> 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"
>
>



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"

Date2010-12-04 22:01
FromAidan Collins
Subject[Csnd] Re: Re: Re: Re: Re: Re: Step Sequencer problem
AttachmentsReinit_Sequencer.csd  
Here's that sequencer I made a while back using the timout and reinit opcodes.

I think there's a lot more that can be done with this method, now that
I'm looking at it again.
Right now it's using a phasor to read through the sequence tables at
the same speed, I had been using another table for a while that would
store values for the timing parameter of the reinit loop, but that was
a little difficult to keep in sync with the values for notes and
dynamics. I think if it would use a counter variable and increment it
in each reinit loop that would make it easier to keep place while
changing the durations of each note cycle.

Anyway, let me know what you think.

Aidan


On Fri, Dec 3, 2010 at 3:47 PM, joachim heintz  wrote:
> one suggestion:
> 
> 
> 0dbfs = 1
> nchnls = 2
> instr 1
> indx = 0
> itim = .2 ;time for one step
> clock: timout 0, itim, go
> reinit clock
> go:
> itamp table indx, 100, 0, 0, 1
> if itamp == 1 then
> event_i "i",2, 0, .1
> endif
> indx = indx+1
> endin
> instr 2
> a1 oscili .2, 400, 1
> outs a1,a1
> endin
> 
> 
> f 1 0 1024 10 1
> f100 0 16 2 1 0 0 1 0 0 1 0 0 1 0 1 0 1 0 1
> i1 0 20
> 
> 
>
> this does need one "if", but as far as i understood ed, he wants to trigger
> an instrument IF there is a 1 in the table, so i think this is needed?
>        joachim
>
>
> Am 03.12.2010 um 20:44 schrieb Rory Walsh:
>
>> I'd like to see a version using reinit if you have it. Great.
>>
>>
>> On 3 December 2010 17:21, Aidan Collins 
>> wrote:
>>>
>>> Another option would be using the reinit opcodes.
>>> I don't have an example with me here that I can post (I could dig one
>>> up later), but I've had some success using a table to store pitch
>>> values and another to store the time value for the "timout" portion of
>>> the reinit cycle.
>>> Or if you want to use a constant step size, you could just store
>>> amplitudes and pitches in the tables.
>>> Either way, reinit could let you avoid needing all the if statements.
>>>
>>>
>>>
>>>
>>> On Thu, Dec 2, 2010 at 3:42 PM, Victor Lazzarini
>>>  wrote:
>>>>
>>>> Easiest, but not that elegant!
>>>>
>>>> If Ed changes his code to this:
>>>>
>>>> instr 1
>>>> ktampold init 0
>>>> ilength = 16
>>>> ktamp table gk_clock * ilength, p4, 0, 0, 1
>>>> if ktamp == 1 && ktamp != ktampold then
>>>> event "i",2, 0, .5
>>>> endif
>>>> ktampold = ktamp
>>>> endin
>>>>
>>>> He has a more general step sequencer without all those ifs and elses
>>>>
>>>> Victor
>>>>
>>>> On 2 Dec 2010, at 17:57, Rory Walsh wrote:
>>>>
>>>>> You're instrument is being triggered over and over again. The easiest
>>>>> albeit limited way to create a step sequencer is like this:
>>>>>
>>>>> 
>>>>> 
>>>>> -odac
>>>>> 
>>>>> 
>>>>> sr = 44100
>>>>> nchnls = 2
>>>>>
>>>>> instr 100
>>>>> kcnt phasor p4
>>>>> kcnt = int(kcnt*16)
>>>>> ktrig changed kcnt
>>>>>
>>>>> ;hihat
>>>>> ;1      2       3       4       5       6       7       8       9
>>>>> 10
>>>>>     11      12      13      14      15      16
>>>>> ;X      -       X       -       X       -       X       -       X
>>>>> -
>>>>>      X       -       -       -       X       -
>>>>> ;snare
>>>>> ;-      -       -       -       X       -       -       -       -
>>>>> -
>>>>>      -       -       X       -       -       -
>>>>> ;kick
>>>>> ;X      -       -       X       -       -       X       -       -
>>>>> -
>>>>>      X       -       -       -       -       X
>>>>>
>>>>>
>>>>> if(ktrig ==1 && (kcnt==1 || kcnt==4 || kcnt == 7 || kcnt ==11 ||
>>>>> kcnt==15)) then
>>>>>       event "i", 3, 0, .5, 20000, 100, 1              ;Kick
>>>>> endif
>>>>> if(ktrig ==1 && (kcnt==1 || kcnt==3 || kcnt == 5 || kcnt ==7 || kcnt
>>>>> ==9 || kcnt ==11 || kcnt ==15)) then
>>>>>       event "i", 1, 0, 1, 5000, 10000                         ;Hihat
>>>>> endif
>>>>> if(ktrig ==1 && (kcnt==5 || kcnt ==13)) then
>>>>>       event "i", 2, 0, .5, 10000, 1000, 140, 1        ;Snare
>>>>> endif
>>>>>
>>>>> endin
>>>>>
>>>>> ;---------------------------------------------
>>>>> instr 1; hihat closed
>>>>> k1 expon p4, p3*.1, 1000
>>>>> a1 randi k1, 10000
>>>>> a2 oscili a1, p5, 1
>>>>> outs a2, a2
>>>>> endin
>>>>>
>>>>> ;----------------------------------------------
>>>>> instr 2;snare
>>>>> aenv1  expon  p4, 0.3, .5
>>>>> a1   oscili aenv1, p6, p7
>>>>> aamp      expon     p5,  0.2,   10
>>>>> arand     rand      aamp
>>>>> outs a1+arand, a1+arand
>>>>> endin
>>>>> ;----------------------------------------------
>>>>> instr 3; kick
>>>>> k1  expon    p5, 0.2, 50
>>>>> aenv expon p4, p3, 0.01
>>>>> a1  poscil    aenv, k1, p6
>>>>> outs a1, a1
>>>>> endin
>>>>>
>>>>> 
>>>>> 
>>>>> f1 0 1024 10 1
>>>>> i100 0 100 .5
>>>>> 
>>>>> 
>>>>>
>>>>> I have a more complex example that uses tables if you want to take a
>>>>> look, it's not really done but should provide you with a starting
>>>>> point. Saying that my students and I have knocked a lot of fun out of
>>>>> the above instrument.
>>>>>
>>>>>
>>>>> 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"
>>>>
>>>>
>>>
>>>
>>> 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"
>>
>>
>
>
>
> 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"


Date2010-12-05 11:59
Fromjoachim heintz
Subject[Csnd] Re: Re: Re: Re: Re: Re: Re: Step Sequencer problem
yes i think a phasor is not needed, and everything could be done with  
increments. if you use tab_i instead of table, you can use tables of  
any length. this, for instance, repeats a sequence of 13 notes in a  
sequence of 11 durations:



0dbfs = 1
gitim ftgen 0, 0, -11, -2, 1, .5, .33, .33, .25, 1.33, .25, 2, .67, . 
33, .67 ;steps in seconds
ginot ftgen 0, 0, -13, -2, 0, 1, 4, 5, 4, 1, 0, 7, 8, 7, 7, 5,  
6 ;notes (cromatic steps)
instr 1
indxtim = 0
indxnot = 0
clock:
itim tab_i indxtim, gitim ;time for next step
inot tab_i indxnot, ginot ;note number from table
ipch = 7 + (inot*.01) ;2 becomes 8.02 as pitch
timout 0, itim, go
reinit clock
go:
event_i "i", 2, 0, 2*itim, ipch
;check if this is the last table value. if yes, next index is 0,  
otherwise this index plus one
indxtim = (indxtim == ftlen(gitim)-1 ? 0 : indxtim+1)
indxnot = (indxnot == ftlen(ginot)-1 ? 0 : indxnot+1)
endin
instr 2
anot pluck .2, cpspch(p4), cpspch(p4), 0, 1
aout linen anot, 0, p3, p3
out aout
endin


i1 0 200



	joachim


Am 04.12.2010 um 23:01 schrieb Aidan Collins:

> Here's that sequencer I made a while back using the timout and  
> reinit opcodes.
>
> I think there's a lot more that can be done with this method, now that
> I'm looking at it again.
> Right now it's using a phasor to read through the sequence tables at
> the same speed, I had been using another table for a while that would
> store values for the timing parameter of the reinit loop, but that was
> a little difficult to keep in sync with the values for notes and
> dynamics. I think if it would use a counter variable and increment it
> in each reinit loop that would make it easier to keep place while
> changing the durations of each note cycle.
>
> Anyway, let me know what you think.
>
> Aidan
>
>
> On Fri, Dec 3, 2010 at 3:47 PM, joachim heintz   
> wrote:
>> one suggestion:
>> 
>> 
>> 0dbfs = 1
>> nchnls = 2
>> instr 1
>> indx = 0
>> itim = .2 ;time for one step
>> clock: timout 0, itim, go
>> reinit clock
>> go:
>> itamp table indx, 100, 0, 0, 1
>> if itamp == 1 then
>> event_i "i",2, 0, .1
>> endif
>> indx = indx+1
>> endin
>> instr 2
>> a1 oscili .2, 400, 1
>> outs a1,a1
>> endin
>> 
>> 
>> f 1 0 1024 10 1
>> f100 0 16 2 1 0 0 1 0 0 1 0 0 1 0 1 0 1 0 1
>> i1 0 20
>> 
>> 
>>
>> this does need one "if", but as far as i understood ed, he wants to  
>> trigger
>> an instrument IF there is a 1 in the table, so i think this is  
>> needed?
>>        joachim
>>
>>
>> Am 03.12.2010 um 20:44 schrieb Rory Walsh:
>>
>>> I'd like to see a version using reinit if you have it. Great.
>>>
>>>
>>> On 3 December 2010 17:21, Aidan Collins 
>>> wrote:
>>>>
>>>> Another option would be using the reinit opcodes.
>>>> I don't have an example with me here that I can post (I could dig  
>>>> one
>>>> up later), but I've had some success using a table to store pitch
>>>> values and another to store the time value for the "timout"  
>>>> portion of
>>>> the reinit cycle.
>>>> Or if you want to use a constant step size, you could just store
>>>> amplitudes and pitches in the tables.
>>>> Either way, reinit could let you avoid needing all the if  
>>>> statements.
>>>>
>>>>
>>>>
>>>>
>>>> On Thu, Dec 2, 2010 at 3:42 PM, Victor Lazzarini
>>>>  wrote:
>>>>>
>>>>> Easiest, but not that elegant!
>>>>>
>>>>> If Ed changes his code to this:
>>>>>
>>>>> instr 1
>>>>> ktampold init 0
>>>>> ilength = 16
>>>>> ktamp table gk_clock * ilength, p4, 0, 0, 1
>>>>> if ktamp == 1 && ktamp != ktampold then
>>>>> event "i",2, 0, .5
>>>>> endif
>>>>> ktampold = ktamp
>>>>> endin
>>>>>
>>>>> He has a more general step sequencer without all those ifs and  
>>>>> elses
>>>>>
>>>>> Victor
>>>>>
>>>>> On 2 Dec 2010, at 17:57, Rory Walsh wrote:
>>>>>
>>>>>> You're instrument is being triggered over and over again. The  
>>>>>> easiest
>>>>>> albeit limited way to create a step sequencer is like this:
>>>>>>
>>>>>> 
>>>>>> 
>>>>>> -odac
>>>>>> 
>>>>>> 
>>>>>> sr = 44100
>>>>>> nchnls = 2
>>>>>>
>>>>>> instr 100
>>>>>> kcnt phasor p4
>>>>>> kcnt = int(kcnt*16)
>>>>>> ktrig changed kcnt
>>>>>>
>>>>>> ;hihat
>>>>>> ;1      2       3       4       5       6       7       8       9
>>>>>> 10
>>>>>>     11      12      13      14      15      16
>>>>>> ;X      -       X       -       X       -       X       -       X
>>>>>> -
>>>>>>      X       -       -       -       X       -
>>>>>> ;snare
>>>>>> ;-      -       -       -       X       -       -       -       -
>>>>>> -
>>>>>>      -       -       X       -       -       -
>>>>>> ;kick
>>>>>> ;X      -       -       X       -       -       X       -       -
>>>>>> -
>>>>>>      X       -       -       -       -       X
>>>>>>
>>>>>>
>>>>>> if(ktrig ==1 && (kcnt==1 || kcnt==4 || kcnt == 7 || kcnt ==11 ||
>>>>>> kcnt==15)) then
>>>>>>       event "i", 3, 0, .5, 20000, 100, 1              ;Kick
>>>>>> endif
>>>>>> if(ktrig ==1 && (kcnt==1 || kcnt==3 || kcnt == 5 || kcnt ==7 ||  
>>>>>> kcnt
>>>>>> ==9 || kcnt ==11 || kcnt ==15)) then
>>>>>>       event "i", 1, 0, 1, 5000,  
>>>>>> 10000                         ;Hihat
>>>>>> endif
>>>>>> if(ktrig ==1 && (kcnt==5 || kcnt ==13)) then
>>>>>>       event "i", 2, 0, .5, 10000, 1000, 140, 1        ;Snare
>>>>>> endif
>>>>>>
>>>>>> endin
>>>>>>
>>>>>> ;---------------------------------------------
>>>>>> instr 1; hihat closed
>>>>>> k1 expon p4, p3*.1, 1000
>>>>>> a1 randi k1, 10000
>>>>>> a2 oscili a1, p5, 1
>>>>>> outs a2, a2
>>>>>> endin
>>>>>>
>>>>>> ;----------------------------------------------
>>>>>> instr 2;snare
>>>>>> aenv1  expon  p4, 0.3, .5
>>>>>> a1   oscili aenv1, p6, p7
>>>>>> aamp      expon     p5,  0.2,   10
>>>>>> arand     rand      aamp
>>>>>> outs a1+arand, a1+arand
>>>>>> endin
>>>>>> ;----------------------------------------------
>>>>>> instr 3; kick
>>>>>> k1  expon    p5, 0.2, 50
>>>>>> aenv expon p4, p3, 0.01
>>>>>> a1  poscil    aenv, k1, p6
>>>>>> outs a1, a1
>>>>>> endin
>>>>>>
>>>>>> 
>>>>>> 
>>>>>> f1 0 1024 10 1
>>>>>> i100 0 100 .5
>>>>>> 
>>>>>> 
>>>>>>
>>>>>> I have a more complex example that uses tables if you want to  
>>>>>> take a
>>>>>> look, it's not really done but should provide you with a starting
>>>>>> point. Saying that my students and I have knocked a lot of fun  
>>>>>> out of
>>>>>> the above instrument.
>>>>>>
>>>>>>
>>>>>> 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"
>>>>>
>>>>>
>>>>
>>>>
>>>> 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"
>>>
>>>
>>
>>
>>
>> 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"
>
> 



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"