Csound Csound-dev Csound-tekno Search About

[Csnd] Automation curves for notes and instruments

Date2012-04-02 18:27
FromJohn Allsup
Subject[Csnd] Automation curves for notes and instruments
I am new to csound and am gradually trying to figure out what it's
readily capable of.  A routine feature of modern DAWs is parameter
automation.  Clearly at opcode level csound is capable of fine-grained
automation of any parameter of any opcode.  The question is how to get
the information into the instrument.  Where and how do you specify a
long varied (e.g. minutes long with 100s of segments) curve to change a
parameter of a note or instrument?  I'm wondering whether the easiest
thing to do is to write a separate script in ruby or python that
generates the curve as a mono WAV file that can then be imported via a
table or opcode.  Any thoughts?

Date2012-04-02 18:40
FromSteven Yi
SubjectRe: [Csnd] Automation curves for notes and instruments
Hi John,

I wrote an article that discusses parameter automation:

http://www.csounds.com/journal/issue13/emulatingMidiBasedStudios.html

I use a similar design in my program blue.  Essentially, automation
values are written to from outside the instrument that uses it.  This
separates the two. In the article, it uses:

instr 2 ; Automation instrument

Sparam = p4 ; name of parameter to control
istart = p5 ; start value
iend = p6   ; end value

ksig line istart, p3, iend

chnset ksig, Sparam

endin

and the values are supplied by score statements.  The user in blue
uses a graphical interface to edit automation values, but they get
written out to score.  Now, the instrument in the example only uses
the line opcode; you could use a p7 to set something like curve and
use transeg instead, or use some other form of automation curve.
Overall though, I've found this method to work rather well for
automation.

If you want arate automations created from another program, I'm sure
that'd be fine as well.  In that case, I'd probably still separate out
the writing and reading, and use chnget/chnset.  You could have on
instrument that reads from an audio file and write an asig to a
channel, then in your instrument read from it using something like:

acontrol1 chnget "myInstr.controlChannel1"

Separating it out from the sounding instrument will give you some
flexibility, so maybe in one project you decide to generate to score,
another you might use audio, etc.

Hope that helps!
steven


On Mon, Apr 2, 2012 at 6:27 PM, John Allsup  wrote:
> I am new to csound and am gradually trying to figure out what it's
> readily capable of.  A routine feature of modern DAWs is parameter
> automation.  Clearly at opcode level csound is capable of fine-grained
> automation of any parameter of any opcode.  The question is how to get
> the information into the instrument.  Where and how do you specify a
> long varied (e.g. minutes long with 100s of segments) curve to change a
> parameter of a note or instrument?  I'm wondering whether the easiest
> thing to do is to write a separate script in ruby or python that
> generates the curve as a mono WAV file that can then be imported via a
> table or opcode.  Any thoughts?
>
>
> 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-04-02 18:48
FromTarmo Johannes
SubjectRe: [Csnd] Automation curves for notes and instruments
Hello,

you have different possibilities:

if you really like automation, you can use csound as plugin to your favourite DAW (either as LADSPA with csLadspa or VST (http://code.google.com/p/cabbage/ ) or if you have max-max4Live-Ableton Live you can use csound4live http://csound4live.com/  )

Inside csound you can form envelopes (for example with opcode linseg but there many-many other methods as well) however long and use them with your parameters. I think it is most useful to do it with global variable. A very simple example to set envelope







sr = 44100
nchnls = 1
0dbfs = 1
ksmps = 32


giSine	ftgen	1, 0, 2048, 10, 1

gkGain init 0
alwayson 1 ; turn automatically on the automation instrument

instr 1 ; automation
	gkGain linseg 0, 12*60 , 0.5, 5*60, 1, 3*60,0 ; in 12 minutes to 0.5, 5 minutes to full and just in 3 to back 0 again 
endin

instr 2
	asig oscil gkGain, 100,giSine
	out asig
endin





i 2 0 [20*60]



Perhaps you know it all already and I did not get your questions exactly...

If you want to record an autmoation in realtime then it is possible with writing the values to table or maybe to an external file with foutk but probablt more experienced users can give here better hints.


greetings,
tarmo




On Monday 02 April 2012 20:27:16 John Allsup wrote:
> I am new to csound and am gradually trying to figure out what it's
> readily capable of.  A routine feature of modern DAWs is parameter
> automation.  Clearly at opcode level csound is capable of fine-grained
> automation of any parameter of any opcode.  The question is how to get
> the information into the instrument.  Where and how do you specify a
> long varied (e.g. minutes long with 100s of segments) curve to change a
> parameter of a note or instrument?  I'm wondering whether the easiest
> thing to do is to write a separate script in ruby or python that
> generates the curve as a mono WAV file that can then be imported via a
> table or opcode.  Any thoughts?
> 
> 
> 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-04-02 21:49
FromJohn Allsup
SubjectRe: [Csnd] Automation curves for notes and instruments
On 02/04/12 18:48, Tarmo Johannes wrote:
> Hello,
> 
> you have different possibilities:
> 
> if you really like automation, you can use csound as plugin to your favourite DAW (either as LADSPA with csLadspa or VST (http://code.google.com/p/cabbage/ ) or if you have max-max4Live-Ableton Live you can use csound4live http://csound4live.com/  )

> 
> Inside csound you can form envelopes (for example with opcode linseg but there many-many other methods as well) however long and use them with your parameters. I think it is most useful to do it with global variable. A very simple example to set envelope
> 
...
> instr 1 ; automation
> 	gkGain linseg 0, 12*60 , 0.5, 5*60, 1, 3*60,0 ; in 12 minutes to 0.5, 5 minutes to full and just in 3 to back 0 again 
> endin
> 
> instr 2
> 	asig oscil gkGain, 100,giSine
> 	out asig
> endin
The imagined use case is as follows:
1) There are multiple instances of an instrument and possibly multiple
notes playing on each instance.
2) Changing settings on one instrument changes settings for notes
playing on that synth,
2a) but not for notes on other instances of the same instrument (same as
in having the same opcode definition).
3) There is per-instance automation data and per-note automation data.

If I want to automate each note differently, I can't use a single global
variable, can't use signal routing at an instrument by instrument basis
(as described in the article
http://www.csounds.com/journal/issue13/emulatingMidiBasedStudios.html
referenced in the other reply), so have to use zak channels (and a lot
of them), and can't hardwire the opcode choices into a single
instrument. (Else I have to duplicate the instrument and order things so
that automation sent to the logical instrument are copied across these
duplicate instruments.)  These are just an array of channels, so if you
have multiple channels per note and a few more for the instrument then
while you can pass in the zak channel number via the score, you have to
allocate numbers manually (and this makes modifying a score a potential
nightmare with what I have in mind).

I'm toying with writing a Ruby library (tending to use Ruby rather than
python for scripting) that generates suitable input for csound.  Maybe
that's the way to go for what I want for now (and hopefully together
with a few examples it will better illustrate what I'm trying to achieve.)

One quick question about lines and linsegs etc.  What is the best way to
set the value that will be in the variable written to by the opcode when
the envelope finishes?

> 
> 
> 
> i 2 0 [20*60]
> 
> 
> 
> Perhaps you know it all already and I did not get your questions exactly...
> 
> If you want to record an autmoation in realtime then it is possible with writing the values to table or maybe to an external file with foutk but probablt more experienced users can give here better hints.
> 
> 
> greetings,
> tarmo
> 
> 
> 
> 
> On Monday 02 April 2012 20:27:16 John Allsup wrote:
>> I am new to csound and am gradually trying to figure out what it's
>> readily capable of.  A routine feature of modern DAWs is parameter
>> automation.  Clearly at opcode level csound is capable of fine-grained
>> automation of any parameter of any opcode.  The question is how to get
>> the information into the instrument.  Where and how do you specify a
>> long varied (e.g. minutes long with 100s of segments) curve to change a
>> parameter of a note or instrument?  I'm wondering whether the easiest
>> thing to do is to write a separate script in ruby or python that
>> generates the curve as a mono WAV file that can then be imported via a
>> table or opcode.  Any thoughts?
>>
>>
>> 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-04-02 22:03
FromSteven Yi
SubjectRe: [Csnd] Automation curves for notes and instruments
One note, you can you do per-note automation as well if using chnget,
you'll just have to develop a scheme for doing it.  I used one in
handling multitouch code in Android:

http://csound.git.sourceforge.net/git/gitweb.cgi?p=csound/csound5.git;a=blob_plain;f=android/CsoundAndroidExamples/res/raw/multitouch_xy.csd;hb=HEAD

This one used a pfield to determine note number, but if you use
fractiional instrument numbers, you could use the fractional part of
p1 to use with an sprintf.  You could then use the automation
instrument with things like:

i 2 0 2 "controller.1" 10 20
i 2 0 2 "controller.2" 10 20

I guess if you want per-instrument and per-note both in the same
instrument and for the same parameter, you'd have to write some kind
of code that looks for a fractional value or other indicator.  At
least using sprintf with chnget/chnset might be something to think
about.



On Mon, Apr 2, 2012 at 9:49 PM, John Allsup  wrote:
> On 02/04/12 18:48, Tarmo Johannes wrote:
>> Hello,
>>
>> you have different possibilities:
>>
>> if you really like automation, you can use csound as plugin to your favourite DAW (either as LADSPA with csLadspa or VST (http://code.google.com/p/cabbage/ ) or if you have max-max4Live-Ableton Live you can use csound4live http://csound4live.com/  )
>
>>
>> Inside csound you can form envelopes (for example with opcode linseg but there many-many other methods as well) however long and use them with your parameters. I think it is most useful to do it with global variable. A very simple example to set envelope
>>
> ...
>> instr 1 ; automation
>>       gkGain linseg 0, 12*60 , 0.5, 5*60, 1, 3*60,0 ; in 12 minutes to 0.5, 5 minutes to full and just in 3 to back 0 again
>> endin
>>
>> instr 2
>>       asig oscil gkGain, 100,giSine
>>       out asig
>> endin
> The imagined use case is as follows:
> 1) There are multiple instances of an instrument and possibly multiple
> notes playing on each instance.
> 2) Changing settings on one instrument changes settings for notes
> playing on that synth,
> 2a) but not for notes on other instances of the same instrument (same as
> in having the same opcode definition).
> 3) There is per-instance automation data and per-note automation data.
>
> If I want to automate each note differently, I can't use a single global
> variable, can't use signal routing at an instrument by instrument basis
> (as described in the article
> http://www.csounds.com/journal/issue13/emulatingMidiBasedStudios.html
> referenced in the other reply), so have to use zak channels (and a lot
> of them), and can't hardwire the opcode choices into a single
> instrument. (Else I have to duplicate the instrument and order things so
> that automation sent to the logical instrument are copied across these
> duplicate instruments.)  These are just an array of channels, so if you
> have multiple channels per note and a few more for the instrument then
> while you can pass in the zak channel number via the score, you have to
> allocate numbers manually (and this makes modifying a score a potential
> nightmare with what I have in mind).
>
> I'm toying with writing a Ruby library (tending to use Ruby rather than
> python for scripting) that generates suitable input for csound.  Maybe
> that's the way to go for what I want for now (and hopefully together
> with a few examples it will better illustrate what I'm trying to achieve.)
>
> One quick question about lines and linsegs etc.  What is the best way to
> set the value that will be in the variable written to by the opcode when
> the envelope finishes?
>
>> 
>> 
>>
>> i 2 0 [20*60]
>> 
>> 
>>
>> Perhaps you know it all already and I did not get your questions exactly...
>>
>> If you want to record an autmoation in realtime then it is possible with writing the values to table or maybe to an external file with foutk but probablt more experienced users can give here better hints.
>>
>>
>> greetings,
>> tarmo
>>
>>
>>
>>
>> On Monday 02 April 2012 20:27:16 John Allsup wrote:
>>> I am new to csound and am gradually trying to figure out what it's
>>> readily capable of.  A routine feature of modern DAWs is parameter
>>> automation.  Clearly at opcode level csound is capable of fine-grained
>>> automation of any parameter of any opcode.  The question is how to get
>>> the information into the instrument.  Where and how do you specify a
>>> long varied (e.g. minutes long with 100s of segments) curve to change a
>>> parameter of a note or instrument?  I'm wondering whether the easiest
>>> thing to do is to write a separate script in ruby or python that
>>> generates the curve as a mono WAV file that can then be imported via a
>>> table or opcode.  Any thoughts?
>>>
>>>
>>> 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"
>