Csound Csound-dev Csound-tekno Search About

Help: Repeating i-statements within a section

Date2006-02-03 17:31
FromAlfonso Alba
SubjectHelp: Repeating i-statements within a section
Hi all. I'm a csound newbie (got it two days ago) but
I have plenty 
of programming experience (both computers and synths).

Is there any way to repeat a group of i-statements
within a section? 
I know there's the r-statement but that doesn't work
for what I want 
to do. 

Let me give you an example. Suppose there is a
"L-statement" (for 
looping) that works just like the r-statement but
within a section. 
Thus something like this:

;
------------------------------------------------------------
i1 0 0.5  ; this is a kick drum playing on beats 1 and
3
i1 2 0.5

L8 HOffset   ; loop statement: repeat 8 times with
counter HOffset
i2 [($HOffset. - 1) * 0.5] 0.25  ; closed hi-hat every
eight note
L0           ; this may be used to close the loop

i3 1 0.5  ; this is a snare playing on beats 2 and 4
i3 3 0.5
s         ; end of section
;
-------------------------------------------------------------


would be translated into this:

;
------------------------------------------------------------
i1 0 0.5
i1 2 0.5

i2 0.0 0.25
i2 0.5 0.25
i2 1.0 0.25
i2 1.5 0.25
i2 2.0 0.25
i2 2.5 0.25
i2 3.0 0.25
i2 3.5 0.25

i3 1 0.5  
i3 3 0.5
s         
;
-------------------------------------------------------------


Is there any way to do something like that? I have
checked and 
rechecked the manual but can't find anything similar.
The r-statement 
wouldn't work because it resets the timer.

Macros could be used but they are not really the
solution. The 
section in the previous example is only 1-bar long,
but what if I 
want a 16-bar section with hi-hats every 16th note? Do
I have to type 
(or copy&paste) 256 statements ?

This is probably very easy to accomplish with a
program as advanced 
as CSound, I just can't find it on the
manuals/tutorials.

Thanks in advance.



	
	
		
___________________________________________________________ 
Do You Yahoo!? 
La mejor conexión a Internet y 2GB extra a tu correo por $100 al mes. http://net.yahoo.com.mx 

Date2006-02-03 18:23
FromSteven Yi
SubjectRe: Help: Repeating i-statements within a section
AttachmentsNone  

Date2006-02-03 22:15
FromAidan Collins
SubjectRe: Help: Repeating i-statements within a section
AttachmentsNone  

Date2006-02-04 00:49
FromAlfonso Alba
SubjectRe: Help: Repeating i-statements within a section
Thanks, Steven. I'll give it a try.

I saw those utilities (blue, cecilia, etc.) but I
thought I would first get the hang of the standard
CSound before I tried the "extras".

 --- Steven Yi  escribió:

> Hi Alfonso,
> 
> I'm not sure of a pure Csound way to do it, but you
> might want to try
> out my program blue which works with Csound.  To
> accomplish a repeated
> section, you could create a GenericScore on the
> timeline in blue using
> the score text that you'd want to repeat, then
> simply set the time
> property to "repeat" and drag the end of the box to
> repeat the Csound
> score as much as you'd like.  You could also use the
> pattern editor to
> write your csound score and also use the repeat time
> option.  You
> could then add other score objects in different
> layers and coordinate
> the properties in time.  With blue, you still get
> all the advantages
> of writing Csound score, but you also get a lot of
> options for
> organizing and visualing your score information as
> well as
> manipulating it via a GUI.
> 
> steven
> 
> 
> 
> 
> On 2/3/06, Alfonso Alba 
> wrote:
> > Hi all. I'm a csound newbie (got it two days ago)
> but
> > I have plenty
> > of programming experience (both computers and
> synths).
> >
> > Is there any way to repeat a group of i-statements
> > within a section?
> > I know there's the r-statement but that doesn't
> work
> > for what I want
> > to do.
> >
> > Let me give you an example. Suppose there is a
> > "L-statement" (for
> > looping) that works just like the r-statement but
> > within a section.
> > Thus something like this:
> >
> > ;
> >
>
------------------------------------------------------------
> > i1 0 0.5  ; this is a kick drum playing on beats 1
> and
> > 3
> > i1 2 0.5
> >
> > L8 HOffset   ; loop statement: repeat 8 times with
> > counter HOffset
> > i2 [($HOffset. - 1) * 0.5] 0.25  ; closed hi-hat
> every
> > eight note
> > L0           ; this may be used to close the loop
> >
> > i3 1 0.5  ; this is a snare playing on beats 2 and
> 4
> > i3 3 0.5
> > s         ; end of section
> > ;
> >
>
-------------------------------------------------------------
> >
> >
> > would be translated into this:
> >
> > ;
> >
>
------------------------------------------------------------
> > i1 0 0.5
> > i1 2 0.5
> >
> > i2 0.0 0.25
> > i2 0.5 0.25
> > i2 1.0 0.25
> > i2 1.5 0.25
> > i2 2.0 0.25
> > i2 2.5 0.25
> > i2 3.0 0.25
> > i2 3.5 0.25
> >
> > i3 1 0.5
> > i3 3 0.5
> > s
> > ;
> >
>
-------------------------------------------------------------
> >
> >
> > Is there any way to do something like that? I have
> > checked and
> > rechecked the manual but can't find anything
> similar.
> > The r-statement
> > wouldn't work because it resets the timer.
> >
> > Macros could be used but they are not really the
> > solution. The
> > section in the previous example is only 1-bar
> long,
> > but what if I
> > want a 16-bar section with hi-hats every 16th
> note? Do
> > I have to type
> > (or copy&paste) 256 statements ?
> >
> > This is probably very easy to accomplish with a
> > program as advanced
> > as CSound, I just can't find it on the
> > manuals/tutorials.
> >
> > Thanks in advance.
> >
> >
> >
> >
> >
> >
> >
>
___________________________________________________________
> > Do You Yahoo!?
> > La mejor conexión a Internet y 2GB extra a
> tu correo por $100 al mes. http://net.yahoo.com.mx
> >
> > --
> > Send bugs reports to this list.
> > To unsubscribe, send email to
> csound-unsubscribe@lists.bath.ac.uk
> >
> --
> Send bugs reports to this list.
> To unsubscribe, send email to
> csound-unsubscribe@lists.bath.ac.uk
> 



	
	
		
___________________________________________________________ 
Do You Yahoo!? 
La mejor conexión a Internet y 2GB extra a tu correo por $100 al mes. http://net.yahoo.com.mx 

Date2006-02-04 00:53
FromAlfonso Alba
SubjectRe: Help: Repeating i-statements within a section
Thanks, Aidan. I saw the reinit opcode in the manual
but I thought the solution would be at score-level.

I'll try your approach and see what comes out.

Thanks again.

 --- Aidan Collins 
escribió:

> you could use the reinit opcode to create a patch
> that plays the beats
> by itself.
> where it has an initial setup, but then
> re-intializes a certain
> portion of the instrument at a set gap time.
> The manual has some good examples of it, and there
> are some good
> instruments in the Csound Book as well.
> for example, you could have 1 16 measure note that
> has beat
> subdivisions within itself.
> i have made a few instruments using that opcode to
> create looping
> pattern instruments. You could set the gap time to
> be a regular
> interval, say  an 1/8 note, and then use a table to
> look up the
> amplitude value, something like 1 0 0 0 1 0 0 0 for
> a note on the 1's
> and three's.
> 
> However i do remember some dialog on the list about
> these types of
> instruments floating out of rhythm over time. Anyone
> want to comment
> on that? but it shouldn't be a problem if the
> 'notes' are kept
> reasonably short.
> 
> On 2/3/06, Steven Yi  wrote:
> > Hi Alfonso,
> >
> > I'm not sure of a pure Csound way to do it, but
> you might want to try
> > out my program blue which works with Csound.  To
> accomplish a repeated
> > section, you could create a GenericScore on the
> timeline in blue using
> > the score text that you'd want to repeat, then
> simply set the time
> > property to "repeat" and drag the end of the box
> to repeat the Csound
> > score as much as you'd like.  You could also use
> the pattern editor to
> > write your csound score and also use the repeat
> time option.  You
> > could then add other score objects in different
> layers and coordinate
> > the properties in time.  With blue, you still get
> all the advantages
> > of writing Csound score, but you also get a lot of
> options for
> > organizing and visualing your score information as
> well as
> > manipulating it via a GUI.
> >
> > steven
> >
> >
> >
> >
> > On 2/3/06, Alfonso Alba 
> wrote:
> > > Hi all. I'm a csound newbie (got it two days
> ago) but
> > > I have plenty
> > > of programming experience (both computers and
> synths).
> > >
> > > Is there any way to repeat a group of
> i-statements
> > > within a section?
> > > I know there's the r-statement but that doesn't
> work
> > > for what I want
> > > to do.
> > >
> > > Let me give you an example. Suppose there is a
> > > "L-statement" (for
> > > looping) that works just like the r-statement
> but
> > > within a section.
> > > Thus something like this:
> > >
> > > ;
> > >
>
------------------------------------------------------------
> > > i1 0 0.5  ; this is a kick drum playing on beats
> 1 and
> > > 3
> > > i1 2 0.5
> > >
> > > L8 HOffset   ; loop statement: repeat 8 times
> with
> > > counter HOffset
> > > i2 [($HOffset. - 1) * 0.5] 0.25  ; closed hi-hat
> every
> > > eight note
> > > L0           ; this may be used to close the
> loop
> > >
> > > i3 1 0.5  ; this is a snare playing on beats 2
> and 4
> > > i3 3 0.5
> > > s         ; end of section
> > > ;
> > >
>
-------------------------------------------------------------
> > >
> > >
> > > would be translated into this:
> > >
> > > ;
> > >
>
------------------------------------------------------------
> > > i1 0 0.5
> > > i1 2 0.5
> > >
> > > i2 0.0 0.25
> > > i2 0.5 0.25
> > > i2 1.0 0.25
> > > i2 1.5 0.25
> > > i2 2.0 0.25
> > > i2 2.5 0.25
> > > i2 3.0 0.25
> > > i2 3.5 0.25
> > >
> > > i3 1 0.5
> > > i3 3 0.5
> > > s
> > > ;
> > >
>
-------------------------------------------------------------
> > >
> > >
> > > Is there any way to do something like that? I
> have
> > > checked and
> > > rechecked the manual but can't find anything
> similar.
> > > The r-statement
> > > wouldn't work because it resets the timer.
> > >
> > > Macros could be used but they are not really the
> > > solution. The
> > > section in the previous example is only 1-bar
> long,
> > > but what if I
> > > want a 16-bar section with hi-hats every 16th
> note? Do
> > > I have to type
> > > (or copy&paste) 256 statements ?
> > >
> > > This is probably very easy to accomplish with a
> > > program as advanced
> > > as CSound, I just can't find it on the
> > > manuals/tutorials.
> > >
> > > Thanks in advance.
> > >
> > >
> > >
> > >
> > >
> > >
> > >
>
___________________________________________________________
> > > Do You Yahoo!?
> > > La mejor conexión a Internet y 2GB extra
> a tu correo por $100 al mes. http://net.yahoo.com.mx
> > >
> > > --
> > > Send bugs reports to this list.
> > > To unsubscribe, send email to
> csound-unsubscribe@lists.bath.ac.uk
> > >
> > --
> > Send bugs reports to this list.
> > To unsubscribe, send email to
> csound-unsubscribe@lists.bath.ac.uk
> >
> --
> Send bugs reports to this list.
> To unsubscribe, send email to
> csound-unsubscribe@lists.bath.ac.uk
> 



	
	
		
___________________________________________________________ 
Do You Yahoo!? 
La mejor conexión a Internet y 2GB extra a tu correo por $100 al mes. http://net.yahoo.com.mx