Csound Csound-dev Csound-tekno Search About

[Csnd] RT Midi Arpeggiator

Date2011-07-02 18:31
FromRene Jopi
Subject[Csnd] RT Midi Arpeggiator
Hi list,

I would like to have some help to avoid to go to wrong choices.
First, before re inventing the wheel, does anyone already made a real time midi analogue style arpeggiator with Csound?
I have not found any with Csound, found some made with MaxMSP and PD, but I prefer Csound !

I would like to make an emulation of the arpeggiator (ARP) of the Sequential Circuit 6 Trak synthesizer. 
It works as follow:

If one key is down, the ARP is not triggered. The note is played as normal to the audio synth.

If more than one key are down, the ARP plays the notes in sequence with adjustable speed.
There is two "reading" modes:

* UP/DOWN mode: Plays the pressed keys from lowest to highest note and highest to lowest note.
* ASSIGN mode: Plays the pressed keys at the order they have been pressed. 


What I plan to do is:

* Use midiin opcode
* Store midi on note to an ARP table
* Remove note from ARP table when a midi note off is received
* Rearrange the ARP table
* Read the ARP table and send notes to the audio engine

To rearrange the ARP table I will have to make some functions like:
* Find an element in a table
* Find the minimum value in a table
* shift to Left the elements of a table
* Reorder in ascending order (for UP/DOWN mode) a table

If I am not wrong there is no opcode for above functions.

My doubts are:

midiin opcode is krate, if I make these rearrange functions in UDO, I will need many krate loop to get the result, so I am afraid to face some synchronizing problems.

Using Python opcodes is possible? If within Csound, I call a Python script including a loop, at what speed this loop is performed? At the Python speed or Csound krate?
How to pass a Csound table to the Python opcode and to receive the rearranged table in return?

Voila, thanks in advance for any replies, thanks anyway for reading my poor English :)

Cheers,
René


Date2011-07-03 11:17
Fromjoachim heintz
SubjectRe: [Csnd] RT Midi Arpeggiator
AttachmentsTabSort_i.csd  
hi rené -

what you want to do should be easy to do in csound. here are some
comments to your questions:

1)
> To rearrange the ARP table I will have to make some functions like:
> * Find an element in a table
> * Find the minimum value in a table
> * shift to Left the elements of a table
> * Reorder in ascending order (for UP/DOWN mode) a table
>
> If I am not wrong there is no opcode for above functions.

i have something like this in my udo collection. see the TabSort_i.csd
in the attachment which is with an example. it's at i-rate. but either
it might help for your own udo formulation, or you can use it at i-rate
because you trigger a subinstrument for this task (which then does the
job at i-rate and turns itself off).

2)
> My doubts are:
>
> midiin opcode is krate, if I make these rearrange functions in UDO, I
> will need many krate loop to get the result, so I am afraid to face some
> synchronizing problems.

i don't think you need many k-rate loops to get the result. why do you
believe it could happen?

hope this helps. let us know about any problems. all best -

	joachim


Am 02.07.2011 19:31, schrieb Rene Jopi:
> Hi list,
> 
> I would like to have some help to avoid to go to wrong choices.
> First, before re inventing the wheel, does anyone already made a real
> time midi analogue style arpeggiator with Csound?
> I have not found any with Csound, found some made with MaxMSP and PD,
> but I prefer Csound !
> 
> I would like to make an emulation of the arpeggiator (ARP) of the
> Sequential Circuit 6 Trak synthesizer. 
> It works as follow:
> 
> If one key is down, the ARP is not triggered. The note is played as
> normal to the audio synth.
> 
> If more than one key are down, the ARP plays the notes in sequence with
> adjustable speed.
> There is two "reading" modes:
> 
> * UP/DOWN mode: Plays the pressed keys from lowest to
> highest note and highest to lowest note.
> * ASSIGN mode: Plays the pressed keys at the order they have been pressed. 
> 
> 
> What I plan to do is:
> 
> * Use midiin opcode
> * Store midi on note to an ARP table
> * Remove note from ARP table when a midi note off is received
> * Rearrange the ARP table
> * Read the ARP table and send notes to the audio engine
> 
> To rearrange the ARP table I will have to make some functions like:
> * Find an element in a table
> * Find the minimum value in a table
> * shift to Left the elements of a table
> * Reorder in ascending order (for UP/DOWN mode) a table
> 
> If I am not wrong there is no opcode for above functions.
> 
> My doubts are:
> 
> midiin opcode is krate, if I make these rearrange functions in UDO, I
> will need many krate loop to get the result, so I am afraid to face some
> synchronizing problems.
> 
> Using Python opcodes is possible? If within Csound, I call a Python
> script including a loop, at what speed this loop is performed? At the
> Python speed or Csound krate?
> How to pass a Csound table to the Python opcode and to receive the
> rearranged table in return?
> 
> Voila, thanks in advance for any replies, thanks anyway for reading my
> poor English :)
> 
> Cheers,
> René
> 

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-07-04 12:13
FromRene Jopi
SubjectRe: [Csnd] RT Midi Arpeggiator
Hi,

Thanks for your replies and examples, I was sure to get good help :) 

Now, I understand that my comment <<... will need many krate loop to get the result...>> is stupid,
an itime loop is faster than a ktime loop!

Cheers,
René








2011/7/3 joachim heintz <jh@joachimheintz.de>
hi rené -

what you want to do should be easy to do in csound. here are some
comments to your questions:

1)
> To rearrange the ARP table I will have to make some functions like:
> * Find an element in a table
> * Find the minimum value in a table
> * shift to Left the elements of a table
> * Reorder in ascending order (for UP/DOWN mode) a table
>
> If I am not wrong there is no opcode for above functions.

i have something like this in my udo collection. see the TabSort_i.csd
in the attachment which is with an example. it's at i-rate. but either
it might help for your own udo formulation, or you can use it at i-rate
because you trigger a subinstrument for this task (which then does the
job at i-rate and turns itself off).

2)
> My doubts are:
>
> midiin opcode is krate, if I make these rearrange functions in UDO, I
> will need many krate loop to get the result, so I am afraid to face some
> synchronizing problems.

i don't think you need many k-rate loops to get the result. why do you
believe it could happen?

hope this helps. let us know about any problems. all best -

       joachim


Am 02.07.2011 19:31, schrieb Rene Jopi:
> Hi list,
>
> I would like to have some help to avoid to go to wrong choices.
> First, before re inventing the wheel, does anyone already made a real
> time midi analogue style arpeggiator with Csound?
> I have not found any with Csound, found some made with MaxMSP and PD,
> but I prefer Csound !
>
> I would like to make an emulation of the arpeggiator (ARP) of the
> Sequential Circuit 6 Trak synthesizer.
> It works as follow:
>
> If one key is down, the ARP is not triggered. The note is played as
> normal to the audio synth.
>
> If more than one key are down, the ARP plays the notes in sequence with
> adjustable speed.
> There is two "reading" modes:
>
> * UP/DOWN mode: Plays the pressed keys from lowest to
> highest note and highest to lowest note.
> * ASSIGN mode: Plays the pressed keys at the order they have been pressed.
>
>
> What I plan to do is:
>
> * Use midiin opcode
> * Store midi on note to an ARP table
> * Remove note from ARP table when a midi note off is received
> * Rearrange the ARP table
> * Read the ARP table and send notes to the audio engine
>
> To rearrange the ARP table I will have to make some functions like:
> * Find an element in a table
> * Find the minimum value in a table
> * shift to Left the elements of a table
> * Reorder in ascending order (for UP/DOWN mode) a table
>
> If I am not wrong there is no opcode for above functions.
>
> My doubts are:
>
> midiin opcode is krate, if I make these rearrange functions in UDO, I
> will need many krate loop to get the result, so I am afraid to face some
> synchronizing problems.
>
> Using Python opcodes is possible? If within Csound, I call a Python
> script including a loop, at what speed this loop is performed? At the
> Python speed or Csound krate?
> How to pass a Csound table to the Python opcode and to receive the
> rearranged table in return?
>
> Voila, thanks in advance for any replies, thanks anyway for reading my
> poor English :)
>
> Cheers,
> René
>

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-07-04 17:05
Fromjoachim heintz
SubjectRe: [Csnd] RT Midi Arpeggiator
hi renè -

i am glad you found my material helpful. both loops (i- or k-rate) are
possible. i-time loop is not faster; you are just sure it happens at the
start (initialization) of an instrument, and just once. the main
difference is that a k-loop would be repeated at every k-pass if you do
not avoid it by something like "just go into this loop if ...".

i tried to explain this in
http://en.flossmanuals.net/csound/ch016_a-initialization-and-performance-pass.
let me know any suggestions to make this better.

best -

	joachim



Am 04.07.2011 13:13, schrieb Rene Jopi:
> Hi,
> 
> Thanks for your replies and examples, I was sure to get good help :) 
> 
> Now, I understand that my comment <<... will need many krate loop to get
> the result...>> is stupid,
> an itime loop is faster than a ktime loop!
> 
> Cheers,
> René
> 
> 
> 
> 
> 
> 
> 
> 
> 2011/7/3 joachim heintz >
> 
>     hi rené -
> 
>     what you want to do should be easy to do in csound. here are some
>     comments to your questions:
> 
>     1)
>     > To rearrange the ARP table I will have to make some functions like:
>     > * Find an element in a table
>     > * Find the minimum value in a table
>     > * shift to Left the elements of a table
>     > * Reorder in ascending order (for UP/DOWN mode) a table
>     >
>     > If I am not wrong there is no opcode for above functions.
> 
>     i have something like this in my udo collection. see the TabSort_i.csd
>     in the attachment which is with an example. it's at i-rate. but either
>     it might help for your own udo formulation, or you can use it at i-rate
>     because you trigger a subinstrument for this task (which then does the
>     job at i-rate and turns itself off).
> 
>     2)
>     > My doubts are:
>     >
>     > midiin opcode is krate, if I make these rearrange functions in UDO, I
>     > will need many krate loop to get the result, so I am afraid to
>     face some
>     > synchronizing problems.
> 
>     i don't think you need many k-rate loops to get the result. why do you
>     believe it could happen?
> 
>     hope this helps. let us know about any problems. all best -
> 
>            joachim
> 
> 
>     Am 02.07.2011 19:31, schrieb Rene Jopi:
>     > Hi list,
>     >
>     > I would like to have some help to avoid to go to wrong choices.
>     > First, before re inventing the wheel, does anyone already made a real
>     > time midi analogue style arpeggiator with Csound?
>     > I have not found any with Csound, found some made with MaxMSP and PD,
>     > but I prefer Csound !
>     >
>     > I would like to make an emulation of the arpeggiator (ARP) of the
>     > Sequential Circuit 6 Trak synthesizer.
>     > It works as follow:
>     >
>     > If one key is down, the ARP is not triggered. The note is played as
>     > normal to the audio synth.
>     >
>     > If more than one key are down, the ARP plays the notes in sequence
>     with
>     > adjustable speed.
>     > There is two "reading" modes:
>     >
>     > * UP/DOWN mode: Plays the pressed keys from lowest to
>     > highest note and highest to lowest note.
>     > * ASSIGN mode: Plays the pressed keys at the order they have been
>     pressed.
>     >
>     >
>     > What I plan to do is:
>     >
>     > * Use midiin opcode
>     > * Store midi on note to an ARP table
>     > * Remove note from ARP table when a midi note off is received
>     > * Rearrange the ARP table
>     > * Read the ARP table and send notes to the audio engine
>     >
>     > To rearrange the ARP table I will have to make some functions like:
>     > * Find an element in a table
>     > * Find the minimum value in a table
>     > * shift to Left the elements of a table
>     > * Reorder in ascending order (for UP/DOWN mode) a table
>     >
>     > If I am not wrong there is no opcode for above functions.
>     >
>     > My doubts are:
>     >
>     > midiin opcode is krate, if I make these rearrange functions in UDO, I
>     > will need many krate loop to get the result, so I am afraid to
>     face some
>     > synchronizing problems.
>     >
>     > Using Python opcodes is possible? If within Csound, I call a Python
>     > script including a loop, at what speed this loop is performed? At the
>     > Python speed or Csound krate?
>     > How to pass a Csound table to the Python opcode and to receive the
>     > rearranged table in return?
>     >
>     > Voila, thanks in advance for any replies, thanks anyway for reading my
>     > poor English :)
>     >
>     > Cheers,
>     > René
>     >
> 
>     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"

Date2011-07-04 20:08
FromRene Jopi
SubjectRe: [Csnd] RT Midi Arpeggiator
Hi Joachim,

Sorry, I have to return to the basics of csound!
I was confused because the two instruments below print the same value (16) for the istart and kstart?

<CsoundSynthesizer>
<CsOptions>
-Wd --old-parser
</CsOptions>
<CsInstruments>
sr        = 44100
kr        = 100   ;(one kpass every 1/100 sec)

instr 1
istart = 0
loop:
istart = istart + 1
if istart < 16 igoto loop
print istart
endin

instr 2
kstart init 0
loop:
kstart = kstart + 1
if kstart < 16 kgoto loop
printk2 kstart
endin
</CsInstruments>
<CsScore>
i 1 0 0          ;instrument duration is 0 sec
i 2 0 0.01      ;instrument duration is 1/100 sec
</CsScore>
</CsoundSynthesizer>


new alloc for instr 1:
instr 1:  istart = 16.000   ;ok
new alloc for instr 2:
 i2    16.00000               ;surprise !!!!

I was expecting i2 loop to be performed at k rate, I mean one pass every 0.01sec and print 1 but not 16! 

I found the explanation in your flossmanual (now in my bookmarks) in the chapter "Time Loops"
<<Until now, we have just discussed loops which are executed "as fast as possible", either at i-time or at k-time.>>

Thanks for this manual, I should have read it before :)

Cheers,
René




2011/7/4 joachim heintz <jh@joachimheintz.de>
hi renè -

i am glad you found my material helpful. both loops (i- or k-rate) are
possible. i-time loop is not faster; you are just sure it happens at the
start (initialization) of an instrument, and just once. the main
difference is that a k-loop would be repeated at every k-pass if you do
not avoid it by something like "just go into this loop if ...".

i tried to explain this in
http://en.flossmanuals.net/csound/ch016_a-initialization-and-performance-pass.
let me know any suggestions to make this better.

best -

       joachim



Am 04.07.2011 13:13, schrieb Rene Jopi:
> Hi,
>
> Thanks for your replies and examples, I was sure to get good help :)
>
> Now, I understand that my comment <<... will need many krate loop to get
> the result...>> is stupid,
> an itime loop is faster than a ktime loop!
>
> Cheers,
> René
>
>
>
>
>
>
>
>
> 2011/7/3 joachim heintz <jh@joachimheintz.de <mailto:jh@joachimheintz.de>>
>
>     hi rené -
>
>     what you want to do should be easy to do in csound. here are some
>     comments to your questions:
>
>     1)
>     > To rearrange the ARP table I will have to make some functions like:
>     > * Find an element in a table
>     > * Find the minimum value in a table
>     > * shift to Left the elements of a table
>     > * Reorder in ascending order (for UP/DOWN mode) a table
>     >
>     > If I am not wrong there is no opcode for above functions.
>
>     i have something like this in my udo collection. see the TabSort_i.csd
>     in the attachment which is with an example. it's at i-rate. but either
>     it might help for your own udo formulation, or you can use it at i-rate
>     because you trigger a subinstrument for this task (which then does the
>     job at i-rate and turns itself off).
>
>     2)
>     > My doubts are:
>     >
>     > midiin opcode is krate, if I make these rearrange functions in UDO, I
>     > will need many krate loop to get the result, so I am afraid to
>     face some
>     > synchronizing problems.
>
>     i don't think you need many k-rate loops to get the result. why do you
>     believe it could happen?
>
>     hope this helps. let us know about any problems. all best -
>
>            joachim
>
>
>     Am 02.07.2011 19:31, schrieb Rene Jopi:
>     > Hi list,
>     >
>     > I would like to have some help to avoid to go to wrong choices.
>     > First, before re inventing the wheel, does anyone already made a real
>     > time midi analogue style arpeggiator with Csound?
>     > I have not found any with Csound, found some made with MaxMSP and PD,
>     > but I prefer Csound !
>     >
>     > I would like to make an emulation of the arpeggiator (ARP) of the
>     > Sequential Circuit 6 Trak synthesizer.
>     > It works as follow:
>     >
>     > If one key is down, the ARP is not triggered. The note is played as
>     > normal to the audio synth.
>     >
>     > If more than one key are down, the ARP plays the notes in sequence
>     with
>     > adjustable speed.
>     > There is two "reading" modes:
>     >
>     > * UP/DOWN mode: Plays the pressed keys from lowest to
>     > highest note and highest to lowest note.
>     > * ASSIGN mode: Plays the pressed keys at the order they have been
>     pressed.
>     >
>     >
>     > What I plan to do is:
>     >
>     > * Use midiin opcode
>     > * Store midi on note to an ARP table
>     > * Remove note from ARP table when a midi note off is received
>     > * Rearrange the ARP table
>     > * Read the ARP table and send notes to the audio engine
>     >
>     > To rearrange the ARP table I will have to make some functions like:
>     > * Find an element in a table
>     > * Find the minimum value in a table
>     > * shift to Left the elements of a table
>     > * Reorder in ascending order (for UP/DOWN mode) a table
>     >
>     > If I am not wrong there is no opcode for above functions.
>     >
>     > My doubts are:
>     >
>     > midiin opcode is krate, if I make these rearrange functions in UDO, I
>     > will need many krate loop to get the result, so I am afraid to
>     face some
>     > synchronizing problems.
>     >
>     > Using Python opcodes is possible? If within Csound, I call a Python
>     > script including a loop, at what speed this loop is performed? At the
>     > Python speed or Csound krate?
>     > How to pass a Csound table to the Python opcode and to receive the
>     > rearranged table in return?
>     >
>     > Voila, thanks in advance for any replies, thanks anyway for reading my
>     > poor English :)
>     >
>     > Cheers,
>     > René
>     >
>
>     Send bugs reports to the Sourceforge bug tracker
>
>      https://sourceforge.net/tracker/?group_id=81968&atid=564599
>     <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
>     <mailto: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"