Csound Csound-dev Csound-tekno Search About

[Csnd] instrument on a loop

Date2011-12-24 11:57
FromAlex Weiss
Subject[Csnd] instrument on a loop
Hi list,

What's the easiest way to have an instrument on a loop, i.e. to have
it retrigger itself right before it finishes? I thought I could maybe
have a master instrument that checks if the other instrument is still
active (using 'active') and if not creates another event. But I was
wondering if there was a way to do this without an extra master
instrument.

Thanks and merry christmas!

Alex


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"

Date2011-12-24 12:21
FromGiorgio Zucco
Subject[Csnd] Re: instrument on a loop
Hi,have tried with reinit ad timout?





;simple grain.csd
sr = 44100
kr = 4410
ksmps = 10
nchnls = 2
0dbfs = 1

instr	1

igrainrate	=	p4	

play:
timout	0,igrainrate,continua  
reinit	play
continua:

kamp	=	rnd(.6)
k1	=	rnd(1000)	
a1	poscil	kamp,60+k1,1	;sine freq random

igrainsize	=	p5
aenv	linseg	0,0.02,1,igrainsize-0.04,1,0.02,0,0.01,0 

;random pan
kpan	=	rnd(1)
al,ar	pan2	a1,kpan,2

outs	al*aenv,ar*aenv
endin





;p4 = rate
;p5 = grain size

f1	0	16384	10	1 

i1	0	4	.8	.1
s
i1	0	4	.1	.01
s
i1	0	4	.09	.08
s



--
View this message in context: http://csound.1045644.n5.nabble.com/instrument-on-a-loop-tp5099137p5099163.html
Sent from the Csound - General mailing list archive at Nabble.com.


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"

Date2012-01-11 20:24
Fromjoachim heintz
SubjectRe: [Csnd] instrument on a loop
AttachmentsAgainAndAgain.csd  
you can use the 'release' opcode to ask for the last k-cycle of an
instrument, and then trigger "itself" (= a new instance) in this k-cycle:



giCount  =          0
instr again
iDur     random     1, 3
p3       =          iDur
giCount  =          giCount+1
kTime    times
         prints     "instance = %d, start = %f, duration = %f\n",
giCount, i(kTime), iDur
kLast    release ;returns 1 in the last k-cycle of this instance
 if kLast == 1 then
         event      "i", "again", 0, 1
 endif
endin


i "again" 0 1
e 3600



	joachim

Am 24.12.2011 12:57, schrieb Alex Weiss:
> Hi list,
> 
> What's the easiest way to have an instrument on a loop, i.e. to have
> it retrigger itself right before it finishes? I thought I could maybe
> have a master instrument that checks if the other instrument is still
> active (using 'active') and if not creates another event. But I was
> wondering if there was a way to do this without an extra master
> instrument.
> 
> Thanks and merry christmas!
> 
> Alex
> 
> 
> 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"


Date2012-01-12 04:19
FromAlex Weiss
SubjectRe: [Csnd] instrument on a loop
Wow, how did I miss that? That's exactly what I was looking for! Thanks, Joachim!

On Wed, Jan 11, 2012 at 12:24 PM, joachim heintz <jh@joachimheintz.de> wrote:
you can use the 'release' opcode to ask for the last k-cycle of an
instrument, and then trigger "itself" (= a new instance) in this k-cycle:

<CsoundSynthesizer>
<CsInstruments>
giCount  =          0
instr again
iDur     random     1, 3
p3       =          iDur
giCount  =          giCount+1
kTime    times
        prints     "instance = %d, start = %f, duration = %f\n",
giCount, i(kTime), iDur
kLast    release ;returns 1 in the last k-cycle of this instance
 if kLast == 1 then
        event      "i", "again", 0, 1
 endif
endin
</CsInstruments>
<CsScore>
i "again" 0 1
e 3600
</CsScore>
</CsoundSynthesizer>

       joachim

Am 24.12.2011 12:57, schrieb Alex Weiss:
> Hi list,
>
> What's the easiest way to have an instrument on a loop, i.e. to have
> it retrigger itself right before it finishes? I thought I could maybe
> have a master instrument that checks if the other instrument is still
> active (using 'active') and if not creates another event. But I was
> wondering if there was a way to do this without an extra master
> instrument.
>
> Thanks and merry christmas!
>
> Alex
>
>
> 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"



Date2012-01-12 07:52
Frommenno
Subject[Csnd] Re: instrument on a loop
lovely instrument Joachim, and funny.
Can i put this example in the manaul as an example for "times"?

greetings
Menno

--
View this message in context: http://csound.1045644.n5.nabble.com/instrument-on-a-loop-tp5099137p5139271.html
Sent from the Csound - General mailing list archive at Nabble.com.


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"

Date2012-01-12 16:35
FromRory Walsh
SubjectRe: [Csnd] Re: instrument on a loop
AttachmentsAgainAndAgain.csd  
I added some sounds. It's very simple. One can turn off the effects
processor by commenting the i-statement in the score.

Rory.


On 12 January 2012 07:52, menno  wrote:
> lovely instrument Joachim, and funny.
> Can i put this example in the manaul as an example for "times"?
>
> greetings
> Menno
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/instrument-on-a-loop-tp5099137p5139271.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> 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"


Date2012-01-12 17:05
FromRory Walsh
SubjectRe: [Csnd] Re: instrument on a loop
AttachmentsAgainAndAgain.csd  
Having the octaves change over time is a little more interesting.

Rory.


On 12 January 2012 16:35, Rory Walsh  wrote:
> I added some sounds. It's very simple. One can turn off the effects
> processor by commenting the i-statement in the score.
>
> Rory.
>
>
> On 12 January 2012 07:52, menno  wrote:
>> lovely instrument Joachim, and funny.
>> Can i put this example in the manaul as an example for "times"?
>>
>> greetings
>> Menno
>>
>> --
>> View this message in context: http://csound.1045644.n5.nabble.com/instrument-on-a-loop-tp5099137p5139271.html
>> Sent from the Csound - General mailing list archive at Nabble.com.
>>
>>
>> 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"


Date2012-01-12 21:07
Fromjoachim heintz
SubjectRe: [Csnd] Re: instrument on a loop
AttachmentsAgainAndAgain_again.csd  
hi menno -
thanks for your words. and thanks to rory for the sonification. i made
some slight changes, and now hoping you both like it, i'd be very happy
to see it in the manual!
cheers -
	joachim



-odac -m128


;by joachim heintz and rory walsh
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1

giWave   ftgen      0, 0, 1024, 10, 1, .5, .25

  instr again
instance =          p4
 ;reset the duration of this instance
iDur     rnd31      5, 3 ;shorter values are more probable
iDur     =          abs(iDur) + 0.2
p3       =          iDur
 ;trigger the effect instrument of this instance
         event_i    "i", "fx_processor", 0, iDur, instance
 ;print the status quo
kTime    times
         prints     "instance = %d, start = %f, duration = %f\n",
instance, i(kTime), iDur
 ;make sound
iamp     active     1 ;scale amplitudes
iOct     random     5, 10 ;find pitch
aEnv     transeg    0, 0.02, 0, 1/iamp, p3-0.02, -6, 0 ;output envelope
aSend    poscil     aEnv, cpsoct(iOct), giWave ; audio signal
 ;send signal to effect instrument
Sbus     sprintf    "audio_%d", instance ;create unique software bus
         chnset     aSend/2, Sbus ;send audio on this bus
 ;get the last k-cycle of this instance and trigger the successor in it
kLast    release
         schedkwhen kLast, 0, 0, "again", 0, 1, instance+1
  endin

  instr fx_processor	
  ;apply feedback delay to the above instrument
iwhich    =         p4 ;receive instance number ...
Sbus      sprintf   "audio_%d", iwhich ; ... and related software bus
audio     chnget    Sbus ;receive audio on this bus
irvbtim   random    1, 5 ;find reverb time
p3        =         p3+irvbtim ;adjust instrument duration
iltptmL   random    .1, .5 ;find looptime left ...
iltptmR   random    .1, .5 ;...and right
ipan      random    0, 1 ; pan and ...
imix      random    0, 1 ;... mix audio
aL,aR     pan2      audio, ipan ;create stereo
awetL     comb      aL, irvbtim, iltptmL ;comb filter
awetR     comb      aR, irvbtim, iltptmR
aoutL     ntrpol    aL, awetL, imix ;wet-dry mix
aoutR     ntrpol    aR, awetR, imix
          outs      aoutL/2, aoutR/2
  endin



i "again" 0 1 1
e 3600







Am 12.01.2012 08:52, schrieb menno:
> lovely instrument Joachim, and funny.
> Can i put this example in the manaul as an example for "times"?
> 
> greetings
> Menno
> 
> --
> View this message in context: http://csound.1045644.n5.nabble.com/instrument-on-a-loop-tp5099137p5139271.html
> Sent from the Csound - General mailing list archive at Nabble.com.
> 
> 
> 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"


Date2012-01-14 12:58
Frommenno
Subject[Csnd] Re: instrument on a loop
i like the instrument - it does not meet exactly the requirements i set for
an example for the manual (it's not that simple - release, event, fspline,
abs etc) but it's good AND fun!

we thank you for your cooperation.

greetings
Menno

--
View this message in context: http://csound.1045644.n5.nabble.com/instrument-on-a-loop-tp5099137p5144931.html
Sent from the Csound - General mailing list archive at Nabble.com.


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"