Csound Csound-dev Csound-tekno Search About

[Csnd] chnset-get trivial question

Date2011-02-18 10:48
Fromfrancesco
Subject[Csnd] chnset-get trivial question
Hello All,
i was looking at chnset and chnget opcodes and i have this csd:

chn_k   "amp", 3, 2, 0.5, 0.0, 1.0

           instr    1

;kamp    init    0.5
kamp    chnget    "amp"
kamp    init    0.5

a1    oscili    kamp, 300, 1
       out       a1
       endin

my question is: why i cannot get a sound?

Are default value setted in chn_k not read at init time ?
And why same happen at kamp init ?

A second question is: is it necessary to declare chn_k to use
chnget/set in an instrument? 

Thank You,
ciao,
francesco.




Date2011-02-18 11:30
FromVictor Lazzarini
SubjectRe: [Csnd] chnset-get trivial question
You don't need to declare it using that opcode, eg:

instr 1
k1 oscili 1, 0.5, 1
chnset k1, "amp"
endin

instr 2
k1 chnget "amp"
a1 oscili 0dbfs*k1/2, 440, 1
out a1
endin


On 18 Feb 2011, at 10:48, francesco wrote:

>
> Hello All,
> i was looking at chnset and chnget opcodes and i have this csd:
>
> chn_k   "amp", 3, 2, 0.5, 0.0, 1.0
>
>           instr    1
>
> ;kamp    init    0.5
> kamp    chnget    "amp"
> kamp    init    0.5
>
> a1    oscili    kamp, 300, 1
>       out       a1
>       endin
>
> my question is: why i cannot get a sound?
>
> Are default value setted in chn_k not read at init time ?
> And why same happen at kamp init ?
>
> A second question is: is it necessary to declare chn_k to use
> chnget/set in an instrument?
>
> Thank You,
> ciao,
> francesco.
>
>
>
>
>
> --  
> View this message in context: http://csound.1045644.n5.nabble.com/chnset-get-trivial-question-tp3390875p3390875.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"

Date2011-02-18 11:52
FromAndres Cabrera
SubjectRe: [Csnd] chnset-get trivial question
Hi,

On Fri, Feb 18, 2011 at 10:48 AM, francesco  wrote:
> A second question is: is it necessary to declare chn_k to use
> chnget/set in an instrument?

No, you just need to declare the channels if you want them to be
exposed from the API (or to front ends).

Cheers,
Andres


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-02-18 18:38
FromJustin Glenn Smith
SubjectRe: [Csnd] chnset-get trivial question
Try multiplying kamp by 0dbfs:
a1    oscili    kamp*0dbfs, 300, 1
With a default value of 32768 for 0dbfs, a raw value of 1 is not going to make much noticeable sound.

Also, what are you actually setting the value of the amp channel to? How are you going about setting that value in the host application?

francesco wrote:
> Hello All,
> i was looking at chnset and chnget opcodes and i have this csd:
> 
> chn_k   "amp", 3, 2, 0.5, 0.0, 1.0
> 
>            instr    1
> 
> ;kamp    init    0.5
> kamp    chnget    "amp"
> kamp    init    0.5
> 
> a1    oscili    kamp, 300, 1
>        out       a1
>        endin
> 
> my question is: why i cannot get a sound?
> 
> Are default value setted in chn_k not read at init time ?
> And why same happen at kamp init ?
> 
> A second question is: is it necessary to declare chn_k to use
> chnget/set in an instrument? 
> 
> Thank You,
> ciao,
> francesco.
> 
> 
> 
> 
> 



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-02-18 19:30
Fromfrancesco
Subject[Csnd] Re: chnset-get trivial question
Thanks All.

Mr. Justin,
thanks; i had 0dbfs=1 in header, and then amplitude was right.
In this case i was only try the csd, and i would expect that setting a
default
value of amp this value remain fixed because no external program send a
different value.
The first attempt is with chn_k that had a default value as fourth
parameter,
but no luck; then i have set directly the amp value with kamp init 0.5
(using
an external program this value will be override), but again no result.
My only wish it was to set a default and starting value of amp without
using an external program (at this stage).

I hope i better express my thought.
Thanks,
ciao,
francesco.

Date2011-02-18 19:42
FromVictor Lazzarini
SubjectRe: [Csnd] Re: chnset-get trivial question
You can use 'init' to set an initial value for your k variable...

On 18 Feb 2011, at 19:30, francesco wrote:

>
> Thanks All.
>
> Mr. Justin,
> thanks; i had 0dbfs=1 in header, and then amplitude was right.
> In this case i was only try the csd, and i would expect that setting a
> default
> value of amp this value remain fixed because no external program  
> send a
> different value.
> The first attempt is with chn_k that had a default value as fourth
> parameter,
> but no luck; then i have set directly the amp value with kamp init 0.5
> (using
> an external program this value will be override), but again no result.
> My only wish it was to set a default and starting value of amp without
> using an external program (at this stage).
>
> I hope i better express my thought.
> Thanks,
> ciao,
> francesco.
>
> -- 
> View this message in context: http://csound.1045644.n5.nabble.com/chnset-get-trivial-question-tp3390875p3391662.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"

Date2011-02-18 20:11
Fromfrancesco
Subject[Csnd] Re: chnset-get trivial question
Thanks Mr Victor,
that is my attempt. I have set kamp init 0.5, but no result, at least here:

    instr    1

kamp    init         0.5
kamp    chnget    "amp"
a1        oscil       kamp, 300, 1
           out         a1
           endin

here i would expect that if nothing happened the kamp value start and remain
at 0.5.
It is not my case, i'll get always 0.0 output value.

This is what i do not understand.

ciao,
francesco.

 

Date2011-02-18 20:19
Fromfrancesco
Subject[Csnd] Re: chnset-get trivial question
and i have tryed to put kamp init after the chnget opcode and nothing change,
but if i comment out the chnget opcode all work ok.

Then: how can i set an initial value of a chn within a csd, i.e. without an
external
program?


ciao,
francesco.

Date2011-02-18 20:29
FromVictor Lazzarini
SubjectRe: [Csnd] Re: chnset-get trivial question
Use this for instance (at global level)

chnset 0.5, "amp"

instr 1

...

endin

On 18 Feb 2011, at 20:19, francesco wrote:

>
> and i have tryed to put kamp init after the chnget opcode and  
> nothing change,
> but if i comment out the chnget opcode all work ok.
>
> Then: how can i set an initial value of a chn within a csd, i.e.  
> without an
> external
> program?
>
>
> ciao,
> francesco.
>
> -- 
> View this message in context: http://csound.1045644.n5.nabble.com/chnset-get-trivial-question-tp3390875p3391741.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"

Date2011-02-18 20:38
Fromfrancesco
Subject[Csnd] Re: chnset-get trivial question
Ok, thanks!

I would expext that

chn_k   "amp", 3, 2, 0.5, 0.0, 1.0

had same behaviour, with optional parameter default value (and min, max).
But it is not.

Again thanks,
ciao,
francesco.

Date2011-02-18 20:44
FromVictor Lazzarini
SubjectRe: [Csnd] Re: chnset-get trivial question
yes, maybe I should investigate it...
On 18 Feb 2011, at 20:38, francesco wrote:

>
> Ok, thanks!
>
> I would expext that
>
> chn_k   "amp", 3, 2, 0.5, 0.0, 1.0
>
> had same behaviour, with optional parameter default value (and min,  
> max).
> But it is not.
>
> Again thanks,
> ciao,
> francesco.
>
> -- 
> View this message in context: http://csound.1045644.n5.nabble.com/chnset-get-trivial-question-tp3390875p3391761.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"

Date2011-02-18 20:49
Fromfrancesco
Subject[Csnd] Re: chnset-get trivial question

and then, if You really want, same happen with chnexport;
if You want a default value You need to use init in global
space.

Thank You,
ciao,
francesco.

Date2011-02-18 22:53
FromJustin Glenn Smith
SubjectRe: [Csnd] Re: chnset-get trivial question
The manual explicitly states that chn_k's arguments do nothing but provide advice to external software - they do not actually set any upper or lower limits or initialize a default value etc. This is odd behavior, but it is described accurately in the manual at least.

Victor Lazzarini wrote:
> yes, maybe I should investigate it...
> On 18 Feb 2011, at 20:38, francesco wrote:
> 
>>
>> Ok, thanks!
>>
>> I would expext that
>>
>> chn_k   "amp", 3, 2, 0.5, 0.0, 1.0
>>
>> had same behaviour, with optional parameter default value (and min, max).
>> But it is not.
>>
>> Again thanks,
>> ciao,
>> francesco.
>>
>> -- 
>> View this message in context:
>> http://csound.1045644.n5.nabble.com/chnset-get-trivial-question-tp3390875p3391761.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"
> 
> 



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-02-18 23:13
Fromfrancesco
Subject[Csnd] Re: chnset-get trivial question
Yes Mr Justin,
You are right. I would have read more carefully the manual!

Anyway could be a good idea to have an extra parameter for
setting a default value without using an init statement. Maybe.

Thank You,
ciao,
francesco.

Date2011-02-18 23:18
FromVictor Lazzarini
SubjectRe: [Csnd] Re: chnset-get trivial question
Not if we can already use chnset for this.

Victor
On 18 Feb 2011, at 23:13, francesco wrote:

>
> Yes Mr Justin,
> You are right. I would have read more carefully the manual!
>
> Anyway could be a good idea to have an extra parameter for
> setting a default value without using an init statement. Maybe.
>
> Thank You,
> ciao,
> francesco.
>
> --  
> View this message in context: http://csound.1045644.n5.nabble.com/chnset-get-trivial-question-tp3390875p3391930.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"

Date2011-02-18 23:42
Fromfrancesco
Subject[Csnd] Re: chnset-get trivial question
Ok. Sorry to be pedantic. To summarize:

i do need to declare a chn in global space ONLY to use it with an external
program
(ie via API);

if i want that a chn had a initial value or default value i do need to
use chnset (or init the variable used) in global space;

a chn is shared between instruments (like globals ?).

Am i right?

(I promise that this is the last question, at least for today!)

ciao,
francesco.

Date2011-02-19 00:08
FromVictor Lazzarini
SubjectRe: [Csnd] Re: chnset-get trivial question
Only one string per scoreline, though. However you could call your  
busses numerically, converting integers to strings in your instrument.
On 19 Feb 2011, at 00:54, Justin Glenn Smith wrote:

> And thanks to this discussion I learned that chnset / chnget can be  
> used internally by csound - without needing to send data to / from  
> an external app. I am thinking I can use this to make a csd for  
> csound livecoding (with -Lstdin as a command line flag).
>
> I am imagining that with an i1 that just runs chnset on its  
> arguments, and an i2 that takes bus names as arguments (using chnget  
> inside the isntrument with those bus names of course) I could type  
> in something like this in a realtime session:
>
> i 2.1 0 -1 "amp" "pitch" "pan"
> i 1 0 -1 "pitch" 7
> i 1 0 -1 "pan" .7
> i 1 0 -1 "amp" .7
> i 2.2 0 -1 "a2" "p2" "pa2"
> i 1 0 -1 "p2" 7.5
> i 1 0 -1 "pa2" .3
> i 1 0 -1 "p2" .6
>
> And get a textual interface for fine grained real time instrument  
> instance control.
>
> Add in a tcl preprocessor with readline to reduce typing and add tab  
> completion - or maybe a custom emacs mode with some good macros  
> predefined - and things could get very interesting... with named  
> channels as instrument arguments you can easily do puredata style  
> dynamic patching with a textual rather than mouse based interface  
> for example (of course each "object" would have to be an existing  
> instrument in your score).
>
> I may have a new project...
>
> francesco wrote:
>> Yes Mr Justin,
>> You are right. I would have read more carefully the manual!
>>
>> Anyway could be a good idea to have an extra parameter for
>> setting a default value without using an init statement. Maybe.
>>
>> Thank You,
>> ciao,
>> francesco.
>>
>
>
>
> 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-02-19 00:54
FromJustin Glenn Smith
SubjectRe: [Csnd] Re: chnset-get trivial question
And thanks to this discussion I learned that chnset / chnget can be used internally by csound - without needing to send data to / from an external app. I am thinking I can use this to make a csd for csound livecoding (with -Lstdin as a command line flag).

I am imagining that with an i1 that just runs chnset on its arguments, and an i2 that takes bus names as arguments (using chnget inside the isntrument with those bus names of course) I could type in something like this in a realtime session:

i 2.1 0 -1 "amp" "pitch" "pan"
i 1 0 -1 "pitch" 7
i 1 0 -1 "pan" .7
i 1 0 -1 "amp" .7
i 2.2 0 -1 "a2" "p2" "pa2"
i 1 0 -1 "p2" 7.5
i 1 0 -1 "pa2" .3
i 1 0 -1 "p2" .6

And get a textual interface for fine grained real time instrument instance control.

Add in a tcl preprocessor with readline to reduce typing and add tab completion - or maybe a custom emacs mode with some good macros predefined - and things could get very interesting... with named channels as instrument arguments you can easily do puredata style dynamic patching with a textual rather than mouse based interface for example (of course each "object" would have to be an existing instrument in your score).

I may have a new project...

francesco wrote:
> Yes Mr Justin,
> You are right. I would have read more carefully the manual!
> 
> Anyway could be a good idea to have an extra parameter for
> setting a default value without using an init statement. Maybe.
> 
> Thank You,
> ciao,
> francesco.
> 



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-02-19 09:35
Fromjoachim heintz
SubjectRe: [Csnd] Re: chnset-get trivial question
as victor mentioned, statements like
> i 2.1 0 -1 "amp" "pitch" "pan"
are not possible, because you can only pass one string per scoreline.
this may change in future with the new parser.
at present, you can avoid this problem by using numbers and the strset
opcode, or strings like "amp:pitch:pan" which you then split in the
instrument.

	joachim


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"