Csound Csound-dev Csound-tekno Search About

[Csnd] Using user defined operators in score

Date2011-04-19 05:06
FromNil Geisweiller
Subject[Csnd] Using user defined operators in score
Hi,

I'm new to Csound.

I noticed that I cannot do the following

i1 0 1 10000 [3+int(5*~)]

where p5 of instr 1 takes a pitch class in argument.

I was hoping the result would be a note randomly chosen over the
octaves 3 to 8 but instead Csound compiler complains with the
following error:

score error:  illegal character i(69) in [] expression
  section 1:  at position 16

Obviously position 16 coincides with the letter i of int.

What I am doing wrong?

Or perhaps I cannot do that?

If so, how could I work around this (beside expressing it in the
instrument, which is what I have already done)?

Thanks for your help.

Regards,
Nil

On Mon, Apr 18, 2011 at 8:05 PM, Rene Jopi  wrote:
> Hi,
> An error diagnostic system giving the number of the line having error(s),
> in csd file, in included file, in macro, in udo,... will be
> very useful for beginners (and others !).
> Sorry if this is done with new parser, have not used yet.
> Rene


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-04-19 07:32
Fromjoachim heintz
SubjectRe: [Csnd] Using user defined operators in score
Hi Nil -

yes, orchestra and score syntax are different in Csound. You can't do
something like int(x) in the score. What you can do, is written here:
http://www.csounds.com/manual/html/ScoreTop.html

But it is very simple to choose a note randomly by an expression in the
instrument. Did you do this, as you said "which is what I have already
done"? What's you problem with this method?

Best -

	joachim


Am 19.04.2011 06:06, schrieb Nil Geisweiller:
> Hi,
> 
> I'm new to Csound.
> 
> I noticed that I cannot do the following
> 
> i1 0 1 10000 [3+int(5*~)]
> 
> where p5 of instr 1 takes a pitch class in argument.
> 
> I was hoping the result would be a note randomly chosen over the
> octaves 3 to 8 but instead Csound compiler complains with the
> following error:
> 
> score error:  illegal character i(69) in [] expression
>   section 1:  at position 16
> 
> Obviously position 16 coincides with the letter i of int.
> 
> What I am doing wrong?
> 
> Or perhaps I cannot do that?
> 
> If so, how could I work around this (beside expressing it in the
> instrument, which is what I have already done)?
> 
> Thanks for your help.
> 
> Regards,
> Nil
> 
> On Mon, Apr 18, 2011 at 8:05 PM, Rene Jopi  wrote:
>> Hi,
>> An error diagnostic system giving the number of the line having error(s),
>> in csd file, in included file, in macro, in udo,... will be
>> very useful for beginners (and others !).
>> Sorry if this is done with new parser, have not used yet.
>> Rene
> 
> 
> 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-04-19 08:27
FromNil Geisweiller
SubjectRe: [Csnd] Using user defined operators in score
Hi Joachim,

On Tue, Apr 19, 2011 at 9:32 AM, joachim heintz  wrote:
> Hi Nil -
>
> yes, orchestra and score syntax are different in Csound. You can't do
> something like int(x) in the score. What you can do, is written here:
> http://www.csounds.com/manual/html/ScoreTop.html

thanks for your prompt answer. Confirms what I thought.

>
> But it is very simple to choose a note randomly by an expression in the
> instrument. Did you do this, as you said "which is what I have already
> done"?

Yes that is what I currently do.

>What's you problem with this method?

I just found that doing that in the score was more intuitive. Since
expressions like [3+5*~] are allowed I thought it might work as well.

I think it'd be nice if the scoring language was slightly more
expressive, that way there would be no need for third-party languages
(like Python) to generate sophisticated score.

Anyway, so far I can do what I want. :-)

Regards
Nil

>
> Best -
>
>        joachim
>
>
> Am 19.04.2011 06:06, schrieb Nil Geisweiller:
>> Hi,
>>
>> I'm new to Csound.
>>
>> I noticed that I cannot do the following
>>
>> i1 0 1 10000 [3+int(5*~)]
>>
>> where p5 of instr 1 takes a pitch class in argument.
>>
>> I was hoping the result would be a note randomly chosen over the
>> octaves 3 to 8 but instead Csound compiler complains with the
>> following error:
>>
>> score error:  illegal character i(69) in [] expression
>>   section 1:  at position 16
>>
>> Obviously position 16 coincides with the letter i of int.
>>
>> What I am doing wrong?
>>
>> Or perhaps I cannot do that?
>>
>> If so, how could I work around this (beside expressing it in the
>> instrument, which is what I have already done)?
>>
>> Thanks for your help.
>>
>> Regards,
>> Nil
>>
>> On Mon, Apr 18, 2011 at 8:05 PM, Rene Jopi  wrote:
>>> Hi,
>>> An error diagnostic system giving the number of the line having error(s),
>>> in csd file, in included file, in macro, in udo,... will be
>>> very useful for beginners (and others !).
>>> Sorry if this is done with new parser, have not used yet.
>>> Rene
>>
>>
>> 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-04-19 09:04
FromVictor Lazzarini
SubjectRe: [Csnd] Using user defined operators in score
And possibly the use of third-party tools would become more unwieldy.  
The thing about Csound's score language is that it is simple and
any program can spill it out. Since there are lots of good scripting  
languages out there, I don't think we need to reinvent the wheel.

Victor

On 19 Apr 2011, at 08:27, Nil Geisweiller wrote:

> I think it'd be nice if the scoring language was slightly more
> expressive, that way there would be no need for third-party languages
> (like Python) to generate sophisticated score.

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





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-04-19 09:18
FromNil Geisweiller
SubjectRe: [Csnd] Using user defined operators in score
On Tue, Apr 19, 2011 at 11:04 AM, Victor Lazzarini
 wrote:
> And possibly the use of third-party tools would become more unwieldy. The
> thing about Csound's score language is that it is simple and
> any program can spill it out. Since there are lots of good scripting
> languages out there, I don't think we need to reinvent the wheel.

hmmm, not reinventing the wheel, but it would not cost much in the
score language complexity to have a bit larger set of operators. Since
the score language handles loops it can already do a lot of stuff.

Nil

>
> Victor
>
> On 19 Apr 2011, at 08:27, Nil Geisweiller wrote:
>
>> I think it'd be nice if the scoring language was slightly more
>> expressive, that way there would be no need for third-party languages
>> (like Python) to generate sophisticated score.
>
> Dr Victor Lazzarini
> Senior Lecturer
> Dept. of Music
> NUI Maynooth Ireland
> tel.: +353 1 708 3545
> Victor dot Lazzarini AT nuim dot ie
>
>
>
>
>
> 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-04-19 09:49
FromVictor Lazzarini
SubjectRe: [Csnd] Using user defined operators in score
Well, we have been collecting suggestions for a wishlist. You are  
welcome to contribute to it.
On 19 Apr 2011, at 09:18, Nil Geisweiller wrote:

> On Tue, Apr 19, 2011 at 11:04 AM, Victor Lazzarini
>  wrote:
>> And possibly the use of third-party tools would become more  
>> unwieldy. The
>> thing about Csound's score language is that it is simple and
>> any program can spill it out. Since there are lots of good scripting
>> languages out there, I don't think we need to reinvent the wheel.
>
> hmmm, not reinventing the wheel, but it would not cost much in the
> score language complexity to have a bit larger set of operators. Since
> the score language handles loops it can already do a lot of stuff.
>
> Nil
>
>>
>> Victor
>>
>> On 19 Apr 2011, at 08:27, Nil Geisweiller wrote:
>>
>>> I think it'd be nice if the scoring language was slightly more
>>> expressive, that way there would be no need for third-party  
>>> languages
>>> (like Python) to generate sophisticated score.
>>
>> Dr Victor Lazzarini
>> Senior Lecturer
>> Dept. of Music
>> NUI Maynooth Ireland
>> tel.: +353 1 708 3545
>> Victor dot Lazzarini AT nuim dot ie
>>
>>
>>
>>
>>
>> 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"
>

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





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-04-19 11:07
FromAdam Puckett
SubjectRe: [Csnd] Using user defined operators in score
Nil,

Back to your original question, you can also do the following, which
breaks down the math a little:

i1 0 1 10000 [~*(8-3)+3]

And regarding scripting languages, as Victor stated earlier, the score
is simple so that any program (not to mention language, e.g. Python)
can generate it. I am someone who uses Python to generate massive
scores to create pop music in Csound, which mostly involves using
loops and conditional statements. The Csound score language, for good
reason in my opinion, does not support high amounts of looping because
there are those other languages that do it well. In fact, I have
thought over the past few days about Csound, in the "language" sense,
as somewhat of a client-server model in this way, with other scripting
languages "serving" Csound orchestras and scores. I might write an
article for the Csound Journal if anyone would be interested to hear
more on this subject.

Hope this helps.

Adam

On 4/19/11, Victor Lazzarini  wrote:
> Well, we have been collecting suggestions for a wishlist. You are
> welcome to contribute to it.
> On 19 Apr 2011, at 09:18, Nil Geisweiller wrote:
>
>> On Tue, Apr 19, 2011 at 11:04 AM, Victor Lazzarini
>>  wrote:
>>> And possibly the use of third-party tools would become more
>>> unwieldy. The
>>> thing about Csound's score language is that it is simple and
>>> any program can spill it out. Since there are lots of good scripting
>>> languages out there, I don't think we need to reinvent the wheel.
>>
>> hmmm, not reinventing the wheel, but it would not cost much in the
>> score language complexity to have a bit larger set of operators. Since
>> the score language handles loops it can already do a lot of stuff.
>>
>> Nil
>>
>>>
>>> Victor
>>>
>>> On 19 Apr 2011, at 08:27, Nil Geisweiller wrote:
>>>
>>>> I think it'd be nice if the scoring language was slightly more
>>>> expressive, that way there would be no need for third-party
>>>> languages
>>>> (like Python) to generate sophisticated score.
>>>
>>> Dr Victor Lazzarini
>>> Senior Lecturer
>>> Dept. of Music
>>> NUI Maynooth Ireland
>>> tel.: +353 1 708 3545
>>> Victor dot Lazzarini AT nuim dot ie
>>>
>>>
>>>
>>>
>>>
>>> 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"
>>
>
> Dr Victor Lazzarini
> Senior Lecturer
> Dept. of Music
> NUI Maynooth Ireland
> tel.: +353 1 708 3545
> Victor dot Lazzarini AT nuim dot ie
>
>
>
>
>
> 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-04-19 14:54
FromJustin Glenn Smith
SubjectRe: [Csnd] Using user defined operators in score
For larger projects I treat my main programming language as a compiler, the csound syntax as an IR, and the csound command as a postprocessor for the IR that the compiler generates. Sadly, in this analogy, the VM and assembled bytecode are deeply intertangled with the postprocessor in a single execution context. And as such the bytecode and VM seem to be unavailable as separate entities for examination, reuse, or tweaking.

I have considered the desirability (but not yet looked very close at the *feasability*) of breaking csound down into a series of independent executables: the sorter that would simplify and order a block of score syntax and generate a "canonical score representation", the instrument compiler which would turn a given instrument into a directed graph of the opcodes, and the actual csound VM which would load directed graphs describing ways to process events, and simplified scores describing those events, and output audio. The graphs would essentially be plugins, and the simplified scores would be similarly modular and ready to immediately be loaded into memory without further processing (except of course each would have to be sorted and intermixed with already loaded instruments and events as 
 appropriate). If you just ran "csound" as a command, it would run each of these in the proper order and behave just like csound does now. It does something kind of like this already with the
 .srt files that can be optionally saved, right?

It's only to be expected that a DSL written and maintained by people mainly interested in the target domain, moreso than the domain of language design, wouldn't be state of the art. I would include myself in that category of people mainly interested in the target domain of music, with a passing interest in compiler and language design. But I am confident that we would have quite a bit to gain if we got a pragmatically minded PL design expert to give some suggestions for simplifying and modularizing csound for version 6. In my (admittedly non-expert) opinion this modularization I suggested would be the best way to implement the "dynamically loading new instrument definitions" request that some folks here have made.

The client/server metaphor almost works, except you need to restart the client after making trivial requests (in that way maybe it is like IE in terms of client robustness ;)).

Adam Puckett wrote:
> Nil,
> 
> Back to your original question, you can also do the following, which
> breaks down the math a little:
> 
> i1 0 1 10000 [~*(8-3)+3]
> 
> And regarding scripting languages, as Victor stated earlier, the score
> is simple so that any program (not to mention language, e.g. Python)
> can generate it. I am someone who uses Python to generate massive
> scores to create pop music in Csound, which mostly involves using
> loops and conditional statements. The Csound score language, for good
> reason in my opinion, does not support high amounts of looping because
> there are those other languages that do it well. In fact, I have
> thought over the past few days about Csound, in the "language" sense,
> as somewhat of a client-server model in this way, with other scripting
> languages "serving" Csound orchestras and scores. I might write an
> article for the Csound Journal if anyone would be interested to hear
> more on this subject.
> 
> Hope this helps.
> 
> Adam
> 
> On 4/19/11, Victor Lazzarini  wrote:
>> Well, we have been collecting suggestions for a wishlist. You are
>> welcome to contribute to it.
>> On 19 Apr 2011, at 09:18, Nil Geisweiller wrote:
>>
>>> On Tue, Apr 19, 2011 at 11:04 AM, Victor Lazzarini
>>>  wrote:
>>>> And possibly the use of third-party tools would become more
>>>> unwieldy. The
>>>> thing about Csound's score language is that it is simple and
>>>> any program can spill it out. Since there are lots of good scripting
>>>> languages out there, I don't think we need to reinvent the wheel.
>>> hmmm, not reinventing the wheel, but it would not cost much in the
>>> score language complexity to have a bit larger set of operators. Since
>>> the score language handles loops it can already do a lot of stuff.
>>>
>>> Nil
>>>
>>>> Victor
>>>>
>>>> On 19 Apr 2011, at 08:27, Nil Geisweiller wrote:
>>>>
>>>>> I think it'd be nice if the scoring language was slightly more
>>>>> expressive, that way there would be no need for third-party
>>>>> languages
>>>>> (like Python) to generate sophisticated score.
>>>> Dr Victor Lazzarini
>>>> Senior Lecturer
>>>> Dept. of Music
>>>> NUI Maynooth Ireland
>>>> tel.: +353 1 708 3545
>>>> Victor dot Lazzarini AT nuim dot ie
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> 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"
>>>
>> Dr Victor Lazzarini
>> Senior Lecturer
>> Dept. of Music
>> NUI Maynooth Ireland
>> tel.: +353 1 708 3545
>> Victor dot Lazzarini AT nuim dot ie
>>
>>
>>
>>
>>
>> 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-04-19 15:07
FromAdam Puckett
SubjectRe: [Csnd] Using user defined operators in score
Justin,

When I was talking about the client/server model, I was thinking
specifically of JavaScript-enabled Web browsers - sorry I wasn't clear
about that before. What I mean is:

To me the orchestra is in a sense a programming language. Opcodes like
schedule and event_i are to me like using JavaScript. On the other
hand, using Python to generate i-events in the score is like using
server-side scripting languages. I know it's not an exact comparison,
but I was thinking from the UI point of view.

Adam



On 4/19/11, Justin Glenn Smith  wrote:
> For larger projects I treat my main programming language as a compiler, the
> csound syntax as an IR, and the csound command as a postprocessor for the IR
> that the compiler generates. Sadly, in this analogy, the VM and assembled
> bytecode are deeply intertangled with the postprocessor in a single
> execution context. And as such the bytecode and VM seem to be unavailable as
> separate entities for examination, reuse, or tweaking.
>
> I have considered the desirability (but not yet looked very close at the
> *feasability*) of breaking csound down into a series of independent
> executables: the sorter that would simplify and order a block of score
> syntax and generate a "canonical score representation", the instrument
> compiler which would turn a given instrument into a directed graph of the
> opcodes, and the actual csound VM which would load directed graphs
> describing ways to process events, and simplified scores describing those
> events, and output audio. The graphs would essentially be plugins, and the
> simplified scores would be similarly modular and ready to immediately be
> loaded into memory without further processing (except of course each would
> have to be sorted and intermixed with already loaded instruments and events
> as appropriate). If you just ran "csound" as a command, it would run each of
> these in the proper order and behave just like csound does now. It does
> something kind of like this already with the
>  .srt files that can be optionally saved, right?
>
> It's only to be expected that a DSL written and maintained by people mainly
> interested in the target domain, moreso than the domain of language design,
> wouldn't be state of the art. I would include myself in that category of
> people mainly interested in the target domain of music, with a passing
> interest in compiler and language design. But I am confident that we would
> have quite a bit to gain if we got a pragmatically minded PL design expert
> to give some suggestions for simplifying and modularizing csound for version
> 6. In my (admittedly non-expert) opinion this modularization I suggested
> would be the best way to implement the "dynamically loading new instrument
> definitions" request that some folks here have made.
>
> The client/server metaphor almost works, except you need to restart the
> client after making trivial requests (in that way maybe it is like IE in
> terms of client robustness ;)).
>
> Adam Puckett wrote:
>> Nil,
>>
>> Back to your original question, you can also do the following, which
>> breaks down the math a little:
>>
>> i1 0 1 10000 [~*(8-3)+3]
>>
>> And regarding scripting languages, as Victor stated earlier, the score
>> is simple so that any program (not to mention language, e.g. Python)
>> can generate it. I am someone who uses Python to generate massive
>> scores to create pop music in Csound, which mostly involves using
>> loops and conditional statements. The Csound score language, for good
>> reason in my opinion, does not support high amounts of looping because
>> there are those other languages that do it well. In fact, I have
>> thought over the past few days about Csound, in the "language" sense,
>> as somewhat of a client-server model in this way, with other scripting
>> languages "serving" Csound orchestras and scores. I might write an
>> article for the Csound Journal if anyone would be interested to hear
>> more on this subject.
>>
>> Hope this helps.
>>
>> Adam
>>
>> On 4/19/11, Victor Lazzarini  wrote:
>>> Well, we have been collecting suggestions for a wishlist. You are
>>> welcome to contribute to it.
>>> On 19 Apr 2011, at 09:18, Nil Geisweiller wrote:
>>>
>>>> On Tue, Apr 19, 2011 at 11:04 AM, Victor Lazzarini
>>>>  wrote:
>>>>> And possibly the use of third-party tools would become more
>>>>> unwieldy. The
>>>>> thing about Csound's score language is that it is simple and
>>>>> any program can spill it out. Since there are lots of good scripting
>>>>> languages out there, I don't think we need to reinvent the wheel.
>>>> hmmm, not reinventing the wheel, but it would not cost much in the
>>>> score language complexity to have a bit larger set of operators. Since
>>>> the score language handles loops it can already do a lot of stuff.
>>>>
>>>> Nil
>>>>
>>>>> Victor
>>>>>
>>>>> On 19 Apr 2011, at 08:27, Nil Geisweiller wrote:
>>>>>
>>>>>> I think it'd be nice if the scoring language was slightly more
>>>>>> expressive, that way there would be no need for third-party
>>>>>> languages
>>>>>> (like Python) to generate sophisticated score.
>>>>> Dr Victor Lazzarini
>>>>> Senior Lecturer
>>>>> Dept. of Music
>>>>> NUI Maynooth Ireland
>>>>> tel.: +353 1 708 3545
>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> 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"
>>>>
>>> Dr Victor Lazzarini
>>> Senior Lecturer
>>> Dept. of Music
>>> NUI Maynooth Ireland
>>> tel.: +353 1 708 3545
>>> Victor dot Lazzarini AT nuim dot ie
>>>
>>>
>>>
>>>
>>>
>>> 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"
>
>


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-04-19 15:23
FromJustin Glenn Smith
SubjectRe: [Csnd] Using user defined operators in score
That's how I took it, thus the comparison to IEs notorious unreliability (if orchestra code is like javascript, then we are using a browser that needs to be restarted for every web page).

Adam Puckett wrote:
> Justin,
> 
> When I was talking about the client/server model, I was thinking
> specifically of JavaScript-enabled Web browsers - sorry I wasn't clear
> about that before. What I mean is:
> 
> To me the orchestra is in a sense a programming language. Opcodes like
> schedule and event_i are to me like using JavaScript. On the other
> hand, using Python to generate i-events in the score is like using
> server-side scripting languages. I know it's not an exact comparison,
> but I was thinking from the UI point of view.
> 
> Adam
> 
> 
> 
> On 4/19/11, Justin Glenn Smith  wrote:
>> For larger projects I treat my main programming language as a compiler, the
>> csound syntax as an IR, and the csound command as a postprocessor for the IR
>> that the compiler generates. Sadly, in this analogy, the VM and assembled
>> bytecode are deeply intertangled with the postprocessor in a single
>> execution context. And as such the bytecode and VM seem to be unavailable as
>> separate entities for examination, reuse, or tweaking.
>>
>> I have considered the desirability (but not yet looked very close at the
>> *feasability*) of breaking csound down into a series of independent
>> executables: the sorter that would simplify and order a block of score
>> syntax and generate a "canonical score representation", the instrument
>> compiler which would turn a given instrument into a directed graph of the
>> opcodes, and the actual csound VM which would load directed graphs
>> describing ways to process events, and simplified scores describing those
>> events, and output audio. The graphs would essentially be plugins, and the
>> simplified scores would be similarly modular and ready to immediately be
>> loaded into memory without further processing (except of course each would
>> have to be sorted and intermixed with already loaded instruments and events
>> as appropriate). If you just ran "csound" as a command, it would run each of
>> these in the proper order and behave just like csound does now. It does
>> something kind of like this already with the
>>  .srt files that can be optionally saved, right?
>>
>> It's only to be expected that a DSL written and maintained by people mainly
>> interested in the target domain, moreso than the domain of language design,
>> wouldn't be state of the art. I would include myself in that category of
>> people mainly interested in the target domain of music, with a passing
>> interest in compiler and language design. But I am confident that we would
>> have quite a bit to gain if we got a pragmatically minded PL design expert
>> to give some suggestions for simplifying and modularizing csound for version
>> 6. In my (admittedly non-expert) opinion this modularization I suggested
>> would be the best way to implement the "dynamically loading new instrument
>> definitions" request that some folks here have made.
>>
>> The client/server metaphor almost works, except you need to restart the
>> client after making trivial requests (in that way maybe it is like IE in
>> terms of client robustness ;)).
>>
>> Adam Puckett wrote:
>>> Nil,
>>>
>>> Back to your original question, you can also do the following, which
>>> breaks down the math a little:
>>>
>>> i1 0 1 10000 [~*(8-3)+3]
>>>
>>> And regarding scripting languages, as Victor stated earlier, the score
>>> is simple so that any program (not to mention language, e.g. Python)
>>> can generate it. I am someone who uses Python to generate massive
>>> scores to create pop music in Csound, which mostly involves using
>>> loops and conditional statements. The Csound score language, for good
>>> reason in my opinion, does not support high amounts of looping because
>>> there are those other languages that do it well. In fact, I have
>>> thought over the past few days about Csound, in the "language" sense,
>>> as somewhat of a client-server model in this way, with other scripting
>>> languages "serving" Csound orchestras and scores. I might write an
>>> article for the Csound Journal if anyone would be interested to hear
>>> more on this subject.
>>>
>>> Hope this helps.
>>>
>>> Adam
>>>
>>> On 4/19/11, Victor Lazzarini  wrote:
>>>> Well, we have been collecting suggestions for a wishlist. You are
>>>> welcome to contribute to it.
>>>> On 19 Apr 2011, at 09:18, Nil Geisweiller wrote:
>>>>
>>>>> On Tue, Apr 19, 2011 at 11:04 AM, Victor Lazzarini
>>>>>  wrote:
>>>>>> And possibly the use of third-party tools would become more
>>>>>> unwieldy. The
>>>>>> thing about Csound's score language is that it is simple and
>>>>>> any program can spill it out. Since there are lots of good scripting
>>>>>> languages out there, I don't think we need to reinvent the wheel.
>>>>> hmmm, not reinventing the wheel, but it would not cost much in the
>>>>> score language complexity to have a bit larger set of operators. Since
>>>>> the score language handles loops it can already do a lot of stuff.
>>>>>
>>>>> Nil
>>>>>
>>>>>> Victor
>>>>>>
>>>>>> On 19 Apr 2011, at 08:27, Nil Geisweiller wrote:
>>>>>>
>>>>>>> I think it'd be nice if the scoring language was slightly more
>>>>>>> expressive, that way there would be no need for third-party
>>>>>>> languages
>>>>>>> (like Python) to generate sophisticated score.
>>>>>> Dr Victor Lazzarini
>>>>>> Senior Lecturer
>>>>>> Dept. of Music
>>>>>> NUI Maynooth Ireland
>>>>>> tel.: +353 1 708 3545
>>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> 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"
>>>>>
>>>> Dr Victor Lazzarini
>>>> Senior Lecturer
>>>> Dept. of Music
>>>> NUI Maynooth Ireland
>>>> tel.: +353 1 708 3545
>>>> Victor dot Lazzarini AT nuim dot ie
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> 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"
>>
>>
> 
> 
> 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-04-19 15:32
FromAdam Puckett
SubjectRe: [Csnd] Using user defined operators in score
I didn't consider hyperlinks in my original comparison -.-

Actually I was thinking of pages with no links. And here's another
thing: the orchestra is like the language the browser is written in,
so opcodes like schedule, which trigger instrument events, "script"
the score, which is like the HTML the pages are written in. It's like
the Internet speaks UDP instead of TCP.;)

On that note, I am also interested somewhat in sockets programming. Is
UDP/IP possible?

Adam

On 4/19/11, Justin Glenn Smith  wrote:
> That's how I took it, thus the comparison to IEs notorious unreliability (if
> orchestra code is like javascript, then we are using a browser that needs to
> be restarted for every web page).
>
> Adam Puckett wrote:
>> Justin,
>>
>> When I was talking about the client/server model, I was thinking
>> specifically of JavaScript-enabled Web browsers - sorry I wasn't clear
>> about that before. What I mean is:
>>
>> To me the orchestra is in a sense a programming language. Opcodes like
>> schedule and event_i are to me like using JavaScript. On the other
>> hand, using Python to generate i-events in the score is like using
>> server-side scripting languages. I know it's not an exact comparison,
>> but I was thinking from the UI point of view.
>>
>> Adam
>>
>>
>>
>> On 4/19/11, Justin Glenn Smith  wrote:
>>> For larger projects I treat my main programming language as a compiler,
>>> the
>>> csound syntax as an IR, and the csound command as a postprocessor for the
>>> IR
>>> that the compiler generates. Sadly, in this analogy, the VM and assembled
>>> bytecode are deeply intertangled with the postprocessor in a single
>>> execution context. And as such the bytecode and VM seem to be unavailable
>>> as
>>> separate entities for examination, reuse, or tweaking.
>>>
>>> I have considered the desirability (but not yet looked very close at the
>>> *feasability*) of breaking csound down into a series of independent
>>> executables: the sorter that would simplify and order a block of score
>>> syntax and generate a "canonical score representation", the instrument
>>> compiler which would turn a given instrument into a directed graph of the
>>> opcodes, and the actual csound VM which would load directed graphs
>>> describing ways to process events, and simplified scores describing those
>>> events, and output audio. The graphs would essentially be plugins, and
>>> the
>>> simplified scores would be similarly modular and ready to immediately be
>>> loaded into memory without further processing (except of course each
>>> would
>>> have to be sorted and intermixed with already loaded instruments and
>>> events
>>> as appropriate). If you just ran "csound" as a command, it would run each
>>> of
>>> these in the proper order and behave just like csound does now. It does
>>> something kind of like this already with the
>>>  .srt files that can be optionally saved, right?
>>>
>>> It's only to be expected that a DSL written and maintained by people
>>> mainly
>>> interested in the target domain, moreso than the domain of language
>>> design,
>>> wouldn't be state of the art. I would include myself in that category of
>>> people mainly interested in the target domain of music, with a passing
>>> interest in compiler and language design. But I am confident that we
>>> would
>>> have quite a bit to gain if we got a pragmatically minded PL design
>>> expert
>>> to give some suggestions for simplifying and modularizing csound for
>>> version
>>> 6. In my (admittedly non-expert) opinion this modularization I suggested
>>> would be the best way to implement the "dynamically loading new
>>> instrument
>>> definitions" request that some folks here have made.
>>>
>>> The client/server metaphor almost works, except you need to restart the
>>> client after making trivial requests (in that way maybe it is like IE in
>>> terms of client robustness ;)).
>>>
>>> Adam Puckett wrote:
>>>> Nil,
>>>>
>>>> Back to your original question, you can also do the following, which
>>>> breaks down the math a little:
>>>>
>>>> i1 0 1 10000 [~*(8-3)+3]
>>>>
>>>> And regarding scripting languages, as Victor stated earlier, the score
>>>> is simple so that any program (not to mention language, e.g. Python)
>>>> can generate it. I am someone who uses Python to generate massive
>>>> scores to create pop music in Csound, which mostly involves using
>>>> loops and conditional statements. The Csound score language, for good
>>>> reason in my opinion, does not support high amounts of looping because
>>>> there are those other languages that do it well. In fact, I have
>>>> thought over the past few days about Csound, in the "language" sense,
>>>> as somewhat of a client-server model in this way, with other scripting
>>>> languages "serving" Csound orchestras and scores. I might write an
>>>> article for the Csound Journal if anyone would be interested to hear
>>>> more on this subject.
>>>>
>>>> Hope this helps.
>>>>
>>>> Adam
>>>>
>>>> On 4/19/11, Victor Lazzarini  wrote:
>>>>> Well, we have been collecting suggestions for a wishlist. You are
>>>>> welcome to contribute to it.
>>>>> On 19 Apr 2011, at 09:18, Nil Geisweiller wrote:
>>>>>
>>>>>> On Tue, Apr 19, 2011 at 11:04 AM, Victor Lazzarini
>>>>>>  wrote:
>>>>>>> And possibly the use of third-party tools would become more
>>>>>>> unwieldy. The
>>>>>>> thing about Csound's score language is that it is simple and
>>>>>>> any program can spill it out. Since there are lots of good scripting
>>>>>>> languages out there, I don't think we need to reinvent the wheel.
>>>>>> hmmm, not reinventing the wheel, but it would not cost much in the
>>>>>> score language complexity to have a bit larger set of operators. Since
>>>>>> the score language handles loops it can already do a lot of stuff.
>>>>>>
>>>>>> Nil
>>>>>>
>>>>>>> Victor
>>>>>>>
>>>>>>> On 19 Apr 2011, at 08:27, Nil Geisweiller wrote:
>>>>>>>
>>>>>>>> I think it'd be nice if the scoring language was slightly more
>>>>>>>> expressive, that way there would be no need for third-party
>>>>>>>> languages
>>>>>>>> (like Python) to generate sophisticated score.
>>>>>>> Dr Victor Lazzarini
>>>>>>> Senior Lecturer
>>>>>>> Dept. of Music
>>>>>>> NUI Maynooth Ireland
>>>>>>> tel.: +353 1 708 3545
>>>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> 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"
>>>>>>
>>>>> Dr Victor Lazzarini
>>>>> Senior Lecturer
>>>>> Dept. of Music
>>>>> NUI Maynooth Ireland
>>>>> tel.: +353 1 708 3545
>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> 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"
>>>
>>>
>>
>>
>> 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-04-19 15:35
FromAdam Puckett
SubjectRe: [Csnd] Using user defined operators in score
Sorry for double posting. In other words, the orchestra is like C, and
the score is like HTML. Schedule and friends are like the code for the
JS engine etc.

Adam

On 4/19/11, Adam Puckett  wrote:
> I didn't consider hyperlinks in my original comparison -.-
>
> Actually I was thinking of pages with no links. And here's another
> thing: the orchestra is like the language the browser is written in,
> so opcodes like schedule, which trigger instrument events, "script"
> the score, which is like the HTML the pages are written in. It's like
> the Internet speaks UDP instead of TCP.;)
>
> On that note, I am also interested somewhat in sockets programming. Is
> UDP/IP possible?
>
> Adam
>
> On 4/19/11, Justin Glenn Smith  wrote:
>> That's how I took it, thus the comparison to IEs notorious unreliability
>> (if
>> orchestra code is like javascript, then we are using a browser that needs
>> to
>> be restarted for every web page).
>>
>> Adam Puckett wrote:
>>> Justin,
>>>
>>> When I was talking about the client/server model, I was thinking
>>> specifically of JavaScript-enabled Web browsers - sorry I wasn't clear
>>> about that before. What I mean is:
>>>
>>> To me the orchestra is in a sense a programming language. Opcodes like
>>> schedule and event_i are to me like using JavaScript. On the other
>>> hand, using Python to generate i-events in the score is like using
>>> server-side scripting languages. I know it's not an exact comparison,
>>> but I was thinking from the UI point of view.
>>>
>>> Adam
>>>
>>>
>>>
>>> On 4/19/11, Justin Glenn Smith  wrote:
>>>> For larger projects I treat my main programming language as a compiler,
>>>> the
>>>> csound syntax as an IR, and the csound command as a postprocessor for
>>>> the
>>>> IR
>>>> that the compiler generates. Sadly, in this analogy, the VM and
>>>> assembled
>>>> bytecode are deeply intertangled with the postprocessor in a single
>>>> execution context. And as such the bytecode and VM seem to be
>>>> unavailable
>>>> as
>>>> separate entities for examination, reuse, or tweaking.
>>>>
>>>> I have considered the desirability (but not yet looked very close at
>>>> the
>>>> *feasability*) of breaking csound down into a series of independent
>>>> executables: the sorter that would simplify and order a block of score
>>>> syntax and generate a "canonical score representation", the instrument
>>>> compiler which would turn a given instrument into a directed graph of
>>>> the
>>>> opcodes, and the actual csound VM which would load directed graphs
>>>> describing ways to process events, and simplified scores describing
>>>> those
>>>> events, and output audio. The graphs would essentially be plugins, and
>>>> the
>>>> simplified scores would be similarly modular and ready to immediately
>>>> be
>>>> loaded into memory without further processing (except of course each
>>>> would
>>>> have to be sorted and intermixed with already loaded instruments and
>>>> events
>>>> as appropriate). If you just ran "csound" as a command, it would run
>>>> each
>>>> of
>>>> these in the proper order and behave just like csound does now. It does
>>>> something kind of like this already with the
>>>>  .srt files that can be optionally saved, right?
>>>>
>>>> It's only to be expected that a DSL written and maintained by people
>>>> mainly
>>>> interested in the target domain, moreso than the domain of language
>>>> design,
>>>> wouldn't be state of the art. I would include myself in that category
>>>> of
>>>> people mainly interested in the target domain of music, with a passing
>>>> interest in compiler and language design. But I am confident that we
>>>> would
>>>> have quite a bit to gain if we got a pragmatically minded PL design
>>>> expert
>>>> to give some suggestions for simplifying and modularizing csound for
>>>> version
>>>> 6. In my (admittedly non-expert) opinion this modularization I
>>>> suggested
>>>> would be the best way to implement the "dynamically loading new
>>>> instrument
>>>> definitions" request that some folks here have made.
>>>>
>>>> The client/server metaphor almost works, except you need to restart the
>>>> client after making trivial requests (in that way maybe it is like IE
>>>> in
>>>> terms of client robustness ;)).
>>>>
>>>> Adam Puckett wrote:
>>>>> Nil,
>>>>>
>>>>> Back to your original question, you can also do the following, which
>>>>> breaks down the math a little:
>>>>>
>>>>> i1 0 1 10000 [~*(8-3)+3]
>>>>>
>>>>> And regarding scripting languages, as Victor stated earlier, the score
>>>>> is simple so that any program (not to mention language, e.g. Python)
>>>>> can generate it. I am someone who uses Python to generate massive
>>>>> scores to create pop music in Csound, which mostly involves using
>>>>> loops and conditional statements. The Csound score language, for good
>>>>> reason in my opinion, does not support high amounts of looping because
>>>>> there are those other languages that do it well. In fact, I have
>>>>> thought over the past few days about Csound, in the "language" sense,
>>>>> as somewhat of a client-server model in this way, with other scripting
>>>>> languages "serving" Csound orchestras and scores. I might write an
>>>>> article for the Csound Journal if anyone would be interested to hear
>>>>> more on this subject.
>>>>>
>>>>> Hope this helps.
>>>>>
>>>>> Adam
>>>>>
>>>>> On 4/19/11, Victor Lazzarini  wrote:
>>>>>> Well, we have been collecting suggestions for a wishlist. You are
>>>>>> welcome to contribute to it.
>>>>>> On 19 Apr 2011, at 09:18, Nil Geisweiller wrote:
>>>>>>
>>>>>>> On Tue, Apr 19, 2011 at 11:04 AM, Victor Lazzarini
>>>>>>>  wrote:
>>>>>>>> And possibly the use of third-party tools would become more
>>>>>>>> unwieldy. The
>>>>>>>> thing about Csound's score language is that it is simple and
>>>>>>>> any program can spill it out. Since there are lots of good
>>>>>>>> scripting
>>>>>>>> languages out there, I don't think we need to reinvent the wheel.
>>>>>>> hmmm, not reinventing the wheel, but it would not cost much in the
>>>>>>> score language complexity to have a bit larger set of operators.
>>>>>>> Since
>>>>>>> the score language handles loops it can already do a lot of stuff.
>>>>>>>
>>>>>>> Nil
>>>>>>>
>>>>>>>> Victor
>>>>>>>>
>>>>>>>> On 19 Apr 2011, at 08:27, Nil Geisweiller wrote:
>>>>>>>>
>>>>>>>>> I think it'd be nice if the scoring language was slightly more
>>>>>>>>> expressive, that way there would be no need for third-party
>>>>>>>>> languages
>>>>>>>>> (like Python) to generate sophisticated score.
>>>>>>>> Dr Victor Lazzarini
>>>>>>>> Senior Lecturer
>>>>>>>> Dept. of Music
>>>>>>>> NUI Maynooth Ireland
>>>>>>>> tel.: +353 1 708 3545
>>>>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> 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"
>>>>>>>
>>>>>> Dr Victor Lazzarini
>>>>>> Senior Lecturer
>>>>>> Dept. of Music
>>>>>> NUI Maynooth Ireland
>>>>>> tel.: +353 1 708 3545
>>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> 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"
>>>>
>>>>
>>>
>>>
>>> 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-04-19 16:01
FromLouis Cohen
SubjectRe: [Csnd] Using user defined operators in score
I read Nil's email with some interest. He uses the tilde in an  
expression. I was not aware of any Csound programming constructs that  
use this character this way. My csound 5.12 manual doesn't show tilde  
as a legitimate math operator, and the csound compiler rejects it (in  
an instrument.)

Yet Nils suggests that it might be a random number generator?

Can anyone explain this to me?

many thanks!

Lou Cohen

On Apr 19, 2011, at 12:06 AM, Nil Geisweiller wrote:

> I noticed that I cannot do the following
>
> i1 0 1 10000 [3+int(5*~)]
>
> where p5 of instr 1 takes a pitch class in argument.



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-04-19 16:08
FromAdam Puckett
SubjectRe: [Csnd] Using user defined operators in score
Lou,

Yes, ~ is a random number generator that can be used in the score
inside brackets [ ...]. For example:

i1 0 1 [(~*(12-3)+3)+((~*11)/100)] ; random piano pitch, covers most
of the keyboard

A simpler example is:

i1 0 1 [~]

where ~ means "generate a random number between 0 and 1"

Hope this helps.

Adam

P.S.: Is my random pch example correct? Please give feedback.

On 4/19/11, Louis Cohen  wrote:
> I read Nil's email with some interest. He uses the tilde in an
> expression. I was not aware of any Csound programming constructs that
> use this character this way. My csound 5.12 manual doesn't show tilde
> as a legitimate math operator, and the csound compiler rejects it (in
> an instrument.)
>
> Yet Nils suggests that it might be a random number generator?
>
> Can anyone explain this to me?
>
> many thanks!
>
> Lou Cohen
>
> On Apr 19, 2011, at 12:06 AM, Nil Geisweiller wrote:
>
>> I noticed that I cannot do the following
>>
>> i1 0 1 10000 [3+int(5*~)]
>>
>> where p5 of instr 1 takes a pitch class in argument.
>
>
>
> 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-04-19 16:10
FromJustin Smith
SubjectRe: [Csnd] Using user defined operators in score

In the score syntax, it generates random number between 0 and 1
----- Original message -----
> I read Nil's email with some interest. He uses the tilde in an 
> expression. I was not aware of any Csound programming constructs that 
> use this character this way. My csound 5.12 manual doesn't show tilde 
> as a legitimate math operator, and the csound compiler rejects it (in 
> an instrument.)
>
> Yet Nils suggests that it might be a random number generator?
>
> Can anyone explain this to me?
>
> many thanks!
>
> Lou Cohen
>
> On Apr 19, 2011, at 12:06 AM, Nil Geisweiller wrote:
>
> > I noticed that I cannot do the following
> >
> > i1 0 1 10000 [3+int(5*~)]
> >
> > where p5 of instr 1 takes a pitch class in argument.
>
>
>
> 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-04-19 16:41
FromLouis Cohen
SubjectRe: [Csnd] Using user defined operators in score
Thanks! one lives and learns. I was unaware of the entire area of  
expressions in score statements until just now.

best,
Lou

On Apr 19, 2011, at 11:08 AM, Adam Puckett wrote:

> Lou,
>
> Yes, ~ is a random number generator that can be used in the score
> inside brackets [ ...]. For example:
>
> i1 0 1 [(~*(12-3)+3)+((~*11)/100)] ; random piano pitch, covers most
> of the keyboard
>
> A simpler example is:
>
> i1 0 1 [~]
>
> where ~ means "generate a random number between 0 and 1"
>
> Hope this helps.
>
> Adam
>
> P.S.: Is my random pch example correct? Please give feedback.
>
> On 4/19/11, Louis Cohen  wrote:
>> I read Nil's email with some interest. He uses the tilde in an
>> expression. I was not aware of any Csound programming constructs that
>> use this character this way. My csound 5.12 manual doesn't show tilde
>> as a legitimate math operator, and the csound compiler rejects it (in
>> an instrument.)
>>
>> Yet Nils suggests that it might be a random number generator?
>>
>> Can anyone explain this to me?
>>
>> many thanks!
>>
>> Lou Cohen
>>
>> On Apr 19, 2011, at 12:06 AM, Nil Geisweiller wrote:
>>
>>> I noticed that I cannot do the following
>>>
>>> i1 0 1 10000 [3+int(5*~)]
>>>
>>> where p5 of instr 1 takes a pitch class in argument.
>>
>>
>>
>> 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-04-19 17:10
FromJustin Smith
SubjectRe: [Csnd] Using user defined operators in score

----- Original message -----
> Lou,
>
> Yes, ~ is a random number generator that can be used in the score
> inside brackets [ ...]. For example:
>
> i1 0 1 [(~*(12-3)+3)+((~*11)/100)] ; random piano pitch, covers most
> of the keyboard
>
> A simpler example is:
>
> i1 0 1 [~]
>
> where ~ means "generate a random number between 0 and 1"
>
> Hope this helps.
>
> Adam
>
> P.S.: Is my random pch example correct? Please give feedback.

It adds a random float between 3 and 12 to a random float between 0 and .11. I think that if the number between 3 and 12 were an integer and the number between 0 and .11 was truncated to two decimal places, it would do what you want. But neither of these are the case.

>
> On 4/19/11, Louis Cohen <loucohen@jolc.net> wrote:
> > I read Nil's email with some interest. He uses the tilde in an
> > expression. I was not aware of any Csound programming constructs that
> > use this character this way. My csound 5.12 manual doesn't show tilde
> > as a legitimate math operator, and the csound compiler rejects it (in
> > an instrument.)
> >
> > Yet Nils suggests that it might be a random number generator?
> >
> > Can anyone explain this to me?
> >
> > many thanks!
> >
> > Lou Cohen
> >
> > On Apr 19, 2011, at 12:06 AM, Nil Geisweiller wrote:
> >
> > > I noticed that I cannot do the following
> > >
> > > i1 0 1 10000 [3+int(5*~)]
> > >
> > > where p5 of instr 1 takes a pitch class in argument.
> >
> >
> >
> > 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-04-19 17:14
FromNil Geisweiller
SubjectRe: [Csnd] Using user defined operators in score
On Tue, Apr 19, 2011 at 7:10 PM, Justin Smith  wrote:
> ----- Original message -----
>> Lou,
>>
>> Yes, ~ is a random number generator that can be used in the score
>> inside brackets [ ...]. For example:
>>
>> i1 0 1 [(~*(12-3)+3)+((~*11)/100)] ; random piano pitch, covers most
>> of the keyboard
>>
>> A simpler example is:
>>
>> i1 0 1 [~]
>>
>> where ~ means "generate a random number between 0 and 1"
>>
>> Hope this helps.
>>
>> Adam
>>
>> P.S.: Is my random pch example correct? Please give feedback.
>
> It adds a random float between 3 and 12 to a random float between 0 and .11.
> I think that if the number between 3 and 12 were an integer and the number
> between 0 and .11 was truncated to two decimal places, it would do what you
> want. But neither of these are the case.

I don't have time to read all follow ups and test them on Csound right
now, but I just noticed there

http://www.csounds.com/manual/html/ScoreEval.html

that "These [bitwise] operators round their operands to the nearest
(long) integer before evaluating"

so

[(10*~) | 0]

might do the job at choosing a random integer in [0..9], right?

Nil

>
>>
>> On 4/19/11, Louis Cohen  wrote:
>> > I read Nil's email with some interest. He uses the tilde in an
>> > expression. I was not aware of any Csound programming constructs that
>> > use this character this way. My csound 5.12 manual doesn't show tilde
>> > as a legitimate math operator, and the csound compiler rejects it (in
>> > an instrument.)
>> >
>> > Yet Nils suggests that it might be a random number generator?
>> >
>> > Can anyone explain this to me?
>> >
>> > many thanks!
>> >
>> > Lou Cohen
>> >
>> > On Apr 19, 2011, at 12:06 AM, Nil Geisweiller wrote:
>> >
>> > > I noticed that I cannot do the following
>> > >
>> > > i1 0 1 10000 [3+int(5*~)]
>> > >
>> > > where p5 of instr 1 takes a pitch class in argument.
>> >
>> >
>> >
>> > 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-04-19 17:17
FromAdam Puckett
SubjectRe: [Csnd] Using user defined operators in score
Thanks for the tip, Justin. So, moving this part of the code from
"HTML" to "C", it seems like I would need to write this instead:

ioct = int(rnd(12-3)+3)
ipch = (rnd(11)/100)
Sval sprintf "%.2f", ipch
ipch strtod Sval
icps = cpspch(ioct+ipch)

Adam

On 4/19/11, Justin Smith  wrote:
> ----- Original message -----
>> Lou,
>>
>> Yes, ~ is a random number generator that can be used in the score
>> inside brackets [ ...]. For example:
>>
>> i1 0 1 [(~*(12-3)+3)+((~*11)/100)] ; random piano pitch, covers most
>> of the keyboard
>>
>> A simpler example is:
>>
>> i1 0 1 [~]
>>
>> where ~ means "generate a random number between 0 and 1"
>>
>> Hope this helps.
>>
>> Adam
>>
>> P.S.: Is my random pch example correct? Please give feedback.
>
> It adds a random float between 3 and 12 to a random float between 0 and .11.
> I think that if the number between 3 and 12 were an integer and the number
> between 0 and .11 was truncated to two decimal places, it would do what you
> want. But neither of these are the case.
>
>>
>> On 4/19/11, Louis Cohen  wrote:
>> > I read Nil's email with some interest. He uses the tilde in an
>> > expression. I was not aware of any Csound programming constructs that
>> > use this character this way. My csound 5.12 manual doesn't show tilde
>> > as a legitimate math operator, and the csound compiler rejects it (in
>> > an instrument.)
>> >
>> > Yet Nils suggests that it might be a random number generator?
>> >
>> > Can anyone explain this to me?
>> >
>> > many thanks!
>> >
>> > Lou Cohen
>> >
>> > On Apr 19, 2011, at 12:06 AM, Nil Geisweiller wrote:
>> >
>> > > I noticed that I cannot do the following
>> > >
>> > > i1 0 1 10000 [3+int(5*~)]
>> > >
>> > > where p5 of instr 1 takes a pitch class in argument.
>> >
>> >
>> >
>> > 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"
>
>


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-04-19 17:38
FromJustin Smith
SubjectRe: [Csnd] Using user defined operators in score

Yeah, that would do it. Though converting to a string and then immediately back again is often intuitive, it is a pet peeve of mine. The following will do the same thing, but with fewer lines of code, an order of magnitude fewer CPU cycles and no dynamic memory allocation needed:

ioct = int(rnd(12-3)+3)
ipch = int(rnd 11)/100
icps = cpspch(ioct+ipch)

also, IIRC from stepping through csound patches in gdb, csound does not do any constant time folding (it definitely does not do any of the other standard optimizations), so it is good to be in the habit of putting things in a simplified form (ie. replacing rnd(12-3) with rnd(9) - the one example is trivial, but the little things add up fast when you are not using an optimizing compiler).

----- Original message -----
> Thanks for the tip, Justin. So, moving this part of the code from
> "HTML" to "C", it seems like I would need to write this instead:
>
> ioct = int(rnd(12-3)+3)
> ipch = (rnd(11)/100)
> Sval sprintf "%.2f", ipch
> ipch strtod Sval
> icps = cpspch(ioct+ipch)
>
> Adam
>
> On 4/19/11, Justin Smith <noisesmith@gmail.com> wrote:
> > ----- Original message -----
> > > Lou,
> > >
> > > Yes, ~ is a random number generator that can be used in the score
> > > inside brackets [ ...]. For example:
> > >
> > > i1 0 1 [(~*(12-3)+3)+((~*11)/100)] ; random piano pitch, covers most
> > > of the keyboard
> > >
> > > A simpler example is:
> > >
> > > i1 0 1 [~]
> > >
> > > where ~ means "generate a random number between 0 and 1"
> > >
> > > Hope this helps.
> > >
> > > Adam
> > >
> > > P.S.: Is my random pch example correct? Please give feedback.
> >
> > It adds a random float between 3 and 12 to a random float between 0
> > and .11. I think that if the number between 3 and 12 were an integer
> > and the number between 0 and .11 was truncated to two decimal places,
> > it would do what you want. But neither of these are the case.
> >
> > >
> > > On 4/19/11, Louis Cohen <loucohen@jolc.net> wrote:
> > > > I read Nil's email with some interest. He uses the tilde in an
> > > > expression. I was not aware of any Csound programming constructs
> > > > that use this character this way. My csound 5.12 manual doesn't
> > > > show tilde as a legitimate math operator, and the csound compiler
> > > > rejects it (in an instrument.)
> > > >
> > > > Yet Nils suggests that it might be a random number generator?
> > > >
> > > > Can anyone explain this to me?
> > > >
> > > > many thanks!
> > > >
> > > > Lou Cohen
> > > >
> > > > On Apr 19, 2011, at 12:06 AM, Nil Geisweiller wrote:
> > > >
> > > > > I noticed that I cannot do the following
> > > > >
> > > > > i1 0 1 10000 [3+int(5*~)]
> > > > >
> > > > > where p5 of instr 1 takes a pitch class in argument.
> > > >
> > > >
> > > >
> > > > 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"
> >
> >
>
>
> 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-04-19 17:40
FromAdam Puckett
SubjectRe: [Csnd] Using user defined operators in score
With this in mind, how could score generators such as Jacob Joaquin's
dseq be better optimized?

On 4/19/11, Justin Smith  wrote:
> Yeah, that would do it. Though converting to a string and then immediately
> back again is often intuitive, it is a pet peeve of mine. The following will
> do the same thing, but with fewer lines of code, an order of magnitude fewer
> CPU cycles and no dynamic memory allocation needed:
>
> ioct = int(rnd(12-3)+3)
> ipch = int(rnd 11)/100
> icps = cpspch(ioct+ipch)
>
> also, IIRC from stepping through csound patches in gdb, csound does not do
> any constant time folding (it definitely does not do any of the other
> standard optimizations), so it is good to be in the habit of putting things
> in a simplified form (ie. replacing rnd(12-3) with rnd(9) - the one example
> is trivial, but the little things add up fast when you are not using an
> optimizing compiler).
>
> ----- Original message -----
>> Thanks for the tip, Justin. So, moving this part of the code from
>> "HTML" to "C", it seems like I would need to write this instead:
>>
>> ioct = int(rnd(12-3)+3)
>> ipch = (rnd(11)/100)
>> Sval sprintf "%.2f", ipch
>> ipch strtod Sval
>> icps = cpspch(ioct+ipch)
>>
>> Adam
>>
>> On 4/19/11, Justin Smith  wrote:
>> > ----- Original message -----
>> > > Lou,
>> > >
>> > > Yes, ~ is a random number generator that can be used in the score
>> > > inside brackets [ ...]. For example:
>> > >
>> > > i1 0 1 [(~*(12-3)+3)+((~*11)/100)] ; random piano pitch, covers most
>> > > of the keyboard
>> > >
>> > > A simpler example is:
>> > >
>> > > i1 0 1 [~]
>> > >
>> > > where ~ means "generate a random number between 0 and 1"
>> > >
>> > > Hope this helps.
>> > >
>> > > Adam
>> > >
>> > > P.S.: Is my random pch example correct? Please give feedback.
>> >
>> > It adds a random float between 3 and 12 to a random float between 0
>> > and .11. I think that if the number between 3 and 12 were an integer
>> > and the number between 0 and .11 was truncated to two decimal places,
>> > it would do what you want. But neither of these are the case.
>> >
>> > >
>> > > On 4/19/11, Louis Cohen  wrote:
>> > > > I read Nil's email with some interest. He uses the tilde in an
>> > > > expression. I was not aware of any Csound programming constructs
>> > > > that use this character this way. My csound 5.12 manual doesn't
>> > > > show tilde as a legitimate math operator, and the csound compiler
>> > > > rejects it (in an instrument.)
>> > > >
>> > > > Yet Nils suggests that it might be a random number generator?
>> > > >
>> > > > Can anyone explain this to me?
>> > > >
>> > > > many thanks!
>> > > >
>> > > > Lou Cohen
>> > > >
>> > > > On Apr 19, 2011, at 12:06 AM, Nil Geisweiller wrote:
>> > > >
>> > > > > I noticed that I cannot do the following
>> > > > >
>> > > > > i1 0 1 10000 [3+int(5*~)]
>> > > > >
>> > > > > where p5 of instr 1 takes a pitch class in argument.
>> > > >
>> > > >
>> > > >
>> > > > 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"
>> >
>> >
>>
>>
>> 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-04-19 20:21
FromNil Geisweiller
SubjectRe: [Csnd] Using user defined operators in score
> now, but I just noticed there
>
> http://www.csounds.com/manual/html/ScoreEval.html
>
> that "These [bitwise] operators round their operands to the nearest
> (long) integer before evaluating"
>
> so
>
> [(10*~) | 0]
>
> might do the job at choosing a random integer in [0..9], right?

Woohoo, it works!

So one can do

i1 0 1 10000 [(3+5*~)|0]

to sample randomly a note corresponding to the octave 3 to 7.

Nil


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-04-19 20:24
FromNil Geisweiller
SubjectRe: [Csnd] Using user defined operators in score
On Tue, Apr 19, 2011 at 7:38 PM, Justin Smith  wrote:
> Yeah, that would do it. Though converting to a string and then immediately
> back again is often intuitive, it is a pet peeve of mine. The following will
> do the same thing, but with fewer lines of code, an order of magnitude fewer
> CPU cycles and no dynamic memory allocation needed:
>
> ioct = int(rnd(12-3)+3)
> ipch = int(rnd 11)/100
> icps = cpspch(ioct+ipch)

I believe the following would work too (though I haven't tried)

icps = cpspch(3+int(rnd(100))/100)

Nil


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-04-19 20:40
FromJustin Glenn Smith
SubjectRe: [Csnd] Using user defined operators in score


Nil Geisweiller wrote:
> On Tue, Apr 19, 2011 at 7:38 PM, Justin Smith  wrote:
>> Yeah, that would do it. Though converting to a string and then immediately
>> back again is often intuitive, it is a pet peeve of mine. The following will
>> do the same thing, but with fewer lines of code, an order of magnitude fewer
>> CPU cycles and no dynamic memory allocation needed:
>>
>> ioct = int(rnd(12-3)+3)
>> ipch = int(rnd 11)/100
>> icps = cpspch(ioct+ipch)
> 
> I believe the following would work too (though I haven't tried)
> 
> icps = cpspch(3+int(rnd(100))/100)
> 

for cpspch you want fractional parts that are members of the set [.0 .01 .02. .03 .04 .05 .06 .07 .08 .09 .1 .11]
that us the purpose of ipch = int(rnd 11)/100

any fractional part that is not a member of that set should not be valid input for cpspch

your code gives fractional parts in the set [.0 .01 .02 .03 ... .97 .98 .99]



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-04-19 20:42
FromJustin Glenn Smith
SubjectRe: [Csnd] Using user defined operators in score
Nil Geisweiller wrote:
>> now, but I just noticed there
>>
>> http://www.csounds.com/manual/html/ScoreEval.html
>>
>> that "These [bitwise] operators round their operands to the nearest
>> (long) integer before evaluating"
>>
>> so
>>
>> [(10*~) | 0]
>>
>> might do the job at choosing a random integer in [0..9], right?
> 
> Woohoo, it works!
> 
> So one can do
> 
> i1 0 1 10000 [(3+5*~)|0]
> 
> to sample randomly a note corresponding to the octave 3 to 7.
> 

or

i1 0 1 10000 [((3+5*~)|0)+(11*~|0)/100]

for the other example that was floating around here, for use with cpspch


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-04-19 21:00
FromNil Geisweiller
SubjectRe: [Csnd] Using user defined operators in score
On Tue, Apr 19, 2011 at 10:40 PM, Justin Glenn Smith
 wrote:
>
>
>
> Nil Geisweiller wrote:
>> On Tue, Apr 19, 2011 at 7:38 PM, Justin Smith  wrote:
>>> Yeah, that would do it. Though converting to a string and then immediately
>>> back again is often intuitive, it is a pet peeve of mine. The following will
>>> do the same thing, but with fewer lines of code, an order of magnitude fewer
>>> CPU cycles and no dynamic memory allocation needed:
>>>
>>> ioct = int(rnd(12-3)+3)
>>> ipch = int(rnd 11)/100
>>> icps = cpspch(ioct+ipch)
>>
>> I believe the following would work too (though I haven't tried)
>>
>> icps = cpspch(3+int(rnd(100))/100)
>>
>
> for cpspch you want fractional parts that are members of the set [.0 .01 .02. .03 .04 .05 .06 .07 .08 .09 .1 .11]
> that us the purpose of ipch = int(rnd 11)/100
>
> any fractional part that is not a member of that set should not be valid input for cpspch
>
> your code gives fractional parts in the set [.0 .01 .02 .03 ... .97 .98 .99]

I tried, it does work, but I suppose that might be a side effect of
the way cpspch is implemented rather than an intended feature (I find
it reasonable though).

Nil


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-04-19 21:20
Fromjoachim heintz
SubjectRe: [Csnd] Using user defined operators in score
but you can't seed, can you?
	j

Am 19.04.2011 21:21, schrieb Nil Geisweiller:
>> now, but I just noticed there
>>
>> http://www.csounds.com/manual/html/ScoreEval.html
>>
>> that "These [bitwise] operators round their operands to the nearest
>> (long) integer before evaluating"
>>
>> so
>>
>> [(10*~) | 0]
>>
>> might do the job at choosing a random integer in [0..9], right?
> 
> Woohoo, it works!
> 
> So one can do
> 
> i1 0 1 10000 [(3+5*~)|0]
> 
> to sample randomly a note corresponding to the octave 3 to 7.
> 
> Nil
> 
> 
> 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-04-19 22:35
FromJustin Glenn Smith
SubjectRe: [Csnd] Using user defined operators in score
Nil Geisweiller wrote:
> On Tue, Apr 19, 2011 at 10:40 PM, Justin Glenn Smith
>  wrote:
>>
>>
>> Nil Geisweiller wrote:
>>> On Tue, Apr 19, 2011 at 7:38 PM, Justin Smith  wrote:
>>>> Yeah, that would do it. Though converting to a string and then immediately
>>>> back again is often intuitive, it is a pet peeve of mine. The following will
>>>> do the same thing, but with fewer lines of code, an order of magnitude fewer
>>>> CPU cycles and no dynamic memory allocation needed:
>>>>
>>>> ioct = int(rnd(12-3)+3)
>>>> ipch = int(rnd 11)/100
>>>> icps = cpspch(ioct+ipch)
>>> I believe the following would work too (though I haven't tried)
>>>
>>> icps = cpspch(3+int(rnd(100))/100)
>>>
>> for cpspch you want fractional parts that are members of the set [.0 .01 .02. .03 .04 .05 .06 .07 .08 .09 .1 .11]
>> that us the purpose of ipch = int(rnd 11)/100
>>
>> any fractional part that is not a member of that set should not be valid input for cpspch
>>
>> your code gives fractional parts in the set [.0 .01 .02 .03 ... .97 .98 .99]
> 
> I tried, it does work, but I suppose that might be a side effect of
> the way cpspch is implemented rather than an intended feature (I find
> it reasonable though).
> 

Well I wasn't sure, but in my defense I did say that it "shouldn't" work, not that it wouldn't :)

Based on some experimentation (see the csd below) n.24 is one octave higher than n.12, and n.36 is two octaves higher, etc. So the problem here is that your output frequencies would be about 9 octaves too higher than you expect for any given input.





sr = 44100
ksmps = 32
nchnls = 1



	instr	1 
ipch	=	cpspch(p4)
	printf_i "%g %g\n", 1, p4, ipch
	endin 




i 1 0 0 1.0
i 1 0 0 1.12
i 1 0 0 1.24
i 1 0 0 1.36
i 1 0 0 1.99





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"