Csound Csound-dev Csound-tekno Search About

conditionals and audio signals

Date2016-05-10 07:46
FromOeyvind Brandtsegg
Subjectconditionals and audio signals
Hi,
Are audio variables saved between instrument instances?
It may seem so from the example below, where I use a conditional to
selectively process a section of the instrument. The first and second
instances plays cleanly, then I change the conditional on the third
instance and it seems like the audio variable a1 keeps its last ksmps
values (from instrument instance number two). Similarly, instance 5
has a residue of the last ksmps audio samples in the variable a2.

Is this related to how conditionals are processed? I tried changing
the conditional to k-rate, and the audio output is the same.
This is not really the way I would have programmed this kind of signal
switching, but some of our students stumbled upon this issue while
they were experimenting.






sr = 44100
ksmps = 10
nchnls = 2
0dbfs = 1

giSine ftgen 0, 0, 65536, 10, 1

instr 1
        ;a1 = 0
        ;a2 = 0
        i1 = p4
        if i1 == 0 then
        a1 poscil 0.5, 220, giSine
        endif
        if i1 == 1 then
        a2 poscil 0.5, 2500, giSine
        endif
outs a1, a2
endin



; start dur     num
i1 0 .1 0
i1 1 . 0
i1 2 . 1
i1 3 . 1
i1 4 . 0
i1 5 . 0
i1 6 . 1
i1 7 . 1
e




Date2016-05-10 08:19
FromVictor Lazzarini
SubjectRe: conditionals and audio signals
yes, any perf time var (a or otherwise) will hold its last value. For this reason if we want for instance to switch off audio, we need to zero a variable when we stop filling it, e.g.

if k1 < iend then
a1 oscili ...
else
a1 = 0
endif
out a1

without the else part, whatever was last put in the a1 variable will be looped over and over each kcycle.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

> On 10 May 2016, at 07:46, Oeyvind Brandtsegg  wrote:
> 
> Hi,
> Are audio variables saved between instrument instances?
> It may seem so from the example below, where I use a conditional to
> selectively process a section of the instrument. The first and second
> instances plays cleanly, then I change the conditional on the third
> instance and it seems like the audio variable a1 keeps its last ksmps
> values (from instrument instance number two). Similarly, instance 5
> has a residue of the last ksmps audio samples in the variable a2.
> 
> Is this related to how conditionals are processed? I tried changing
> the conditional to k-rate, and the audio output is the same.
> This is not really the way I would have programmed this kind of signal
> switching, but some of our students stumbled upon this issue while
> they were experimenting.
> 
> 
> 
> 
> 
> 
> sr = 44100
> ksmps = 10
> nchnls = 2
> 0dbfs = 1
> 
> giSine ftgen 0, 0, 65536, 10, 1
> 
> instr 1
>        ;a1 = 0
>        ;a2 = 0
>        i1 = p4
>        if i1 == 0 then
>        a1 poscil 0.5, 220, giSine
>        endif
>        if i1 == 1 then
>        a2 poscil 0.5, 2500, giSine
>        endif
> outs a1, a2
> endin
> 
> 
> 
> ; start dur     num
> i1 0 .1 0
> i1 1 . 0
> i1 2 . 1
> i1 3 . 1
> i1 4 . 0
> i1 5 . 0
> i1 6 . 1
> i1 7 . 1
> e
> 
> 
> 
> 
> 
> -- 
> 
> Oeyvind Brandtsegg
> Professor of Music Technology
> NTNU
> 7491 Trondheim
> Norway
> Cell: +47 92 203 205
> 
> http://www.partikkelaudio.com/
> http://soundcloud.com/brandtsegg
> http://flyndresang.no/
> http://soundcloud.com/t-emp
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2016-05-10 08:37
From"Joe ."
SubjectRe: conditionals and audio signals
The weird thing is, when I play it, the 7th time the instrument plays, when its supposed to be both a1 and a2 playing, there is a 3rd pitch involved, something around a major 3rd above the 2500 frequency. 

/* Joe */

On Tue, May 10, 2016 at 3:19 PM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
yes, any perf time var (a or otherwise) will hold its last value. For this reason if we want for instance to switch off audio, we need to zero a variable when we stop filling it, e.g.

if k1 < iend then
a1 oscili ...
else
a1 = 0
endif
out a1

without the else part, whatever was last put in the a1 variable will be looped over and over each kcycle.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

> On 10 May 2016, at 07:46, Oeyvind Brandtsegg <oyvind.brandtsegg@NTNU.NO> wrote:
>
> Hi,
> Are audio variables saved between instrument instances?
> It may seem so from the example below, where I use a conditional to
> selectively process a section of the instrument. The first and second
> instances plays cleanly, then I change the conditional on the third
> instance and it seems like the audio variable a1 keeps its last ksmps
> values (from instrument instance number two). Similarly, instance 5
> has a residue of the last ksmps audio samples in the variable a2.
>
> Is this related to how conditionals are processed? I tried changing
> the conditional to k-rate, and the audio output is the same.
> This is not really the way I would have programmed this kind of signal
> switching, but some of our students stumbled upon this issue while
> they were experimenting.
>
> <CsoundSynthesizer>
> <CsOptions>
> </CsOptions>
> <CsInstruments>
>
> sr = 44100
> ksmps = 10
> nchnls = 2
> 0dbfs = 1
>
> giSine ftgen 0, 0, 65536, 10, 1
>
> instr 1
>        ;a1 = 0
>        ;a2 = 0
>        i1 = p4
>        if i1 == 0 then
>        a1 poscil 0.5, 220, giSine
>        endif
>        if i1 == 1 then
>        a2 poscil 0.5, 2500, giSine
>        endif
> outs a1, a2
> endin
>
> </CsInstruments>
> <CsScore>
> ; start dur     num
> i1 0 .1 0
> i1 1 . 0
> i1 2 . 1
> i1 3 . 1
> i1 4 . 0
> i1 5 . 0
> i1 6 . 1
> i1 7 . 1
> e
>
> </CsScore>
> </CsoundSynthesizer>
>
>
> --
>
> Oeyvind Brandtsegg
> Professor of Music Technology
> NTNU
> 7491 Trondheim
> Norway
> Cell: +47 92 203 205
>
> http://www.partikkelaudio.com/
> http://soundcloud.com/brandtsegg
> http://flyndresang.no/
> http://soundcloud.com/t-emp
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2016-05-10 08:38
FromOeyvind Brandtsegg
SubjectRe: conditionals and audio signals
Hi Victor,
Thanks for the clarification.
I was just surprised that this happens across instrument instances,
i.e. that the audio variables are not zeroed when the next instance
starts.

2016-05-10 9:19 GMT+02:00 Victor Lazzarini :
> yes, any perf time var (a or otherwise) will hold its last value. For this reason if we want for instance to switch off audio, we need to zero a variable when we stop filling it, e.g.
>
> if k1 < iend then
> a1 oscili ...
> else
> a1 = 0
> endif
> out a1
>
> without the else part, whatever was last put in the a1 variable will be looped over and over each kcycle.
>
> Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy
> Maynooth University
> Ireland
>
>> On 10 May 2016, at 07:46, Oeyvind Brandtsegg  wrote:
>>
>> Hi,
>> Are audio variables saved between instrument instances?
>> It may seem so from the example below, where I use a conditional to
>> selectively process a section of the instrument. The first and second
>> instances plays cleanly, then I change the conditional on the third
>> instance and it seems like the audio variable a1 keeps its last ksmps
>> values (from instrument instance number two). Similarly, instance 5
>> has a residue of the last ksmps audio samples in the variable a2.
>>
>> Is this related to how conditionals are processed? I tried changing
>> the conditional to k-rate, and the audio output is the same.
>> This is not really the way I would have programmed this kind of signal
>> switching, but some of our students stumbled upon this issue while
>> they were experimenting.
>>
>> 
>> 
>> 
>> 
>>
>> sr = 44100
>> ksmps = 10
>> nchnls = 2
>> 0dbfs = 1
>>
>> giSine ftgen 0, 0, 65536, 10, 1
>>
>> instr 1
>>        ;a1 = 0
>>        ;a2 = 0
>>        i1 = p4
>>        if i1 == 0 then
>>        a1 poscil 0.5, 220, giSine
>>        endif
>>        if i1 == 1 then
>>        a2 poscil 0.5, 2500, giSine
>>        endif
>> outs a1, a2
>> endin
>>
>> 
>> 
>> ; start dur     num
>> i1 0 .1 0
>> i1 1 . 0
>> i1 2 . 1
>> i1 3 . 1
>> i1 4 . 0
>> i1 5 . 0
>> i1 6 . 1
>> i1 7 . 1
>> e
>>
>> 
>> 
>>
>>
>> --
>>
>> Oeyvind Brandtsegg
>> Professor of Music Technology
>> NTNU
>> 7491 Trondheim
>> Norway
>> Cell: +47 92 203 205
>>
>> http://www.partikkelaudio.com/
>> http://soundcloud.com/brandtsegg
>> http://flyndresang.no/
>> http://soundcloud.com/t-emp
>>
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>        https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here


Date2016-05-10 08:45
FromOeyvind Brandtsegg
SubjectRe: conditionals and audio signals
Hi Joe,
The example is not supposed to play both notes simultaneously at any
time. But yes, it does create pitches other than those specified, due
to the audio vector being kept from instance to instance. What I call
an instance here is what you would commonly refer to as "one note
played on the instrument". The pitch you hear is probably the last 10
audio samples of the 2500 Hz wave, (ksmps=10) repeated, which at this
sample rate would be (44100/10) 4410 Hz. I guess the major 3rd you
hear is comes from a partial of this complex waveform (is is a sine
wave chopped up at an arbitrary spot, so it has a lot of partials
beside the fundamental).


2016-05-10 9:37 GMT+02:00 Joe . :
> The weird thing is, when I play it, the 7th time the instrument plays, when
> its supposed to be both a1 and a2 playing, there is a 3rd pitch involved,
> something around a major 3rd above the 2500 frequency.
>
> /* Joe */
>
> On Tue, May 10, 2016 at 3:19 PM, Victor Lazzarini 
> wrote:
>>
>> yes, any perf time var (a or otherwise) will hold its last value. For this
>> reason if we want for instance to switch off audio, we need to zero a
>> variable when we stop filling it, e.g.
>>
>> if k1 < iend then
>> a1 oscili ...
>> else
>> a1 = 0
>> endif
>> out a1
>>
>> without the else part, whatever was last put in the a1 variable will be
>> looped over and over each kcycle.
>>
>> Victor Lazzarini
>> Dean of Arts, Celtic Studies, and Philosophy
>> Maynooth University
>> Ireland
>>
>> > On 10 May 2016, at 07:46, Oeyvind Brandtsegg 
>> > wrote:
>> >
>> > Hi,
>> > Are audio variables saved between instrument instances?
>> > It may seem so from the example below, where I use a conditional to
>> > selectively process a section of the instrument. The first and second
>> > instances plays cleanly, then I change the conditional on the third
>> > instance and it seems like the audio variable a1 keeps its last ksmps
>> > values (from instrument instance number two). Similarly, instance 5
>> > has a residue of the last ksmps audio samples in the variable a2.
>> >
>> > Is this related to how conditionals are processed? I tried changing
>> > the conditional to k-rate, and the audio output is the same.
>> > This is not really the way I would have programmed this kind of signal
>> > switching, but some of our students stumbled upon this issue while
>> > they were experimenting.
>> >
>> > 
>> > 
>> > 
>> > 
>> >
>> > sr = 44100
>> > ksmps = 10
>> > nchnls = 2
>> > 0dbfs = 1
>> >
>> > giSine ftgen 0, 0, 65536, 10, 1
>> >
>> > instr 1
>> >        ;a1 = 0
>> >        ;a2 = 0
>> >        i1 = p4
>> >        if i1 == 0 then
>> >        a1 poscil 0.5, 220, giSine
>> >        endif
>> >        if i1 == 1 then
>> >        a2 poscil 0.5, 2500, giSine
>> >        endif
>> > outs a1, a2
>> > endin
>> >
>> > 
>> > 
>> > ; start dur     num
>> > i1 0 .1 0
>> > i1 1 . 0
>> > i1 2 . 1
>> > i1 3 . 1
>> > i1 4 . 0
>> > i1 5 . 0
>> > i1 6 . 1
>> > i1 7 . 1
>> > e
>> >
>> > 
>> > 
>> >
>> >
>> > --
>> >
>> > Oeyvind Brandtsegg
>> > Professor of Music Technology
>> > NTNU
>> > 7491 Trondheim
>> > Norway
>> > Cell: +47 92 203 205
>> >
>> > http://www.partikkelaudio.com/
>> > http://soundcloud.com/brandtsegg
>> > http://flyndresang.no/
>> > http://soundcloud.com/t-emp
>> >
>> > Csound mailing list
>> > Csound@listserv.heanet.ie
>> > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> > Send bugs reports to
>> >        https://github.com/csound/csound/issues
>> > Discussions of bugs and features can be posted here
>>
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>         https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>
>
> Csound mailing list Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
> https://github.com/csound/csound/issues Discussions of bugs and features can
> be posted here


Date2016-05-10 08:50
FromOeyvind Brandtsegg
SubjectRe: conditionals and audio signals
I wonder how this could be documented so users don't stumble upon this
unknowingly.
As mentioned, this happened to some students working on an exam, when
they tried to build a keyboard split samples instrument (different
sounds for each key on the midi keyboard).They have not specifically
been taught how to do that, but musical need caused experimentation
and they did what they could. I must admit their assumption that this
should work is not totally unreasonable. Which is why it would be good
to document it somehow(?)

2016-05-10 9:38 GMT+02:00 Oeyvind Brandtsegg :
> Hi Victor,
> Thanks for the clarification.
> I was just surprised that this happens across instrument instances,
> i.e. that the audio variables are not zeroed when the next instance
> starts.
>
> 2016-05-10 9:19 GMT+02:00 Victor Lazzarini :
>> yes, any perf time var (a or otherwise) will hold its last value. For this reason if we want for instance to switch off audio, we need to zero a variable when we stop filling it, e.g.
>>
>> if k1 < iend then
>> a1 oscili ...
>> else
>> a1 = 0
>> endif
>> out a1
>>
>> without the else part, whatever was last put in the a1 variable will be looped over and over each kcycle.
>>
>> Victor Lazzarini
>> Dean of Arts, Celtic Studies, and Philosophy
>> Maynooth University
>> Ireland
>>
>>> On 10 May 2016, at 07:46, Oeyvind Brandtsegg  wrote:
>>>
>>> Hi,
>>> Are audio variables saved between instrument instances?
>>> It may seem so from the example below, where I use a conditional to
>>> selectively process a section of the instrument. The first and second
>>> instances plays cleanly, then I change the conditional on the third
>>> instance and it seems like the audio variable a1 keeps its last ksmps
>>> values (from instrument instance number two). Similarly, instance 5
>>> has a residue of the last ksmps audio samples in the variable a2.
>>>
>>> Is this related to how conditionals are processed? I tried changing
>>> the conditional to k-rate, and the audio output is the same.
>>> This is not really the way I would have programmed this kind of signal
>>> switching, but some of our students stumbled upon this issue while
>>> they were experimenting.
>>>
>>> 
>>> 
>>> 
>>> 
>>>
>>> sr = 44100
>>> ksmps = 10
>>> nchnls = 2
>>> 0dbfs = 1
>>>
>>> giSine ftgen 0, 0, 65536, 10, 1
>>>
>>> instr 1
>>>        ;a1 = 0
>>>        ;a2 = 0
>>>        i1 = p4
>>>        if i1 == 0 then
>>>        a1 poscil 0.5, 220, giSine
>>>        endif
>>>        if i1 == 1 then
>>>        a2 poscil 0.5, 2500, giSine
>>>        endif
>>> outs a1, a2
>>> endin
>>>
>>> 
>>> 
>>> ; start dur     num
>>> i1 0 .1 0
>>> i1 1 . 0
>>> i1 2 . 1
>>> i1 3 . 1
>>> i1 4 . 0
>>> i1 5 . 0
>>> i1 6 . 1
>>> i1 7 . 1
>>> e
>>>
>>> 
>>> 
>>>
>>>
>>> --
>>>
>>> Oeyvind Brandtsegg
>>> Professor of Music Technology
>>> NTNU
>>> 7491 Trondheim
>>> Norway
>>> Cell: +47 92 203 205
>>>
>>> http://www.partikkelaudio.com/
>>> http://soundcloud.com/brandtsegg
>>> http://flyndresang.no/
>>> http://soundcloud.com/t-emp
>>>
>>> Csound mailing list
>>> Csound@listserv.heanet.ie
>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>> Send bugs reports to
>>>        https://github.com/csound/csound/issues
>>> Discussions of bugs and features can be posted here
>>
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>         https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>
>
>
> --
>
> Oeyvind Brandtsegg
> Professor of Music Technology
> NTNU
> 7491 Trondheim
> Norway
> Cell: +47 92 203 205
>
> http://www.partikkelaudio.com/
> http://soundcloud.com/brandtsegg
> http://flyndresang.no/
> http://soundcloud.com/t-emp


Date2016-05-10 08:54
From"Joe ."
SubjectRe: conditionals and audio signals
Why is any of this being calculated at k rate? As far as I can see, it seems to use a and i variables only. 

as for your students, I think its just an issue of turning the thing off after calling it. 

/* Joe */

On Tue, May 10, 2016 at 3:50 PM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
I wonder how this could be documented so users don't stumble upon this
unknowingly.
As mentioned, this happened to some students working on an exam, when
they tried to build a keyboard split samples instrument (different
sounds for each key on the midi keyboard).They have not specifically
been taught how to do that, but musical need caused experimentation
and they did what they could. I must admit their assumption that this
should work is not totally unreasonable. Which is why it would be good
to document it somehow(?)

2016-05-10 9:38 GMT+02:00 Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no>:
> Hi Victor,
> Thanks for the clarification.
> I was just surprised that this happens across instrument instances,
> i.e. that the audio variables are not zeroed when the next instance
> starts.
>
> 2016-05-10 9:19 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
>> yes, any perf time var (a or otherwise) will hold its last value. For this reason if we want for instance to switch off audio, we need to zero a variable when we stop filling it, e.g.
>>
>> if k1 < iend then
>> a1 oscili ...
>> else
>> a1 = 0
>> endif
>> out a1
>>
>> without the else part, whatever was last put in the a1 variable will be looped over and over each kcycle.
>>
>> Victor Lazzarini
>> Dean of Arts, Celtic Studies, and Philosophy
>> Maynooth University
>> Ireland
>>
>>> On 10 May 2016, at 07:46, Oeyvind Brandtsegg <oyvind.brandtsegg@NTNU.NO> wrote:
>>>
>>> Hi,
>>> Are audio variables saved between instrument instances?
>>> It may seem so from the example below, where I use a conditional to
>>> selectively process a section of the instrument. The first and second
>>> instances plays cleanly, then I change the conditional on the third
>>> instance and it seems like the audio variable a1 keeps its last ksmps
>>> values (from instrument instance number two). Similarly, instance 5
>>> has a residue of the last ksmps audio samples in the variable a2.
>>>
>>> Is this related to how conditionals are processed? I tried changing
>>> the conditional to k-rate, and the audio output is the same.
>>> This is not really the way I would have programmed this kind of signal
>>> switching, but some of our students stumbled upon this issue while
>>> they were experimenting.
>>>
>>> <CsoundSynthesizer>
>>> <CsOptions>
>>> </CsOptions>
>>> <CsInstruments>
>>>
>>> sr = 44100
>>> ksmps = 10
>>> nchnls = 2
>>> 0dbfs = 1
>>>
>>> giSine ftgen 0, 0, 65536, 10, 1
>>>
>>> instr 1
>>>        ;a1 = 0
>>>        ;a2 = 0
>>>        i1 = p4
>>>        if i1 == 0 then
>>>        a1 poscil 0.5, 220, giSine
>>>        endif
>>>        if i1 == 1 then
>>>        a2 poscil 0.5, 2500, giSine
>>>        endif
>>> outs a1, a2
>>> endin
>>>
>>> </CsInstruments>
>>> <CsScore>
>>> ; start dur     num
>>> i1 0 .1 0
>>> i1 1 . 0
>>> i1 2 . 1
>>> i1 3 . 1
>>> i1 4 . 0
>>> i1 5 . 0
>>> i1 6 . 1
>>> i1 7 . 1
>>> e
>>>
>>> </CsScore>
>>> </CsoundSynthesizer>
>>>
>>>
>>> --
>>>
>>> Oeyvind Brandtsegg
>>> Professor of Music Technology
>>> NTNU
>>> 7491 Trondheim
>>> Norway
>>> Cell: +47 92 203 205
>>>
>>> http://www.partikkelaudio.com/
>>> http://soundcloud.com/brandtsegg
>>> http://flyndresang.no/
>>> http://soundcloud.com/t-emp
>>>
>>> Csound mailing list
>>> Csound@listserv.heanet.ie
>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>> Send bugs reports to
>>>        https://github.com/csound/csound/issues
>>> Discussions of bugs and features can be posted here
>>
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>         https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>
>
>
> --
>
> Oeyvind Brandtsegg
> Professor of Music Technology
> NTNU
> 7491 Trondheim
> Norway
> Cell: +47 92 203 205
>
> http://www.partikkelaudio.com/
> http://soundcloud.com/brandtsegg
> http://flyndresang.no/
> http://soundcloud.com/t-emp



--

Oeyvind Brandtsegg
Professor of Music Technology
NTNU
7491 Trondheim
Norway
Cell: +47 92 203 205

http://www.partikkelaudio.com/
http://soundcloud.com/brandtsegg
http://flyndresang.no/
http://soundcloud.com/t-emp

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2016-05-10 12:57
FromVictor Lazzarini
SubjectRe: conditionals and audio signals
That is because it is not a new allocation. Instrument instances will look for a free memory
allocation and use it, rather than create a new space all the time. If we use ‘init’ then we
have a means of zeroing things. 

========================
Dr Victor Lazzarini
Dean of Arts, Celtic Studies and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 10 May 2016, at 08:38, Oeyvind Brandtsegg  wrote:
> 
> Hi Victor,
> Thanks for the clarification.
> I was just surprised that this happens across instrument instances,
> i.e. that the audio variables are not zeroed when the next instance
> starts.
> 
> 2016-05-10 9:19 GMT+02:00 Victor Lazzarini :
>> yes, any perf time var (a or otherwise) will hold its last value. For this reason if we want for instance to switch off audio, we need to zero a variable when we stop filling it, e.g.
>> 
>> if k1 < iend then
>> a1 oscili ...
>> else
>> a1 = 0
>> endif
>> out a1
>> 
>> without the else part, whatever was last put in the a1 variable will be looped over and over each kcycle.
>> 
>> Victor Lazzarini
>> Dean of Arts, Celtic Studies, and Philosophy
>> Maynooth University
>> Ireland
>> 
>>> On 10 May 2016, at 07:46, Oeyvind Brandtsegg  wrote:
>>> 
>>> Hi,
>>> Are audio variables saved between instrument instances?
>>> It may seem so from the example below, where I use a conditional to
>>> selectively process a section of the instrument. The first and second
>>> instances plays cleanly, then I change the conditional on the third
>>> instance and it seems like the audio variable a1 keeps its last ksmps
>>> values (from instrument instance number two). Similarly, instance 5
>>> has a residue of the last ksmps audio samples in the variable a2.
>>> 
>>> Is this related to how conditionals are processed? I tried changing
>>> the conditional to k-rate, and the audio output is the same.
>>> This is not really the way I would have programmed this kind of signal
>>> switching, but some of our students stumbled upon this issue while
>>> they were experimenting.
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> sr = 44100
>>> ksmps = 10
>>> nchnls = 2
>>> 0dbfs = 1
>>> 
>>> giSine ftgen 0, 0, 65536, 10, 1
>>> 
>>> instr 1
>>>       ;a1 = 0
>>>       ;a2 = 0
>>>       i1 = p4
>>>       if i1 == 0 then
>>>       a1 poscil 0.5, 220, giSine
>>>       endif
>>>       if i1 == 1 then
>>>       a2 poscil 0.5, 2500, giSine
>>>       endif
>>> outs a1, a2
>>> endin
>>> 
>>> 
>>> 
>>> ; start dur     num
>>> i1 0 .1 0
>>> i1 1 . 0
>>> i1 2 . 1
>>> i1 3 . 1
>>> i1 4 . 0
>>> i1 5 . 0
>>> i1 6 . 1
>>> i1 7 . 1
>>> e
>>> 
>>> 
>>> 
>>> 
>>> 
>>> --
>>> 
>>> Oeyvind Brandtsegg
>>> Professor of Music Technology
>>> NTNU
>>> 7491 Trondheim
>>> Norway
>>> Cell: +47 92 203 205
>>> 
>>> http://www.partikkelaudio.com/
>>> http://soundcloud.com/brandtsegg
>>> http://flyndresang.no/
>>> http://soundcloud.com/t-emp
>>> 
>>> Csound mailing list
>>> Csound@listserv.heanet.ie
>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>> Send bugs reports to
>>>       https://github.com/csound/csound/issues
>>> Discussions of bugs and features can be posted here
>> 
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>        https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
> 
> 
> 
> -- 
> 
> Oeyvind Brandtsegg
> Professor of Music Technology
> NTNU
> 7491 Trondheim
> Norway
> Cell: +47 92 203 205
> 
> http://www.partikkelaudio.com/
> http://soundcloud.com/brandtsegg
> http://flyndresang.no/
> http://soundcloud.com/t-emp
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2016-05-10 12:59
FromVictor Lazzarini
SubjectRe: conditionals and audio signals
yes, something that could go into the manual or even into the FLOSS manual.
========================
Dr Victor Lazzarini
Dean of Arts, Celtic Studies and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 10 May 2016, at 08:50, Oeyvind Brandtsegg  wrote:
> 
> I wonder how this could be documented so users don't stumble upon this
> unknowingly.
> As mentioned, this happened to some students working on an exam, when
> they tried to build a keyboard split samples instrument (different
> sounds for each key on the midi keyboard).They have not specifically
> been taught how to do that, but musical need caused experimentation
> and they did what they could. I must admit their assumption that this
> should work is not totally unreasonable. Which is why it would be good
> to document it somehow(?)
> 
> 2016-05-10 9:38 GMT+02:00 Oeyvind Brandtsegg :
>> Hi Victor,
>> Thanks for the clarification.
>> I was just surprised that this happens across instrument instances,
>> i.e. that the audio variables are not zeroed when the next instance
>> starts.
>> 
>> 2016-05-10 9:19 GMT+02:00 Victor Lazzarini :
>>> yes, any perf time var (a or otherwise) will hold its last value. For this reason if we want for instance to switch off audio, we need to zero a variable when we stop filling it, e.g.
>>> 
>>> if k1 < iend then
>>> a1 oscili ...
>>> else
>>> a1 = 0
>>> endif
>>> out a1
>>> 
>>> without the else part, whatever was last put in the a1 variable will be looped over and over each kcycle.
>>> 
>>> Victor Lazzarini
>>> Dean of Arts, Celtic Studies, and Philosophy
>>> Maynooth University
>>> Ireland
>>> 
>>>> On 10 May 2016, at 07:46, Oeyvind Brandtsegg  wrote:
>>>> 
>>>> Hi,
>>>> Are audio variables saved between instrument instances?
>>>> It may seem so from the example below, where I use a conditional to
>>>> selectively process a section of the instrument. The first and second
>>>> instances plays cleanly, then I change the conditional on the third
>>>> instance and it seems like the audio variable a1 keeps its last ksmps
>>>> values (from instrument instance number two). Similarly, instance 5
>>>> has a residue of the last ksmps audio samples in the variable a2.
>>>> 
>>>> Is this related to how conditionals are processed? I tried changing
>>>> the conditional to k-rate, and the audio output is the same.
>>>> This is not really the way I would have programmed this kind of signal
>>>> switching, but some of our students stumbled upon this issue while
>>>> they were experimenting.
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> sr = 44100
>>>> ksmps = 10
>>>> nchnls = 2
>>>> 0dbfs = 1
>>>> 
>>>> giSine ftgen 0, 0, 65536, 10, 1
>>>> 
>>>> instr 1
>>>>       ;a1 = 0
>>>>       ;a2 = 0
>>>>       i1 = p4
>>>>       if i1 == 0 then
>>>>       a1 poscil 0.5, 220, giSine
>>>>       endif
>>>>       if i1 == 1 then
>>>>       a2 poscil 0.5, 2500, giSine
>>>>       endif
>>>> outs a1, a2
>>>> endin
>>>> 
>>>> 
>>>> 
>>>> ; start dur     num
>>>> i1 0 .1 0
>>>> i1 1 . 0
>>>> i1 2 . 1
>>>> i1 3 . 1
>>>> i1 4 . 0
>>>> i1 5 . 0
>>>> i1 6 . 1
>>>> i1 7 . 1
>>>> e
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> --
>>>> 
>>>> Oeyvind Brandtsegg
>>>> Professor of Music Technology
>>>> NTNU
>>>> 7491 Trondheim
>>>> Norway
>>>> Cell: +47 92 203 205
>>>> 
>>>> http://www.partikkelaudio.com/
>>>> http://soundcloud.com/brandtsegg
>>>> http://flyndresang.no/
>>>> http://soundcloud.com/t-emp
>>>> 
>>>> Csound mailing list
>>>> Csound@listserv.heanet.ie
>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>> Send bugs reports to
>>>>       https://github.com/csound/csound/issues
>>>> Discussions of bugs and features can be posted here
>>> 
>>> Csound mailing list
>>> Csound@listserv.heanet.ie
>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>> Send bugs reports to
>>>        https://github.com/csound/csound/issues
>>> Discussions of bugs and features can be posted here
>> 
>> 
>> 
>> --
>> 
>> Oeyvind Brandtsegg
>> Professor of Music Technology
>> NTNU
>> 7491 Trondheim
>> Norway
>> Cell: +47 92 203 205
>> 
>> http://www.partikkelaudio.com/
>> http://soundcloud.com/brandtsegg
>> http://flyndresang.no/
>> http://soundcloud.com/t-emp
> 
> 
> 
> -- 
> 
> Oeyvind Brandtsegg
> Professor of Music Technology
> NTNU
> 7491 Trondheim
> Norway
> Cell: +47 92 203 205
> 
> http://www.partikkelaudio.com/
> http://soundcloud.com/brandtsegg
> http://flyndresang.no/
> http://soundcloud.com/t-emp
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2016-05-10 13:00
FromVictor Lazzarini
SubjectRe: conditionals and audio signals
a variables are updated every k-cycle.
========================
Dr Victor Lazzarini
Dean of Arts, Celtic Studies and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 10 May 2016, at 08:54, Joe .  wrote:
> 
> Why is any of this being calculated at k rate? As far as I can see, it seems to use a and i variables only. 
> 
> as for your students, I think its just an issue of turning the thing off after calling it. 
> 
> /* Joe */
> 
> On Tue, May 10, 2016 at 3:50 PM, Oeyvind Brandtsegg  wrote:
> I wonder how this could be documented so users don't stumble upon this
> unknowingly.
> As mentioned, this happened to some students working on an exam, when
> they tried to build a keyboard split samples instrument (different
> sounds for each key on the midi keyboard).They have not specifically
> been taught how to do that, but musical need caused experimentation
> and they did what they could. I must admit their assumption that this
> should work is not totally unreasonable. Which is why it would be good
> to document it somehow(?)
> 
> 2016-05-10 9:38 GMT+02:00 Oeyvind Brandtsegg :
> > Hi Victor,
> > Thanks for the clarification.
> > I was just surprised that this happens across instrument instances,
> > i.e. that the audio variables are not zeroed when the next instance
> > starts.
> >
> > 2016-05-10 9:19 GMT+02:00 Victor Lazzarini :
> >> yes, any perf time var (a or otherwise) will hold its last value. For this reason if we want for instance to switch off audio, we need to zero a variable when we stop filling it, e.g.
> >>
> >> if k1 < iend then
> >> a1 oscili ...
> >> else
> >> a1 = 0
> >> endif
> >> out a1
> >>
> >> without the else part, whatever was last put in the a1 variable will be looped over and over each kcycle.
> >>
> >> Victor Lazzarini
> >> Dean of Arts, Celtic Studies, and Philosophy
> >> Maynooth University
> >> Ireland
> >>
> >>> On 10 May 2016, at 07:46, Oeyvind Brandtsegg  wrote:
> >>>
> >>> Hi,
> >>> Are audio variables saved between instrument instances?
> >>> It may seem so from the example below, where I use a conditional to
> >>> selectively process a section of the instrument. The first and second
> >>> instances plays cleanly, then I change the conditional on the third
> >>> instance and it seems like the audio variable a1 keeps its last ksmps
> >>> values (from instrument instance number two). Similarly, instance 5
> >>> has a residue of the last ksmps audio samples in the variable a2.
> >>>
> >>> Is this related to how conditionals are processed? I tried changing
> >>> the conditional to k-rate, and the audio output is the same.
> >>> This is not really the way I would have programmed this kind of signal
> >>> switching, but some of our students stumbled upon this issue while
> >>> they were experimenting.
> >>>
> >>> 
> >>> 
> >>> 
> >>> 
> >>>
> >>> sr = 44100
> >>> ksmps = 10
> >>> nchnls = 2
> >>> 0dbfs = 1
> >>>
> >>> giSine ftgen 0, 0, 65536, 10, 1
> >>>
> >>> instr 1
> >>>        ;a1 = 0
> >>>        ;a2 = 0
> >>>        i1 = p4
> >>>        if i1 == 0 then
> >>>        a1 poscil 0.5, 220, giSine
> >>>        endif
> >>>        if i1 == 1 then
> >>>        a2 poscil 0.5, 2500, giSine
> >>>        endif
> >>> outs a1, a2
> >>> endin
> >>>
> >>> 
> >>> 
> >>> ; start dur     num
> >>> i1 0 .1 0
> >>> i1 1 . 0
> >>> i1 2 . 1
> >>> i1 3 . 1
> >>> i1 4 . 0
> >>> i1 5 . 0
> >>> i1 6 . 1
> >>> i1 7 . 1
> >>> e
> >>>
> >>> 
> >>> 
> >>>
> >>>
> >>> --
> >>>
> >>> Oeyvind Brandtsegg
> >>> Professor of Music Technology
> >>> NTNU
> >>> 7491 Trondheim
> >>> Norway
> >>> Cell: +47 92 203 205
> >>>
> >>> http://www.partikkelaudio.com/
> >>> http://soundcloud.com/brandtsegg
> >>> http://flyndresang.no/
> >>> http://soundcloud.com/t-emp
> >>>
> >>> Csound mailing list
> >>> Csound@listserv.heanet.ie
> >>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> >>> Send bugs reports to
> >>>        https://github.com/csound/csound/issues
> >>> Discussions of bugs and features can be posted here
> >>
> >> Csound mailing list
> >> Csound@listserv.heanet.ie
> >> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> >> Send bugs reports to
> >>         https://github.com/csound/csound/issues
> >> Discussions of bugs and features can be posted here
> >
> >
> >
> > --
> >
> > Oeyvind Brandtsegg
> > Professor of Music Technology
> > NTNU
> > 7491 Trondheim
> > Norway
> > Cell: +47 92 203 205
> >
> > http://www.partikkelaudio.com/
> > http://soundcloud.com/brandtsegg
> > http://flyndresang.no/
> > http://soundcloud.com/t-emp
> 
> 
> 
> --
> 
> Oeyvind Brandtsegg
> Professor of Music Technology
> NTNU
> 7491 Trondheim
> Norway
> Cell: +47 92 203 205
> 
> http://www.partikkelaudio.com/
> http://soundcloud.com/brandtsegg
> http://flyndresang.no/
> http://soundcloud.com/t-emp
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> 
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2016-05-10 13:40
Fromjpff
SubjectRe: conditionals and audio signals
Variale do not change teir value unless explicity changed.  I woud expect 
nothing else.

On Tue, 10 May 2016, Oeyvind Brandtsegg wrote:

> Hi,
> Are audio variables saved between instrument instances?
> It may seem so from the example below, where I use a conditional to
> selectively process a section of the instrument. The first and second
> instances plays cleanly, then I change the conditional on the third
> instance and it seems like the audio variable a1 keeps its last ksmps
> values (from instrument instance number two). Similarly, instance 5
> has a residue of the last ksmps audio samples in the variable a2.
>
> Is this related to how conditionals are processed? I tried changing
> the conditional to k-rate, and the audio output is the same.
> This is not really the way I would have programmed this kind of signal
> switching, but some of our students stumbled upon this issue while
> they were experimenting.
>
> 
> 
> 
> 
>
> sr = 44100
> ksmps = 10
> nchnls = 2
> 0dbfs = 1
>
> giSine ftgen 0, 0, 65536, 10, 1
>
> instr 1
>        ;a1 = 0
>        ;a2 = 0
>        i1 = p4
>        if i1 == 0 then
>        a1 poscil 0.5, 220, giSine
>        endif
>        if i1 == 1 then
>        a2 poscil 0.5, 2500, giSine
>        endif
> outs a1, a2
> endin
>
> 
> 
> ; start dur     num
> i1 0 .1 0
> i1 1 . 0
> i1 2 . 1
> i1 3 . 1
> i1 4 . 0
> i1 5 . 0
> i1 6 . 1
> i1 7 . 1
> e
>
> 
> 
>
>
> -- 
>
> Oeyvind Brandtsegg
> Professor of Music Technology
> NTNU
> 7491 Trondheim
> Norway
> Cell: +47 92 203 205
>
> http://www.partikkelaudio.com/
> http://soundcloud.com/brandtsegg
> http://flyndresang.no/
> http://soundcloud.com/t-emp
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2016-05-10 14:12
FromOeyvind Brandtsegg
SubjectRe: conditionals and audio signals
All good. Thanks for the explanations. I let this be my today's lesson
in Csound internals.

2016-05-10 14:40 GMT+02:00 jpff :
> Variale do not change teir value unless explicity changed.  I woud expect
> nothing else.
>
>
> On Tue, 10 May 2016, Oeyvind Brandtsegg wrote:
>
>> Hi,
>> Are audio variables saved between instrument instances?
>> It may seem so from the example below, where I use a conditional to
>> selectively process a section of the instrument. The first and second
>> instances plays cleanly, then I change the conditional on the third
>> instance and it seems like the audio variable a1 keeps its last ksmps
>> values (from instrument instance number two). Similarly, instance 5
>> has a residue of the last ksmps audio samples in the variable a2.
>>
>> Is this related to how conditionals are processed? I tried changing
>> the conditional to k-rate, and the audio output is the same.
>> This is not really the way I would have programmed this kind of signal
>> switching, but some of our students stumbled upon this issue while
>> they were experimenting.
>>
>> 
>> 
>> 
>> 
>>
>> sr = 44100
>> ksmps = 10
>> nchnls = 2
>> 0dbfs = 1
>>
>> giSine ftgen 0, 0, 65536, 10, 1
>>
>> instr 1
>>        ;a1 = 0
>>        ;a2 = 0
>>        i1 = p4
>>        if i1 == 0 then
>>        a1 poscil 0.5, 220, giSine
>>        endif
>>        if i1 == 1 then
>>        a2 poscil 0.5, 2500, giSine
>>        endif
>> outs a1, a2
>> endin
>>
>> 
>> 
>> ; start dur     num
>> i1 0 .1 0
>> i1 1 . 0
>> i1 2 . 1
>> i1 3 . 1
>> i1 4 . 0
>> i1 5 . 0
>> i1 6 . 1
>> i1 7 . 1
>> e
>>
>> 
>> 
>>
>>
>> --
>>
>> Oeyvind Brandtsegg
>> Professor of Music Technology
>> NTNU
>> 7491 Trondheim
>> Norway
>> Cell: +47 92 203 205
>>
>> http://www.partikkelaudio.com/
>> http://soundcloud.com/brandtsegg
>> http://flyndresang.no/
>> http://soundcloud.com/t-emp
>>
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>        https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>>
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here


Date2016-05-10 14:20
FromHlöðver Sigurðsson
SubjectRe: conditionals and audio signals
Very interesting conversation, glad to get this clear myself.

2016-05-10 15:12 GMT+02:00 Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no>:
All good. Thanks for the explanations. I let this be my today's lesson
in Csound internals.

2016-05-10 14:40 GMT+02:00 jpff <jpff@codemist.co.uk>:
> Variale do not change teir value unless explicity changed.  I woud expect
> nothing else.
>
>
> On Tue, 10 May 2016, Oeyvind Brandtsegg wrote:
>
>> Hi,
>> Are audio variables saved between instrument instances?
>> It may seem so from the example below, where I use a conditional to
>> selectively process a section of the instrument. The first and second
>> instances plays cleanly, then I change the conditional on the third
>> instance and it seems like the audio variable a1 keeps its last ksmps
>> values (from instrument instance number two). Similarly, instance 5
>> has a residue of the last ksmps audio samples in the variable a2.
>>
>> Is this related to how conditionals are processed? I tried changing
>> the conditional to k-rate, and the audio output is the same.
>> This is not really the way I would have programmed this kind of signal
>> switching, but some of our students stumbled upon this issue while
>> they were experimenting.
>>
>> <CsoundSynthesizer>
>> <CsOptions>
>> </CsOptions>
>> <CsInstruments>
>>
>> sr = 44100
>> ksmps = 10
>> nchnls = 2
>> 0dbfs = 1
>>
>> giSine ftgen 0, 0, 65536, 10, 1
>>
>> instr 1
>>        ;a1 = 0
>>        ;a2 = 0
>>        i1 = p4
>>        if i1 == 0 then
>>        a1 poscil 0.5, 220, giSine
>>        endif
>>        if i1 == 1 then
>>        a2 poscil 0.5, 2500, giSine
>>        endif
>> outs a1, a2
>> endin
>>
>> </CsInstruments>
>> <CsScore>
>> ; start dur     num
>> i1 0 .1 0
>> i1 1 . 0
>> i1 2 . 1
>> i1 3 . 1
>> i1 4 . 0
>> i1 5 . 0
>> i1 6 . 1
>> i1 7 . 1
>> e
>>
>> </CsScore>
>> </CsoundSynthesizer>
>>
>>
>> --
>>
>> Oeyvind Brandtsegg
>> Professor of Music Technology
>> NTNU
>> 7491 Trondheim
>> Norway
>> Cell: +47 92 203 205
>>
>> http://www.partikkelaudio.com/
>> http://soundcloud.com/brandtsegg
>> http://flyndresang.no/
>> http://soundcloud.com/t-emp
>>
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>        https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>>
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here



--

Oeyvind Brandtsegg
Professor of Music Technology
NTNU
7491 Trondheim
Norway
Cell: +47 92 203 205

http://www.partikkelaudio.com/
http://soundcloud.com/brandtsegg
http://flyndresang.no/
http://soundcloud.com/t-emp

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2016-05-10 21:05
Fromjoachim heintz
SubjectRe: conditionals and audio signals
i have written something about it in the floss manual, as i came across 
this, too, some time ago: 
http://floss.booktype.pro/csound/a-initialization-and-performance-pass/

"What happens on a k-variable if an instrument is called multiple times? 
What is the initialization value of this variable on the first call, and 
on the subsequent calls?

If this variable is not set explicitely, the init value in the first 
call of an instrument is zero, as usual. But, for the next calls, the 
k-variable is initialized to the value which was left when the previous 
instance of the same instrument turned off."

and see the examples 03A08, 03A09 and 03A10.

let me know if something can be expressed better, or is missing.

	joachim



On 10/05/16 13:59, Victor Lazzarini wrote:
> yes, something that could go into the manual or even into the FLOSS manual.
> ========================
> Dr Victor Lazzarini
> Dean of Arts, Celtic Studies and Philosophy,
> Maynooth University,
> Maynooth, Co Kildare, Ireland
> Tel: 00 353 7086936
> Fax: 00 353 1 7086952
>
>> On 10 May 2016, at 08:50, Oeyvind Brandtsegg  wrote:
>>
>> I wonder how this could be documented so users don't stumble upon this
>> unknowingly.
>> As mentioned, this happened to some students working on an exam, when
>> they tried to build a keyboard split samples instrument (different
>> sounds for each key on the midi keyboard).They have not specifically
>> been taught how to do that, but musical need caused experimentation
>> and they did what they could. I must admit their assumption that this
>> should work is not totally unreasonable. Which is why it would be good
>> to document it somehow(?)
>>
>> 2016-05-10 9:38 GMT+02:00 Oeyvind Brandtsegg :
>>> Hi Victor,
>>> Thanks for the clarification.
>>> I was just surprised that this happens across instrument instances,
>>> i.e. that the audio variables are not zeroed when the next instance
>>> starts.
>>>
>>> 2016-05-10 9:19 GMT+02:00 Victor Lazzarini :
>>>> yes, any perf time var (a or otherwise) will hold its last value. For this reason if we want for instance to switch off audio, we need to zero a variable when we stop filling it, e.g.
>>>>
>>>> if k1 < iend then
>>>> a1 oscili ...
>>>> else
>>>> a1 = 0
>>>> endif
>>>> out a1
>>>>
>>>> without the else part, whatever was last put in the a1 variable will be looped over and over each kcycle.
>>>>
>>>> Victor Lazzarini
>>>> Dean of Arts, Celtic Studies, and Philosophy
>>>> Maynooth University
>>>> Ireland
>>>>
>>>>> On 10 May 2016, at 07:46, Oeyvind Brandtsegg  wrote:
>>>>>
>>>>> Hi,
>>>>> Are audio variables saved between instrument instances?
>>>>> It may seem so from the example below, where I use a conditional to
>>>>> selectively process a section of the instrument. The first and second
>>>>> instances plays cleanly, then I change the conditional on the third
>>>>> instance and it seems like the audio variable a1 keeps its last ksmps
>>>>> values (from instrument instance number two). Similarly, instance 5
>>>>> has a residue of the last ksmps audio samples in the variable a2.
>>>>>
>>>>> Is this related to how conditionals are processed? I tried changing
>>>>> the conditional to k-rate, and the audio output is the same.
>>>>> This is not really the way I would have programmed this kind of signal
>>>>> switching, but some of our students stumbled upon this issue while
>>>>> they were experimenting.
>>>>>
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>>
>>>>> sr = 44100
>>>>> ksmps = 10
>>>>> nchnls = 2
>>>>> 0dbfs = 1
>>>>>
>>>>> giSine ftgen 0, 0, 65536, 10, 1
>>>>>
>>>>> instr 1
>>>>>        ;a1 = 0
>>>>>        ;a2 = 0
>>>>>        i1 = p4
>>>>>        if i1 == 0 then
>>>>>        a1 poscil 0.5, 220, giSine
>>>>>        endif
>>>>>        if i1 == 1 then
>>>>>        a2 poscil 0.5, 2500, giSine
>>>>>        endif
>>>>> outs a1, a2
>>>>> endin
>>>>>
>>>>> 
>>>>> 
>>>>> ; start dur     num
>>>>> i1 0 .1 0
>>>>> i1 1 . 0
>>>>> i1 2 . 1
>>>>> i1 3 . 1
>>>>> i1 4 . 0
>>>>> i1 5 . 0
>>>>> i1 6 . 1
>>>>> i1 7 . 1
>>>>> e
>>>>>
>>>>> 
>>>>> 
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> Oeyvind Brandtsegg
>>>>> Professor of Music Technology
>>>>> NTNU
>>>>> 7491 Trondheim
>>>>> Norway
>>>>> Cell: +47 92 203 205
>>>>>
>>>>> http://www.partikkelaudio.com/
>>>>> http://soundcloud.com/brandtsegg
>>>>> http://flyndresang.no/
>>>>> http://soundcloud.com/t-emp
>>>>>
>>>>> Csound mailing list
>>>>> Csound@listserv.heanet.ie
>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>> Send bugs reports to
>>>>>        https://github.com/csound/csound/issues
>>>>> Discussions of bugs and features can be posted here
>>>>
>>>> Csound mailing list
>>>> Csound@listserv.heanet.ie
>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>> Send bugs reports to
>>>>         https://github.com/csound/csound/issues
>>>> Discussions of bugs and features can be posted here
>>>
>>>
>>>
>>> --
>>>
>>> Oeyvind Brandtsegg
>>> Professor of Music Technology
>>> NTNU
>>> 7491 Trondheim
>>> Norway
>>> Cell: +47 92 203 205
>>>
>>> http://www.partikkelaudio.com/
>>> http://soundcloud.com/brandtsegg
>>> http://flyndresang.no/
>>> http://soundcloud.com/t-emp
>>
>>
>>
>> --
>>
>> Oeyvind Brandtsegg
>> Professor of Music Technology
>> NTNU
>> 7491 Trondheim
>> Norway
>> Cell: +47 92 203 205
>>
>> http://www.partikkelaudio.com/
>> http://soundcloud.com/brandtsegg
>> http://flyndresang.no/
>> http://soundcloud.com/t-emp
>>
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>         https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>          https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2016-05-11 22:43
FromOeyvind Brandtsegg
SubjectRe: conditionals and audio signals
Hi Joachim, thanks for the link. I must admit I had not read that part
of the Floss manual with enough focus. It is very nice and
informative, with good examples. As far as I can see they are all
k-rate. Maybe an a-rate example could be used to show that also a-rate
vectors keep their contents until explicitly overwritten? Something
like the csd I posted at the start of this thread could do(?)

There is also a lure in the formulation "Whenever a Csound instrument
is called, all variables are set to initial values. This is called the
initialization pass.",
as it can lead one to think (as I did, wrongly) that all variables are
reset whenever a new instance starts.
Not sure how to phrase it better though :-)



2016-05-10 22:05 GMT+02:00 joachim heintz :
> i have written something about it in the floss manual, as i came across
> this, too, some time ago:
> http://floss.booktype.pro/csound/a-initialization-and-performance-pass/
>
> "What happens on a k-variable if an instrument is called multiple times?
> What is the initialization value of this variable on the first call, and on
> the subsequent calls?
>
> If this variable is not set explicitely, the init value in the first call of
> an instrument is zero, as usual. But, for the next calls, the k-variable is
> initialized to the value which was left when the previous instance of the
> same instrument turned off."
>
> and see the examples 03A08, 03A09 and 03A10.
>
> let me know if something can be expressed better, or is missing.
>
>         joachim
>
>
>
>
> On 10/05/16 13:59, Victor Lazzarini wrote:
>>
>> yes, something that could go into the manual or even into the FLOSS
>> manual.
>> ========================
>> Dr Victor Lazzarini
>> Dean of Arts, Celtic Studies and Philosophy,
>> Maynooth University,
>> Maynooth, Co Kildare, Ireland
>> Tel: 00 353 7086936
>> Fax: 00 353 1 7086952
>>
>>> On 10 May 2016, at 08:50, Oeyvind Brandtsegg 
>>> wrote:
>>>
>>> I wonder how this could be documented so users don't stumble upon this
>>> unknowingly.
>>> As mentioned, this happened to some students working on an exam, when
>>> they tried to build a keyboard split samples instrument (different
>>> sounds for each key on the midi keyboard).They have not specifically
>>> been taught how to do that, but musical need caused experimentation
>>> and they did what they could. I must admit their assumption that this
>>> should work is not totally unreasonable. Which is why it would be good
>>> to document it somehow(?)
>>>
>>> 2016-05-10 9:38 GMT+02:00 Oeyvind Brandtsegg :
>>>>
>>>> Hi Victor,
>>>> Thanks for the clarification.
>>>> I was just surprised that this happens across instrument instances,
>>>> i.e. that the audio variables are not zeroed when the next instance
>>>> starts.
>>>>
>>>> 2016-05-10 9:19 GMT+02:00 Victor Lazzarini :
>>>>>
>>>>> yes, any perf time var (a or otherwise) will hold its last value. For
>>>>> this reason if we want for instance to switch off audio, we need to zero a
>>>>> variable when we stop filling it, e.g.
>>>>>
>>>>> if k1 < iend then
>>>>> a1 oscili ...
>>>>> else
>>>>> a1 = 0
>>>>> endif
>>>>> out a1
>>>>>
>>>>> without the else part, whatever was last put in the a1 variable will be
>>>>> looped over and over each kcycle.
>>>>>
>>>>> Victor Lazzarini
>>>>> Dean of Arts, Celtic Studies, and Philosophy
>>>>> Maynooth University
>>>>> Ireland
>>>>>
>>>>>> On 10 May 2016, at 07:46, Oeyvind Brandtsegg
>>>>>>  wrote:
>>>>>>
>>>>>> Hi,
>>>>>> Are audio variables saved between instrument instances?
>>>>>> It may seem so from the example below, where I use a conditional to
>>>>>> selectively process a section of the instrument. The first and second
>>>>>> instances plays cleanly, then I change the conditional on the third
>>>>>> instance and it seems like the audio variable a1 keeps its last ksmps
>>>>>> values (from instrument instance number two). Similarly, instance 5
>>>>>> has a residue of the last ksmps audio samples in the variable a2.
>>>>>>
>>>>>> Is this related to how conditionals are processed? I tried changing
>>>>>> the conditional to k-rate, and the audio output is the same.
>>>>>> This is not really the way I would have programmed this kind of signal
>>>>>> switching, but some of our students stumbled upon this issue while
>>>>>> they were experimenting.
>>>>>>
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>
>>>>>> sr = 44100
>>>>>> ksmps = 10
>>>>>> nchnls = 2
>>>>>> 0dbfs = 1
>>>>>>
>>>>>> giSine ftgen 0, 0, 65536, 10, 1
>>>>>>
>>>>>> instr 1
>>>>>>        ;a1 = 0
>>>>>>        ;a2 = 0
>>>>>>        i1 = p4
>>>>>>        if i1 == 0 then
>>>>>>        a1 poscil 0.5, 220, giSine
>>>>>>        endif
>>>>>>        if i1 == 1 then
>>>>>>        a2 poscil 0.5, 2500, giSine
>>>>>>        endif
>>>>>> outs a1, a2
>>>>>> endin
>>>>>>
>>>>>> 
>>>>>> 
>>>>>> ; start dur     num
>>>>>> i1 0 .1 0
>>>>>> i1 1 . 0
>>>>>> i1 2 . 1
>>>>>> i1 3 . 1
>>>>>> i1 4 . 0
>>>>>> i1 5 . 0
>>>>>> i1 6 . 1
>>>>>> i1 7 . 1
>>>>>> e
>>>>>>
>>>>>> 
>>>>>> 
>>>>>>
>>>>>>
>>>>>> --
>>>>>>
>>>>>> Oeyvind Brandtsegg
>>>>>> Professor of Music Technology
>>>>>> NTNU
>>>>>> 7491 Trondheim
>>>>>> Norway
>>>>>> Cell: +47 92 203 205
>>>>>>
>>>>>> http://www.partikkelaudio.com/
>>>>>> http://soundcloud.com/brandtsegg
>>>>>> http://flyndresang.no/
>>>>>> http://soundcloud.com/t-emp
>>>>>>
>>>>>> Csound mailing list
>>>>>> Csound@listserv.heanet.ie
>>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>>> Send bugs reports to
>>>>>>        https://github.com/csound/csound/issues
>>>>>> Discussions of bugs and features can be posted here
>>>>>
>>>>>
>>>>> Csound mailing list
>>>>> Csound@listserv.heanet.ie
>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>> Send bugs reports to
>>>>>         https://github.com/csound/csound/issues
>>>>> Discussions of bugs and features can be posted here
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> Oeyvind Brandtsegg
>>>> Professor of Music Technology
>>>> NTNU
>>>> 7491 Trondheim
>>>> Norway
>>>> Cell: +47 92 203 205
>>>>
>>>> http://www.partikkelaudio.com/
>>>> http://soundcloud.com/brandtsegg
>>>> http://flyndresang.no/
>>>> http://soundcloud.com/t-emp
>>>
>>>
>>>
>>>
>>> --
>>>
>>> Oeyvind Brandtsegg
>>> Professor of Music Technology
>>> NTNU
>>> 7491 Trondheim
>>> Norway
>>> Cell: +47 92 203 205
>>>
>>> http://www.partikkelaudio.com/
>>> http://soundcloud.com/brandtsegg
>>> http://flyndresang.no/
>>> http://soundcloud.com/t-emp
>>>
>>> Csound mailing list
>>> Csound@listserv.heanet.ie
>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>> Send bugs reports to
>>>         https://github.com/csound/csound/issues
>>> Discussions of bugs and features can be posted here
>>
>>
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>          https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>>
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here


Date2016-05-11 23:08
FromVictor Lazzarini
SubjectRe: conditionals and audio signals
All variables that are initialised:

a1 init 0  is an init-pass op
a1 = 0 is a perf-pass op

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

> On 11 May 2016, at 22:43, Oeyvind Brandtsegg  wrote:
> 
> Hi Joachim, thanks for the link. I must admit I had not read that part
> of the Floss manual with enough focus. It is very nice and
> informative, with good examples. As far as I can see they are all
> k-rate. Maybe an a-rate example could be used to show that also a-rate
> vectors keep their contents until explicitly overwritten? Something
> like the csd I posted at the start of this thread could do(?)
> 
> There is also a lure in the formulation "Whenever a Csound instrument
> is called, all variables are set to initial values. This is called the
> initialization pass.",
> as it can lead one to think (as I did, wrongly) that all variables are
> reset whenever a new instance starts.
> Not sure how to phrase it better though :-)
> 
> 
> 
> 2016-05-10 22:05 GMT+02:00 joachim heintz :
>> i have written something about it in the floss manual, as i came across
>> this, too, some time ago:
>> http://floss.booktype.pro/csound/a-initialization-and-performance-pass/
>> 
>> "What happens on a k-variable if an instrument is called multiple times?
>> What is the initialization value of this variable on the first call, and on
>> the subsequent calls?
>> 
>> If this variable is not set explicitely, the init value in the first call of
>> an instrument is zero, as usual. But, for the next calls, the k-variable is
>> initialized to the value which was left when the previous instance of the
>> same instrument turned off."
>> 
>> and see the examples 03A08, 03A09 and 03A10.
>> 
>> let me know if something can be expressed better, or is missing.
>> 
>>        joachim
>> 
>> 
>> 
>> 
>>> On 10/05/16 13:59, Victor Lazzarini wrote:
>>> 
>>> yes, something that could go into the manual or even into the FLOSS
>>> manual.
>>> ========================
>>> Dr Victor Lazzarini
>>> Dean of Arts, Celtic Studies and Philosophy,
>>> Maynooth University,
>>> Maynooth, Co Kildare, Ireland
>>> Tel: 00 353 7086936
>>> Fax: 00 353 1 7086952
>>> 
>>>> On 10 May 2016, at 08:50, Oeyvind Brandtsegg 
>>>> wrote:
>>>> 
>>>> I wonder how this could be documented so users don't stumble upon this
>>>> unknowingly.
>>>> As mentioned, this happened to some students working on an exam, when
>>>> they tried to build a keyboard split samples instrument (different
>>>> sounds for each key on the midi keyboard).They have not specifically
>>>> been taught how to do that, but musical need caused experimentation
>>>> and they did what they could. I must admit their assumption that this
>>>> should work is not totally unreasonable. Which is why it would be good
>>>> to document it somehow(?)
>>>> 
>>>> 2016-05-10 9:38 GMT+02:00 Oeyvind Brandtsegg :
>>>>> 
>>>>> Hi Victor,
>>>>> Thanks for the clarification.
>>>>> I was just surprised that this happens across instrument instances,
>>>>> i.e. that the audio variables are not zeroed when the next instance
>>>>> starts.
>>>>> 
>>>>> 2016-05-10 9:19 GMT+02:00 Victor Lazzarini :
>>>>>> 
>>>>>> yes, any perf time var (a or otherwise) will hold its last value. For
>>>>>> this reason if we want for instance to switch off audio, we need to zero a
>>>>>> variable when we stop filling it, e.g.
>>>>>> 
>>>>>> if k1 < iend then
>>>>>> a1 oscili ...
>>>>>> else
>>>>>> a1 = 0
>>>>>> endif
>>>>>> out a1
>>>>>> 
>>>>>> without the else part, whatever was last put in the a1 variable will be
>>>>>> looped over and over each kcycle.
>>>>>> 
>>>>>> Victor Lazzarini
>>>>>> Dean of Arts, Celtic Studies, and Philosophy
>>>>>> Maynooth University
>>>>>> Ireland
>>>>>> 
>>>>>>> On 10 May 2016, at 07:46, Oeyvind Brandtsegg
>>>>>>>  wrote:
>>>>>>> 
>>>>>>> Hi,
>>>>>>> Are audio variables saved between instrument instances?
>>>>>>> It may seem so from the example below, where I use a conditional to
>>>>>>> selectively process a section of the instrument. The first and second
>>>>>>> instances plays cleanly, then I change the conditional on the third
>>>>>>> instance and it seems like the audio variable a1 keeps its last ksmps
>>>>>>> values (from instrument instance number two). Similarly, instance 5
>>>>>>> has a residue of the last ksmps audio samples in the variable a2.
>>>>>>> 
>>>>>>> Is this related to how conditionals are processed? I tried changing
>>>>>>> the conditional to k-rate, and the audio output is the same.
>>>>>>> This is not really the way I would have programmed this kind of signal
>>>>>>> switching, but some of our students stumbled upon this issue while
>>>>>>> they were experimenting.
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> sr = 44100
>>>>>>> ksmps = 10
>>>>>>> nchnls = 2
>>>>>>> 0dbfs = 1
>>>>>>> 
>>>>>>> giSine ftgen 0, 0, 65536, 10, 1
>>>>>>> 
>>>>>>> instr 1
>>>>>>>       ;a1 = 0
>>>>>>>       ;a2 = 0
>>>>>>>       i1 = p4
>>>>>>>       if i1 == 0 then
>>>>>>>       a1 poscil 0.5, 220, giSine
>>>>>>>       endif
>>>>>>>       if i1 == 1 then
>>>>>>>       a2 poscil 0.5, 2500, giSine
>>>>>>>       endif
>>>>>>> outs a1, a2
>>>>>>> endin
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> ; start dur     num
>>>>>>> i1 0 .1 0
>>>>>>> i1 1 . 0
>>>>>>> i1 2 . 1
>>>>>>> i1 3 . 1
>>>>>>> i1 4 . 0
>>>>>>> i1 5 . 0
>>>>>>> i1 6 . 1
>>>>>>> i1 7 . 1
>>>>>>> e
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> --
>>>>>>> 
>>>>>>> Oeyvind Brandtsegg
>>>>>>> Professor of Music Technology
>>>>>>> NTNU
>>>>>>> 7491 Trondheim
>>>>>>> Norway
>>>>>>> Cell: +47 92 203 205
>>>>>>> 
>>>>>>> http://www.partikkelaudio.com/
>>>>>>> http://soundcloud.com/brandtsegg
>>>>>>> http://flyndresang.no/
>>>>>>> http://soundcloud.com/t-emp
>>>>>>> 
>>>>>>> Csound mailing list
>>>>>>> Csound@listserv.heanet.ie
>>>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>>>> Send bugs reports to
>>>>>>>       https://github.com/csound/csound/issues
>>>>>>> Discussions of bugs and features can be posted here
>>>>>> 
>>>>>> 
>>>>>> Csound mailing list
>>>>>> Csound@listserv.heanet.ie
>>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>>> Send bugs reports to
>>>>>>        https://github.com/csound/csound/issues
>>>>>> Discussions of bugs and features can be posted here
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> 
>>>>> Oeyvind Brandtsegg
>>>>> Professor of Music Technology
>>>>> NTNU
>>>>> 7491 Trondheim
>>>>> Norway
>>>>> Cell: +47 92 203 205
>>>>> 
>>>>> http://www.partikkelaudio.com/
>>>>> http://soundcloud.com/brandtsegg
>>>>> http://flyndresang.no/
>>>>> http://soundcloud.com/t-emp
>>>> 
>>>> 
>>>> 
>>>> 
>>>> --
>>>> 
>>>> Oeyvind Brandtsegg
>>>> Professor of Music Technology
>>>> NTNU
>>>> 7491 Trondheim
>>>> Norway
>>>> Cell: +47 92 203 205
>>>> 
>>>> http://www.partikkelaudio.com/
>>>> http://soundcloud.com/brandtsegg
>>>> http://flyndresang.no/
>>>> http://soundcloud.com/t-emp
>>>> 
>>>> Csound mailing list
>>>> Csound@listserv.heanet.ie
>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>> Send bugs reports to
>>>>        https://github.com/csound/csound/issues
>>>> Discussions of bugs and features can be posted here
>>> 
>>> 
>>> Csound mailing list
>>> Csound@listserv.heanet.ie
>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>> Send bugs reports to
>>>         https://github.com/csound/csound/issues
>>> Discussions of bugs and features can be posted here
>> 
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>       https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
> 
> 
> 
> -- 
> 
> Oeyvind Brandtsegg
> Professor of Music Technology
> NTNU
> 7491 Trondheim
> Norway
> Cell: +47 92 203 205
> 
> http://www.partikkelaudio.com/
> http://soundcloud.com/brandtsegg
> http://flyndresang.no/
> http://soundcloud.com/t-emp
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2016-05-11 23:29
FromAlex Weiss
SubjectRe: conditionals and audio signals
For ivars, is there a difference between

i1 init 0 and i1 = 0?

Thanks,
Alex

On Wed, May 11, 2016 at 3:08 PM Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
All variables that are initialised:

a1 init 0  is an init-pass op
a1 = 0 is a perf-pass op

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

> On 11 May 2016, at 22:43, Oeyvind Brandtsegg <oyvind.brandtsegg@NTNU.NO> wrote:
>
> Hi Joachim, thanks for the link. I must admit I had not read that part
> of the Floss manual with enough focus. It is very nice and
> informative, with good examples. As far as I can see they are all
> k-rate. Maybe an a-rate example could be used to show that also a-rate
> vectors keep their contents until explicitly overwritten? Something
> like the csd I posted at the start of this thread could do(?)
>
> There is also a lure in the formulation "Whenever a Csound instrument
> is called, all variables are set to initial values. This is called the
> initialization pass.",
> as it can lead one to think (as I did, wrongly) that all variables are
> reset whenever a new instance starts.
> Not sure how to phrase it better though :-)
>
>
>
> 2016-05-10 22:05 GMT+02:00 joachim heintz <jh@joachimheintz.de>:
>> i have written something about it in the floss manual, as i came across
>> this, too, some time ago:
>> http://floss.booktype.pro/csound/a-initialization-and-performance-pass/
>>
>> "What happens on a k-variable if an instrument is called multiple times?
>> What is the initialization value of this variable on the first call, and on
>> the subsequent calls?
>>
>> If this variable is not set explicitely, the init value in the first call of
>> an instrument is zero, as usual. But, for the next calls, the k-variable is
>> initialized to the value which was left when the previous instance of the
>> same instrument turned off."
>>
>> and see the examples 03A08, 03A09 and 03A10.
>>
>> let me know if something can be expressed better, or is missing.
>>
>>        joachim
>>
>>
>>
>>
>>> On 10/05/16 13:59, Victor Lazzarini wrote:
>>>
>>> yes, something that could go into the manual or even into the FLOSS
>>> manual.
>>> ========================
>>> Dr Victor Lazzarini
>>> Dean of Arts, Celtic Studies and Philosophy,
>>> Maynooth University,
>>> Maynooth, Co Kildare, Ireland
>>> Tel: 00 353 7086936
>>> Fax: 00 353 1 7086952
>>>
>>>> On 10 May 2016, at 08:50, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no>
>>>> wrote:
>>>>
>>>> I wonder how this could be documented so users don't stumble upon this
>>>> unknowingly.
>>>> As mentioned, this happened to some students working on an exam, when
>>>> they tried to build a keyboard split samples instrument (different
>>>> sounds for each key on the midi keyboard).They have not specifically
>>>> been taught how to do that, but musical need caused experimentation
>>>> and they did what they could. I must admit their assumption that this
>>>> should work is not totally unreasonable. Which is why it would be good
>>>> to document it somehow(?)
>>>>
>>>> 2016-05-10 9:38 GMT+02:00 Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no>:
>>>>>
>>>>> Hi Victor,
>>>>> Thanks for the clarification.
>>>>> I was just surprised that this happens across instrument instances,
>>>>> i.e. that the audio variables are not zeroed when the next instance
>>>>> starts.
>>>>>
>>>>> 2016-05-10 9:19 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
>>>>>>
>>>>>> yes, any perf time var (a or otherwise) will hold its last value. For
>>>>>> this reason if we want for instance to switch off audio, we need to zero a
>>>>>> variable when we stop filling it, e.g.
>>>>>>
>>>>>> if k1 < iend then
>>>>>> a1 oscili ...
>>>>>> else
>>>>>> a1 = 0
>>>>>> endif
>>>>>> out a1
>>>>>>
>>>>>> without the else part, whatever was last put in the a1 variable will be
>>>>>> looped over and over each kcycle.
>>>>>>
>>>>>> Victor Lazzarini
>>>>>> Dean of Arts, Celtic Studies, and Philosophy
>>>>>> Maynooth University
>>>>>> Ireland
>>>>>>
>>>>>>> On 10 May 2016, at 07:46, Oeyvind Brandtsegg
>>>>>>> <oyvind.brandtsegg@NTNU.NO> wrote:
>>>>>>>
>>>>>>> Hi,
>>>>>>> Are audio variables saved between instrument instances?
>>>>>>> It may seem so from the example below, where I use a conditional to
>>>>>>> selectively process a section of the instrument. The first and second
>>>>>>> instances plays cleanly, then I change the conditional on the third
>>>>>>> instance and it seems like the audio variable a1 keeps its last ksmps
>>>>>>> values (from instrument instance number two). Similarly, instance 5
>>>>>>> has a residue of the last ksmps audio samples in the variable a2.
>>>>>>>
>>>>>>> Is this related to how conditionals are processed? I tried changing
>>>>>>> the conditional to k-rate, and the audio output is the same.
>>>>>>> This is not really the way I would have programmed this kind of signal
>>>>>>> switching, but some of our students stumbled upon this issue while
>>>>>>> they were experimenting.
>>>>>>>
>>>>>>> <CsoundSynthesizer>
>>>>>>> <CsOptions>
>>>>>>> </CsOptions>
>>>>>>> <CsInstruments>
>>>>>>>
>>>>>>> sr = 44100
>>>>>>> ksmps = 10
>>>>>>> nchnls = 2
>>>>>>> 0dbfs = 1
>>>>>>>
>>>>>>> giSine ftgen 0, 0, 65536, 10, 1
>>>>>>>
>>>>>>> instr 1
>>>>>>>       ;a1 = 0
>>>>>>>       ;a2 = 0
>>>>>>>       i1 = p4
>>>>>>>       if i1 == 0 then
>>>>>>>       a1 poscil 0.5, 220, giSine
>>>>>>>       endif
>>>>>>>       if i1 == 1 then
>>>>>>>       a2 poscil 0.5, 2500, giSine
>>>>>>>       endif
>>>>>>> outs a1, a2
>>>>>>> endin
>>>>>>>
>>>>>>> </CsInstruments>
>>>>>>> <CsScore>
>>>>>>> ; start dur     num
>>>>>>> i1 0 .1 0
>>>>>>> i1 1 . 0
>>>>>>> i1 2 . 1
>>>>>>> i1 3 . 1
>>>>>>> i1 4 . 0
>>>>>>> i1 5 . 0
>>>>>>> i1 6 . 1
>>>>>>> i1 7 . 1
>>>>>>> e
>>>>>>>
>>>>>>> </CsScore>
>>>>>>> </CsoundSynthesizer>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>> Oeyvind Brandtsegg
>>>>>>> Professor of Music Technology
>>>>>>> NTNU
>>>>>>> 7491 Trondheim
>>>>>>> Norway
>>>>>>> Cell: +47 92 203 205
>>>>>>>
>>>>>>> http://www.partikkelaudio.com/
>>>>>>> http://soundcloud.com/brandtsegg
>>>>>>> http://flyndresang.no/
>>>>>>> http://soundcloud.com/t-emp
>>>>>>>
>>>>>>> Csound mailing list
>>>>>>> Csound@listserv.heanet.ie
>>>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>>>> Send bugs reports to
>>>>>>>       https://github.com/csound/csound/issues
>>>>>>> Discussions of bugs and features can be posted here
>>>>>>
>>>>>>
>>>>>> Csound mailing list
>>>>>> Csound@listserv.heanet.ie
>>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>>> Send bugs reports to
>>>>>>        https://github.com/csound/csound/issues
>>>>>> Discussions of bugs and features can be posted here
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> Oeyvind Brandtsegg
>>>>> Professor of Music Technology
>>>>> NTNU
>>>>> 7491 Trondheim
>>>>> Norway
>>>>> Cell: +47 92 203 205
>>>>>
>>>>> http://www.partikkelaudio.com/
>>>>> http://soundcloud.com/brandtsegg
>>>>> http://flyndresang.no/
>>>>> http://soundcloud.com/t-emp
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> Oeyvind Brandtsegg
>>>> Professor of Music Technology
>>>> NTNU
>>>> 7491 Trondheim
>>>> Norway
>>>> Cell: +47 92 203 205
>>>>
>>>> http://www.partikkelaudio.com/
>>>> http://soundcloud.com/brandtsegg
>>>> http://flyndresang.no/
>>>> http://soundcloud.com/t-emp
>>>>
>>>> Csound mailing list
>>>> Csound@listserv.heanet.ie
>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>> Send bugs reports to
>>>>        https://github.com/csound/csound/issues
>>>> Discussions of bugs and features can be posted here
>>>
>>>
>>> Csound mailing list
>>> Csound@listserv.heanet.ie
>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>> Send bugs reports to
>>>         https://github.com/csound/csound/issues
>>> Discussions of bugs and features can be posted here
>>
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>       https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>
>
>
> --
>
> Oeyvind Brandtsegg
> Professor of Music Technology
> NTNU
> 7491 Trondheim
> Norway
> Cell: +47 92 203 205
>
> http://www.partikkelaudio.com/
> http://soundcloud.com/brandtsegg
> http://flyndresang.no/
> http://soundcloud.com/t-emp
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2016-05-11 23:53
FromOeyvind Brandtsegg
SubjectRe: conditionals and audio signals
Indeed, when commenting on the text description I just meant that it
can be assumed from:
"Whenever a Csound instrument is called, all variables are set to
initial values."
... that all variables are somehow implicitly initialized
I know that they are not, it was just a comment on how the description
can be interpreted by a novice reader.

2016-05-12 0:08 GMT+02:00 Victor Lazzarini :
> All variables that are initialised:
>
> a1 init 0  is an init-pass op
> a1 = 0 is a perf-pass op
>
> Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy
> Maynooth University
> Ireland
>
>> On 11 May 2016, at 22:43, Oeyvind Brandtsegg  wrote:
>>
>> Hi Joachim, thanks for the link. I must admit I had not read that part
>> of the Floss manual with enough focus. It is very nice and
>> informative, with good examples. As far as I can see they are all
>> k-rate. Maybe an a-rate example could be used to show that also a-rate
>> vectors keep their contents until explicitly overwritten? Something
>> like the csd I posted at the start of this thread could do(?)
>>
>> There is also a lure in the formulation "Whenever a Csound instrument
>> is called, all variables are set to initial values. This is called the
>> initialization pass.",
>> as it can lead one to think (as I did, wrongly) that all variables are
>> reset whenever a new instance starts.
>> Not sure how to phrase it better though :-)
>>
>>
>>
>> 2016-05-10 22:05 GMT+02:00 joachim heintz :
>>> i have written something about it in the floss manual, as i came across
>>> this, too, some time ago:
>>> http://floss.booktype.pro/csound/a-initialization-and-performance-pass/
>>>
>>> "What happens on a k-variable if an instrument is called multiple times?
>>> What is the initialization value of this variable on the first call, and on
>>> the subsequent calls?
>>>
>>> If this variable is not set explicitely, the init value in the first call of
>>> an instrument is zero, as usual. But, for the next calls, the k-variable is
>>> initialized to the value which was left when the previous instance of the
>>> same instrument turned off."
>>>
>>> and see the examples 03A08, 03A09 and 03A10.
>>>
>>> let me know if something can be expressed better, or is missing.
>>>
>>>        joachim
>>>
>>>
>>>
>>>
>>>> On 10/05/16 13:59, Victor Lazzarini wrote:
>>>>
>>>> yes, something that could go into the manual or even into the FLOSS
>>>> manual.
>>>> ========================
>>>> Dr Victor Lazzarini
>>>> Dean of Arts, Celtic Studies and Philosophy,
>>>> Maynooth University,
>>>> Maynooth, Co Kildare, Ireland
>>>> Tel: 00 353 7086936
>>>> Fax: 00 353 1 7086952
>>>>
>>>>> On 10 May 2016, at 08:50, Oeyvind Brandtsegg 
>>>>> wrote:
>>>>>
>>>>> I wonder how this could be documented so users don't stumble upon this
>>>>> unknowingly.
>>>>> As mentioned, this happened to some students working on an exam, when
>>>>> they tried to build a keyboard split samples instrument (different
>>>>> sounds for each key on the midi keyboard).They have not specifically
>>>>> been taught how to do that, but musical need caused experimentation
>>>>> and they did what they could. I must admit their assumption that this
>>>>> should work is not totally unreasonable. Which is why it would be good
>>>>> to document it somehow(?)
>>>>>
>>>>> 2016-05-10 9:38 GMT+02:00 Oeyvind Brandtsegg :
>>>>>>
>>>>>> Hi Victor,
>>>>>> Thanks for the clarification.
>>>>>> I was just surprised that this happens across instrument instances,
>>>>>> i.e. that the audio variables are not zeroed when the next instance
>>>>>> starts.
>>>>>>
>>>>>> 2016-05-10 9:19 GMT+02:00 Victor Lazzarini :
>>>>>>>
>>>>>>> yes, any perf time var (a or otherwise) will hold its last value. For
>>>>>>> this reason if we want for instance to switch off audio, we need to zero a
>>>>>>> variable when we stop filling it, e.g.
>>>>>>>
>>>>>>> if k1 < iend then
>>>>>>> a1 oscili ...
>>>>>>> else
>>>>>>> a1 = 0
>>>>>>> endif
>>>>>>> out a1
>>>>>>>
>>>>>>> without the else part, whatever was last put in the a1 variable will be
>>>>>>> looped over and over each kcycle.
>>>>>>>
>>>>>>> Victor Lazzarini
>>>>>>> Dean of Arts, Celtic Studies, and Philosophy
>>>>>>> Maynooth University
>>>>>>> Ireland
>>>>>>>
>>>>>>>> On 10 May 2016, at 07:46, Oeyvind Brandtsegg
>>>>>>>>  wrote:
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>> Are audio variables saved between instrument instances?
>>>>>>>> It may seem so from the example below, where I use a conditional to
>>>>>>>> selectively process a section of the instrument. The first and second
>>>>>>>> instances plays cleanly, then I change the conditional on the third
>>>>>>>> instance and it seems like the audio variable a1 keeps its last ksmps
>>>>>>>> values (from instrument instance number two). Similarly, instance 5
>>>>>>>> has a residue of the last ksmps audio samples in the variable a2.
>>>>>>>>
>>>>>>>> Is this related to how conditionals are processed? I tried changing
>>>>>>>> the conditional to k-rate, and the audio output is the same.
>>>>>>>> This is not really the way I would have programmed this kind of signal
>>>>>>>> switching, but some of our students stumbled upon this issue while
>>>>>>>> they were experimenting.
>>>>>>>>
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>>
>>>>>>>> sr = 44100
>>>>>>>> ksmps = 10
>>>>>>>> nchnls = 2
>>>>>>>> 0dbfs = 1
>>>>>>>>
>>>>>>>> giSine ftgen 0, 0, 65536, 10, 1
>>>>>>>>
>>>>>>>> instr 1
>>>>>>>>       ;a1 = 0
>>>>>>>>       ;a2 = 0
>>>>>>>>       i1 = p4
>>>>>>>>       if i1 == 0 then
>>>>>>>>       a1 poscil 0.5, 220, giSine
>>>>>>>>       endif
>>>>>>>>       if i1 == 1 then
>>>>>>>>       a2 poscil 0.5, 2500, giSine
>>>>>>>>       endif
>>>>>>>> outs a1, a2
>>>>>>>> endin
>>>>>>>>
>>>>>>>> 
>>>>>>>> 
>>>>>>>> ; start dur     num
>>>>>>>> i1 0 .1 0
>>>>>>>> i1 1 . 0
>>>>>>>> i1 2 . 1
>>>>>>>> i1 3 . 1
>>>>>>>> i1 4 . 0
>>>>>>>> i1 5 . 0
>>>>>>>> i1 6 . 1
>>>>>>>> i1 7 . 1
>>>>>>>> e
>>>>>>>>
>>>>>>>> 
>>>>>>>> 
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>>>>>> Oeyvind Brandtsegg
>>>>>>>> Professor of Music Technology
>>>>>>>> NTNU
>>>>>>>> 7491 Trondheim
>>>>>>>> Norway
>>>>>>>> Cell: +47 92 203 205
>>>>>>>>
>>>>>>>> http://www.partikkelaudio.com/
>>>>>>>> http://soundcloud.com/brandtsegg
>>>>>>>> http://flyndresang.no/
>>>>>>>> http://soundcloud.com/t-emp
>>>>>>>>
>>>>>>>> Csound mailing list
>>>>>>>> Csound@listserv.heanet.ie
>>>>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>>>>> Send bugs reports to
>>>>>>>>       https://github.com/csound/csound/issues
>>>>>>>> Discussions of bugs and features can be posted here
>>>>>>>
>>>>>>>
>>>>>>> Csound mailing list
>>>>>>> Csound@listserv.heanet.ie
>>>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>>>> Send bugs reports to
>>>>>>>        https://github.com/csound/csound/issues
>>>>>>> Discussions of bugs and features can be posted here
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>>
>>>>>> Oeyvind Brandtsegg
>>>>>> Professor of Music Technology
>>>>>> NTNU
>>>>>> 7491 Trondheim
>>>>>> Norway
>>>>>> Cell: +47 92 203 205
>>>>>>
>>>>>> http://www.partikkelaudio.com/
>>>>>> http://soundcloud.com/brandtsegg
>>>>>> http://flyndresang.no/
>>>>>> http://soundcloud.com/t-emp
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> Oeyvind Brandtsegg
>>>>> Professor of Music Technology
>>>>> NTNU
>>>>> 7491 Trondheim
>>>>> Norway
>>>>> Cell: +47 92 203 205
>>>>>
>>>>> http://www.partikkelaudio.com/
>>>>> http://soundcloud.com/brandtsegg
>>>>> http://flyndresang.no/
>>>>> http://soundcloud.com/t-emp
>>>>>
>>>>> Csound mailing list
>>>>> Csound@listserv.heanet.ie
>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>> Send bugs reports to
>>>>>        https://github.com/csound/csound/issues
>>>>> Discussions of bugs and features can be posted here
>>>>
>>>>
>>>> Csound mailing list
>>>> Csound@listserv.heanet.ie
>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>> Send bugs reports to
>>>>         https://github.com/csound/csound/issues
>>>> Discussions of bugs and features can be posted here
>>>
>>> Csound mailing list
>>> Csound@listserv.heanet.ie
>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>> Send bugs reports to
>>>       https://github.com/csound/csound/issues
>>> Discussions of bugs and features can be posted here
>>
>>
>>
>> --
>>
>> Oeyvind Brandtsegg
>> Professor of Music Technology
>> NTNU
>> 7491 Trondheim
>> Norway
>> Cell: +47 92 203 205
>>
>> http://www.partikkelaudio.com/
>> http://soundcloud.com/brandtsegg
>> http://flyndresang.no/
>> http://soundcloud.com/t-emp
>>
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>        https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here


Date2016-05-12 08:47
Fromjoachim heintz
SubjectRe: conditionals and audio signals
thanks oeyvind, that's a very good idea.  i will insert this and let you 
check the phrases then.
cheers -
	joachim


On 11/05/16 23:43, Oeyvind Brandtsegg wrote:
> Hi Joachim, thanks for the link. I must admit I had not read that part
> of the Floss manual with enough focus. It is very nice and
> informative, with good examples. As far as I can see they are all
> k-rate. Maybe an a-rate example could be used to show that also a-rate
> vectors keep their contents until explicitly overwritten? Something
> like the csd I posted at the start of this thread could do(?)
>
> There is also a lure in the formulation "Whenever a Csound instrument
> is called, all variables are set to initial values. This is called the
> initialization pass.",
> as it can lead one to think (as I did, wrongly) that all variables are
> reset whenever a new instance starts.
> Not sure how to phrase it better though :-)
>
>
>
> 2016-05-10 22:05 GMT+02:00 joachim heintz :
>> i have written something about it in the floss manual, as i came across
>> this, too, some time ago:
>> http://floss.booktype.pro/csound/a-initialization-and-performance-pass/
>>
>> "What happens on a k-variable if an instrument is called multiple times?
>> What is the initialization value of this variable on the first call, and on
>> the subsequent calls?
>>
>> If this variable is not set explicitely, the init value in the first call of
>> an instrument is zero, as usual. But, for the next calls, the k-variable is
>> initialized to the value which was left when the previous instance of the
>> same instrument turned off."
>>
>> and see the examples 03A08, 03A09 and 03A10.
>>
>> let me know if something can be expressed better, or is missing.
>>
>>          joachim
>>
>>
>>
>>
>> On 10/05/16 13:59, Victor Lazzarini wrote:
>>>
>>> yes, something that could go into the manual or even into the FLOSS
>>> manual.
>>> ========================
>>> Dr Victor Lazzarini
>>> Dean of Arts, Celtic Studies and Philosophy,
>>> Maynooth University,
>>> Maynooth, Co Kildare, Ireland
>>> Tel: 00 353 7086936
>>> Fax: 00 353 1 7086952
>>>
>>>> On 10 May 2016, at 08:50, Oeyvind Brandtsegg 
>>>> wrote:
>>>>
>>>> I wonder how this could be documented so users don't stumble upon this
>>>> unknowingly.
>>>> As mentioned, this happened to some students working on an exam, when
>>>> they tried to build a keyboard split samples instrument (different
>>>> sounds for each key on the midi keyboard).They have not specifically
>>>> been taught how to do that, but musical need caused experimentation
>>>> and they did what they could. I must admit their assumption that this
>>>> should work is not totally unreasonable. Which is why it would be good
>>>> to document it somehow(?)
>>>>
>>>> 2016-05-10 9:38 GMT+02:00 Oeyvind Brandtsegg :
>>>>>
>>>>> Hi Victor,
>>>>> Thanks for the clarification.
>>>>> I was just surprised that this happens across instrument instances,
>>>>> i.e. that the audio variables are not zeroed when the next instance
>>>>> starts.
>>>>>
>>>>> 2016-05-10 9:19 GMT+02:00 Victor Lazzarini :
>>>>>>
>>>>>> yes, any perf time var (a or otherwise) will hold its last value. For
>>>>>> this reason if we want for instance to switch off audio, we need to zero a
>>>>>> variable when we stop filling it, e.g.
>>>>>>
>>>>>> if k1 < iend then
>>>>>> a1 oscili ...
>>>>>> else
>>>>>> a1 = 0
>>>>>> endif
>>>>>> out a1
>>>>>>
>>>>>> without the else part, whatever was last put in the a1 variable will be
>>>>>> looped over and over each kcycle.
>>>>>>
>>>>>> Victor Lazzarini
>>>>>> Dean of Arts, Celtic Studies, and Philosophy
>>>>>> Maynooth University
>>>>>> Ireland
>>>>>>
>>>>>>> On 10 May 2016, at 07:46, Oeyvind Brandtsegg
>>>>>>>  wrote:
>>>>>>>
>>>>>>> Hi,
>>>>>>> Are audio variables saved between instrument instances?
>>>>>>> It may seem so from the example below, where I use a conditional to
>>>>>>> selectively process a section of the instrument. The first and second
>>>>>>> instances plays cleanly, then I change the conditional on the third
>>>>>>> instance and it seems like the audio variable a1 keeps its last ksmps
>>>>>>> values (from instrument instance number two). Similarly, instance 5
>>>>>>> has a residue of the last ksmps audio samples in the variable a2.
>>>>>>>
>>>>>>> Is this related to how conditionals are processed? I tried changing
>>>>>>> the conditional to k-rate, and the audio output is the same.
>>>>>>> This is not really the way I would have programmed this kind of signal
>>>>>>> switching, but some of our students stumbled upon this issue while
>>>>>>> they were experimenting.
>>>>>>>
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>>
>>>>>>> sr = 44100
>>>>>>> ksmps = 10
>>>>>>> nchnls = 2
>>>>>>> 0dbfs = 1
>>>>>>>
>>>>>>> giSine ftgen 0, 0, 65536, 10, 1
>>>>>>>
>>>>>>> instr 1
>>>>>>>         ;a1 = 0
>>>>>>>         ;a2 = 0
>>>>>>>         i1 = p4
>>>>>>>         if i1 == 0 then
>>>>>>>         a1 poscil 0.5, 220, giSine
>>>>>>>         endif
>>>>>>>         if i1 == 1 then
>>>>>>>         a2 poscil 0.5, 2500, giSine
>>>>>>>         endif
>>>>>>> outs a1, a2
>>>>>>> endin
>>>>>>>
>>>>>>> 
>>>>>>> 
>>>>>>> ; start dur     num
>>>>>>> i1 0 .1 0
>>>>>>> i1 1 . 0
>>>>>>> i1 2 . 1
>>>>>>> i1 3 . 1
>>>>>>> i1 4 . 0
>>>>>>> i1 5 . 0
>>>>>>> i1 6 . 1
>>>>>>> i1 7 . 1
>>>>>>> e
>>>>>>>
>>>>>>> 
>>>>>>> 
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>> Oeyvind Brandtsegg
>>>>>>> Professor of Music Technology
>>>>>>> NTNU
>>>>>>> 7491 Trondheim
>>>>>>> Norway
>>>>>>> Cell: +47 92 203 205
>>>>>>>
>>>>>>> http://www.partikkelaudio.com/
>>>>>>> http://soundcloud.com/brandtsegg
>>>>>>> http://flyndresang.no/
>>>>>>> http://soundcloud.com/t-emp
>>>>>>>
>>>>>>> Csound mailing list
>>>>>>> Csound@listserv.heanet.ie
>>>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>>>> Send bugs reports to
>>>>>>>         https://github.com/csound/csound/issues
>>>>>>> Discussions of bugs and features can be posted here
>>>>>>
>>>>>>
>>>>>> Csound mailing list
>>>>>> Csound@listserv.heanet.ie
>>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>>> Send bugs reports to
>>>>>>          https://github.com/csound/csound/issues
>>>>>> Discussions of bugs and features can be posted here
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> Oeyvind Brandtsegg
>>>>> Professor of Music Technology
>>>>> NTNU
>>>>> 7491 Trondheim
>>>>> Norway
>>>>> Cell: +47 92 203 205
>>>>>
>>>>> http://www.partikkelaudio.com/
>>>>> http://soundcloud.com/brandtsegg
>>>>> http://flyndresang.no/
>>>>> http://soundcloud.com/t-emp
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> Oeyvind Brandtsegg
>>>> Professor of Music Technology
>>>> NTNU
>>>> 7491 Trondheim
>>>> Norway
>>>> Cell: +47 92 203 205
>>>>
>>>> http://www.partikkelaudio.com/
>>>> http://soundcloud.com/brandtsegg
>>>> http://flyndresang.no/
>>>> http://soundcloud.com/t-emp
>>>>
>>>> Csound mailing list
>>>> Csound@listserv.heanet.ie
>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>> Send bugs reports to
>>>>          https://github.com/csound/csound/issues
>>>> Discussions of bugs and features can be posted here
>>>
>>>
>>> Csound mailing list
>>> Csound@listserv.heanet.ie
>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>> Send bugs reports to
>>>           https://github.com/csound/csound/issues
>>> Discussions of bugs and features can be posted here
>>>
>>
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>         https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>
>
>

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2016-05-12 09:01
FromAnders Genell
SubjectRe: conditionals and audio signals
Maybe clarify to something like "Whenever a csound instrument is called, all calls to the init opcode will be performed and corresponding variables will thus be initialized. All other variables will retain their respective value from the last performance time cycle in the previous instrument instance."?
Maybe also add something about error messages received when not initializing variables before use, and how that relates to variables that are "allowed" to not be initialized, like

asig1 init 0
asig2 = asig1

and some complementary bits about what happens at the very first call to an csound instrument when there are no previous instances to inherit?

Regards,
Anders

> 12 maj 2016 kl. 00:53 skrev Oeyvind Brandtsegg :
> 
> Indeed, when commenting on the text description I just meant that it
> can be assumed from:
> "Whenever a Csound instrument is called, all variables are set to
> initial values."
> ... that all variables are somehow implicitly initialized
> I know that they are not, it was just a comment on how the description
> can be interpreted by a novice reader.
> 
> 2016-05-12 0:08 GMT+02:00 Victor Lazzarini :
>> All variables that are initialised:
>> 
>> a1 init 0  is an init-pass op
>> a1 = 0 is a perf-pass op
>> 
>> Victor Lazzarini
>> Dean of Arts, Celtic Studies, and Philosophy
>> Maynooth University
>> Ireland
>> 
>>> On 11 May 2016, at 22:43, Oeyvind Brandtsegg  wrote:
>>> 
>>> Hi Joachim, thanks for the link. I must admit I had not read that part
>>> of the Floss manual with enough focus. It is very nice and
>>> informative, with good examples. As far as I can see they are all
>>> k-rate. Maybe an a-rate example could be used to show that also a-rate
>>> vectors keep their contents until explicitly overwritten? Something
>>> like the csd I posted at the start of this thread could do(?)
>>> 
>>> There is also a lure in the formulation "Whenever a Csound instrument
>>> is called, all variables are set to initial values. This is called the
>>> initialization pass.",
>>> as it can lead one to think (as I did, wrongly) that all variables are
>>> reset whenever a new instance starts.
>>> Not sure how to phrase it better though :-)
>>> 
>>> 
>>> 
>>> 2016-05-10 22:05 GMT+02:00 joachim heintz :
>>>> i have written something about it in the floss manual, as i came across
>>>> this, too, some time ago:
>>>> http://floss.booktype.pro/csound/a-initialization-and-performance-pass/
>>>> 
>>>> "What happens on a k-variable if an instrument is called multiple times?
>>>> What is the initialization value of this variable on the first call, and on
>>>> the subsequent calls?
>>>> 
>>>> If this variable is not set explicitely, the init value in the first call of
>>>> an instrument is zero, as usual. But, for the next calls, the k-variable is
>>>> initialized to the value which was left when the previous instance of the
>>>> same instrument turned off."
>>>> 
>>>> and see the examples 03A08, 03A09 and 03A10.
>>>> 
>>>> let me know if something can be expressed better, or is missing.
>>>> 
>>>>       joachim
>>>> 
>>>> 
>>>> 
>>>> 
>>>>> On 10/05/16 13:59, Victor Lazzarini wrote:
>>>>> 
>>>>> yes, something that could go into the manual or even into the FLOSS
>>>>> manual.
>>>>> ========================
>>>>> Dr Victor Lazzarini
>>>>> Dean of Arts, Celtic Studies and Philosophy,
>>>>> Maynooth University,
>>>>> Maynooth, Co Kildare, Ireland
>>>>> Tel: 00 353 7086936
>>>>> Fax: 00 353 1 7086952
>>>>> 
>>>>>> On 10 May 2016, at 08:50, Oeyvind Brandtsegg 
>>>>>> wrote:
>>>>>> 
>>>>>> I wonder how this could be documented so users don't stumble upon this
>>>>>> unknowingly.
>>>>>> As mentioned, this happened to some students working on an exam, when
>>>>>> they tried to build a keyboard split samples instrument (different
>>>>>> sounds for each key on the midi keyboard).They have not specifically
>>>>>> been taught how to do that, but musical need caused experimentation
>>>>>> and they did what they could. I must admit their assumption that this
>>>>>> should work is not totally unreasonable. Which is why it would be good
>>>>>> to document it somehow(?)
>>>>>> 
>>>>>> 2016-05-10 9:38 GMT+02:00 Oeyvind Brandtsegg :
>>>>>>> 
>>>>>>> Hi Victor,
>>>>>>> Thanks for the clarification.
>>>>>>> I was just surprised that this happens across instrument instances,
>>>>>>> i.e. that the audio variables are not zeroed when the next instance
>>>>>>> starts.
>>>>>>> 
>>>>>>> 2016-05-10 9:19 GMT+02:00 Victor Lazzarini :
>>>>>>>> 
>>>>>>>> yes, any perf time var (a or otherwise) will hold its last value. For
>>>>>>>> this reason if we want for instance to switch off audio, we need to zero a
>>>>>>>> variable when we stop filling it, e.g.
>>>>>>>> 
>>>>>>>> if k1 < iend then
>>>>>>>> a1 oscili ...
>>>>>>>> else
>>>>>>>> a1 = 0
>>>>>>>> endif
>>>>>>>> out a1
>>>>>>>> 
>>>>>>>> without the else part, whatever was last put in the a1 variable will be
>>>>>>>> looped over and over each kcycle.
>>>>>>>> 
>>>>>>>> Victor Lazzarini
>>>>>>>> Dean of Arts, Celtic Studies, and Philosophy
>>>>>>>> Maynooth University
>>>>>>>> Ireland
>>>>>>>> 
>>>>>>>>> On 10 May 2016, at 07:46, Oeyvind Brandtsegg
>>>>>>>>>  wrote:
>>>>>>>>> 
>>>>>>>>> Hi,
>>>>>>>>> Are audio variables saved between instrument instances?
>>>>>>>>> It may seem so from the example below, where I use a conditional to
>>>>>>>>> selectively process a section of the instrument. The first and second
>>>>>>>>> instances plays cleanly, then I change the conditional on the third
>>>>>>>>> instance and it seems like the audio variable a1 keeps its last ksmps
>>>>>>>>> values (from instrument instance number two). Similarly, instance 5
>>>>>>>>> has a residue of the last ksmps audio samples in the variable a2.
>>>>>>>>> 
>>>>>>>>> Is this related to how conditionals are processed? I tried changing
>>>>>>>>> the conditional to k-rate, and the audio output is the same.
>>>>>>>>> This is not really the way I would have programmed this kind of signal
>>>>>>>>> switching, but some of our students stumbled upon this issue while
>>>>>>>>> they were experimenting.
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> sr = 44100
>>>>>>>>> ksmps = 10
>>>>>>>>> nchnls = 2
>>>>>>>>> 0dbfs = 1
>>>>>>>>> 
>>>>>>>>> giSine ftgen 0, 0, 65536, 10, 1
>>>>>>>>> 
>>>>>>>>> instr 1
>>>>>>>>>      ;a1 = 0
>>>>>>>>>      ;a2 = 0
>>>>>>>>>      i1 = p4
>>>>>>>>>      if i1 == 0 then
>>>>>>>>>      a1 poscil 0.5, 220, giSine
>>>>>>>>>      endif
>>>>>>>>>      if i1 == 1 then
>>>>>>>>>      a2 poscil 0.5, 2500, giSine
>>>>>>>>>      endif
>>>>>>>>> outs a1, a2
>>>>>>>>> endin
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> ; start dur     num
>>>>>>>>> i1 0 .1 0
>>>>>>>>> i1 1 . 0
>>>>>>>>> i1 2 . 1
>>>>>>>>> i1 3 . 1
>>>>>>>>> i1 4 . 0
>>>>>>>>> i1 5 . 0
>>>>>>>>> i1 6 . 1
>>>>>>>>> i1 7 . 1
>>>>>>>>> e
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> --
>>>>>>>>> 
>>>>>>>>> Oeyvind Brandtsegg
>>>>>>>>> Professor of Music Technology
>>>>>>>>> NTNU
>>>>>>>>> 7491 Trondheim
>>>>>>>>> Norway
>>>>>>>>> Cell: +47 92 203 205
>>>>>>>>> 
>>>>>>>>> http://www.partikkelaudio.com/
>>>>>>>>> http://soundcloud.com/brandtsegg
>>>>>>>>> http://flyndresang.no/
>>>>>>>>> http://soundcloud.com/t-emp
>>>>>>>>> 
>>>>>>>>> Csound mailing list
>>>>>>>>> Csound@listserv.heanet.ie
>>>>>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>>>>>> Send bugs reports to
>>>>>>>>>      https://github.com/csound/csound/issues
>>>>>>>>> Discussions of bugs and features can be posted here
>>>>>>>> 
>>>>>>>> 
>>>>>>>> Csound mailing list
>>>>>>>> Csound@listserv.heanet.ie
>>>>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>>>>> Send bugs reports to
>>>>>>>>       https://github.com/csound/csound/issues
>>>>>>>> Discussions of bugs and features can be posted here
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> --
>>>>>>> 
>>>>>>> Oeyvind Brandtsegg
>>>>>>> Professor of Music Technology
>>>>>>> NTNU
>>>>>>> 7491 Trondheim
>>>>>>> Norway
>>>>>>> Cell: +47 92 203 205
>>>>>>> 
>>>>>>> http://www.partikkelaudio.com/
>>>>>>> http://soundcloud.com/brandtsegg
>>>>>>> http://flyndresang.no/
>>>>>>> http://soundcloud.com/t-emp
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> --
>>>>>> 
>>>>>> Oeyvind Brandtsegg
>>>>>> Professor of Music Technology
>>>>>> NTNU
>>>>>> 7491 Trondheim
>>>>>> Norway
>>>>>> Cell: +47 92 203 205
>>>>>> 
>>>>>> http://www.partikkelaudio.com/
>>>>>> http://soundcloud.com/brandtsegg
>>>>>> http://flyndresang.no/
>>>>>> http://soundcloud.com/t-emp
>>>>>> 
>>>>>> Csound mailing list
>>>>>> Csound@listserv.heanet.ie
>>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>>> Send bugs reports to
>>>>>>       https://github.com/csound/csound/issues
>>>>>> Discussions of bugs and features can be posted here
>>>>> 
>>>>> 
>>>>> Csound mailing list
>>>>> Csound@listserv.heanet.ie
>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>> Send bugs reports to
>>>>>        https://github.com/csound/csound/issues
>>>>> Discussions of bugs and features can be posted here
>>>> 
>>>> Csound mailing list
>>>> Csound@listserv.heanet.ie
>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>> Send bugs reports to
>>>>      https://github.com/csound/csound/issues
>>>> Discussions of bugs and features can be posted here
>>> 
>>> 
>>> 
>>> --
>>> 
>>> Oeyvind Brandtsegg
>>> Professor of Music Technology
>>> NTNU
>>> 7491 Trondheim
>>> Norway
>>> Cell: +47 92 203 205
>>> 
>>> http://www.partikkelaudio.com/
>>> http://soundcloud.com/brandtsegg
>>> http://flyndresang.no/
>>> http://soundcloud.com/t-emp
>>> 
>>> Csound mailing list
>>> Csound@listserv.heanet.ie
>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>> Send bugs reports to
>>>       https://github.com/csound/csound/issues
>>> Discussions of bugs and features can be posted here
>> 
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>        https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
> 
> 
> 
> -- 
> 
> Oeyvind Brandtsegg
> Professor of Music Technology
> NTNU
> 7491 Trondheim
> Norway
> Cell: +47 92 203 205
> 
> http://www.partikkelaudio.com/
> http://soundcloud.com/brandtsegg
> http://flyndresang.no/
> http://soundcloud.com/t-emp
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2016-05-12 09:05
FromVictor Lazzarini
SubjectRe: conditionals and audio signals
asig2 = asig1 is not an initialisation, it’s a perf-pass assignment.

========================
Dr Victor Lazzarini
Dean of Arts, Celtic Studies and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 12 May 2016, at 09:01, Anders Genell  wrote:
> 
> Maybe clarify to something like "Whenever a csound instrument is called, all calls to the init opcode will be performed and corresponding variables will thus be initialized. All other variables will retain their respective value from the last performance time cycle in the previous instrument instance."?
> Maybe also add something about error messages received when not initializing variables before use, and how that relates to variables that are "allowed" to not be initialized, like
> 
> asig1 init 0
> asig2 = asig1
> 
> and some complementary bits about what happens at the very first call to an csound instrument when there are no previous instances to inherit?
> 
> Regards,
> Anders
> 
>> 12 maj 2016 kl. 00:53 skrev Oeyvind Brandtsegg :
>> 
>> Indeed, when commenting on the text description I just meant that it
>> can be assumed from:
>> "Whenever a Csound instrument is called, all variables are set to
>> initial values."
>> ... that all variables are somehow implicitly initialized
>> I know that they are not, it was just a comment on how the description
>> can be interpreted by a novice reader.
>> 
>> 2016-05-12 0:08 GMT+02:00 Victor Lazzarini :
>>> All variables that are initialised:
>>> 
>>> a1 init 0  is an init-pass op
>>> a1 = 0 is a perf-pass op
>>> 
>>> Victor Lazzarini
>>> Dean of Arts, Celtic Studies, and Philosophy
>>> Maynooth University
>>> Ireland
>>> 
>>>> On 11 May 2016, at 22:43, Oeyvind Brandtsegg  wrote:
>>>> 
>>>> Hi Joachim, thanks for the link. I must admit I had not read that part
>>>> of the Floss manual with enough focus. It is very nice and
>>>> informative, with good examples. As far as I can see they are all
>>>> k-rate. Maybe an a-rate example could be used to show that also a-rate
>>>> vectors keep their contents until explicitly overwritten? Something
>>>> like the csd I posted at the start of this thread could do(?)
>>>> 
>>>> There is also a lure in the formulation "Whenever a Csound instrument
>>>> is called, all variables are set to initial values. This is called the
>>>> initialization pass.",
>>>> as it can lead one to think (as I did, wrongly) that all variables are
>>>> reset whenever a new instance starts.
>>>> Not sure how to phrase it better though :-)
>>>> 
>>>> 
>>>> 
>>>> 2016-05-10 22:05 GMT+02:00 joachim heintz :
>>>>> i have written something about it in the floss manual, as i came across
>>>>> this, too, some time ago:
>>>>> http://floss.booktype.pro/csound/a-initialization-and-performance-pass/
>>>>> 
>>>>> "What happens on a k-variable if an instrument is called multiple times?
>>>>> What is the initialization value of this variable on the first call, and on
>>>>> the subsequent calls?
>>>>> 
>>>>> If this variable is not set explicitely, the init value in the first call of
>>>>> an instrument is zero, as usual. But, for the next calls, the k-variable is
>>>>> initialized to the value which was left when the previous instance of the
>>>>> same instrument turned off."
>>>>> 
>>>>> and see the examples 03A08, 03A09 and 03A10.
>>>>> 
>>>>> let me know if something can be expressed better, or is missing.
>>>>> 
>>>>>      joachim
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>>> On 10/05/16 13:59, Victor Lazzarini wrote:
>>>>>> 
>>>>>> yes, something that could go into the manual or even into the FLOSS
>>>>>> manual.
>>>>>> ========================
>>>>>> Dr Victor Lazzarini
>>>>>> Dean of Arts, Celtic Studies and Philosophy,
>>>>>> Maynooth University,
>>>>>> Maynooth, Co Kildare, Ireland
>>>>>> Tel: 00 353 7086936
>>>>>> Fax: 00 353 1 7086952
>>>>>> 
>>>>>>> On 10 May 2016, at 08:50, Oeyvind Brandtsegg 
>>>>>>> wrote:
>>>>>>> 
>>>>>>> I wonder how this could be documented so users don't stumble upon this
>>>>>>> unknowingly.
>>>>>>> As mentioned, this happened to some students working on an exam, when
>>>>>>> they tried to build a keyboard split samples instrument (different
>>>>>>> sounds for each key on the midi keyboard).They have not specifically
>>>>>>> been taught how to do that, but musical need caused experimentation
>>>>>>> and they did what they could. I must admit their assumption that this
>>>>>>> should work is not totally unreasonable. Which is why it would be good
>>>>>>> to document it somehow(?)
>>>>>>> 
>>>>>>> 2016-05-10 9:38 GMT+02:00 Oeyvind Brandtsegg :
>>>>>>>> 
>>>>>>>> Hi Victor,
>>>>>>>> Thanks for the clarification.
>>>>>>>> I was just surprised that this happens across instrument instances,
>>>>>>>> i.e. that the audio variables are not zeroed when the next instance
>>>>>>>> starts.
>>>>>>>> 
>>>>>>>> 2016-05-10 9:19 GMT+02:00 Victor Lazzarini :
>>>>>>>>> 
>>>>>>>>> yes, any perf time var (a or otherwise) will hold its last value. For
>>>>>>>>> this reason if we want for instance to switch off audio, we need to zero a
>>>>>>>>> variable when we stop filling it, e.g.
>>>>>>>>> 
>>>>>>>>> if k1 < iend then
>>>>>>>>> a1 oscili ...
>>>>>>>>> else
>>>>>>>>> a1 = 0
>>>>>>>>> endif
>>>>>>>>> out a1
>>>>>>>>> 
>>>>>>>>> without the else part, whatever was last put in the a1 variable will be
>>>>>>>>> looped over and over each kcycle.
>>>>>>>>> 
>>>>>>>>> Victor Lazzarini
>>>>>>>>> Dean of Arts, Celtic Studies, and Philosophy
>>>>>>>>> Maynooth University
>>>>>>>>> Ireland
>>>>>>>>> 
>>>>>>>>>> On 10 May 2016, at 07:46, Oeyvind Brandtsegg
>>>>>>>>>>  wrote:
>>>>>>>>>> 
>>>>>>>>>> Hi,
>>>>>>>>>> Are audio variables saved between instrument instances?
>>>>>>>>>> It may seem so from the example below, where I use a conditional to
>>>>>>>>>> selectively process a section of the instrument. The first and second
>>>>>>>>>> instances plays cleanly, then I change the conditional on the third
>>>>>>>>>> instance and it seems like the audio variable a1 keeps its last ksmps
>>>>>>>>>> values (from instrument instance number two). Similarly, instance 5
>>>>>>>>>> has a residue of the last ksmps audio samples in the variable a2.
>>>>>>>>>> 
>>>>>>>>>> Is this related to how conditionals are processed? I tried changing
>>>>>>>>>> the conditional to k-rate, and the audio output is the same.
>>>>>>>>>> This is not really the way I would have programmed this kind of signal
>>>>>>>>>> switching, but some of our students stumbled upon this issue while
>>>>>>>>>> they were experimenting.
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> sr = 44100
>>>>>>>>>> ksmps = 10
>>>>>>>>>> nchnls = 2
>>>>>>>>>> 0dbfs = 1
>>>>>>>>>> 
>>>>>>>>>> giSine ftgen 0, 0, 65536, 10, 1
>>>>>>>>>> 
>>>>>>>>>> instr 1
>>>>>>>>>>     ;a1 = 0
>>>>>>>>>>     ;a2 = 0
>>>>>>>>>>     i1 = p4
>>>>>>>>>>     if i1 == 0 then
>>>>>>>>>>     a1 poscil 0.5, 220, giSine
>>>>>>>>>>     endif
>>>>>>>>>>     if i1 == 1 then
>>>>>>>>>>     a2 poscil 0.5, 2500, giSine
>>>>>>>>>>     endif
>>>>>>>>>> outs a1, a2
>>>>>>>>>> endin
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> ; start dur     num
>>>>>>>>>> i1 0 .1 0
>>>>>>>>>> i1 1 . 0
>>>>>>>>>> i1 2 . 1
>>>>>>>>>> i1 3 . 1
>>>>>>>>>> i1 4 . 0
>>>>>>>>>> i1 5 . 0
>>>>>>>>>> i1 6 . 1
>>>>>>>>>> i1 7 . 1
>>>>>>>>>> e
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> --
>>>>>>>>>> 
>>>>>>>>>> Oeyvind Brandtsegg
>>>>>>>>>> Professor of Music Technology
>>>>>>>>>> NTNU
>>>>>>>>>> 7491 Trondheim
>>>>>>>>>> Norway
>>>>>>>>>> Cell: +47 92 203 205
>>>>>>>>>> 
>>>>>>>>>> http://www.partikkelaudio.com/
>>>>>>>>>> http://soundcloud.com/brandtsegg
>>>>>>>>>> http://flyndresang.no/
>>>>>>>>>> http://soundcloud.com/t-emp
>>>>>>>>>> 
>>>>>>>>>> Csound mailing list
>>>>>>>>>> Csound@listserv.heanet.ie
>>>>>>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>>>>>>> Send bugs reports to
>>>>>>>>>>     https://github.com/csound/csound/issues
>>>>>>>>>> Discussions of bugs and features can be posted here
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> Csound mailing list
>>>>>>>>> Csound@listserv.heanet.ie
>>>>>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>>>>>> Send bugs reports to
>>>>>>>>>      https://github.com/csound/csound/issues
>>>>>>>>> Discussions of bugs and features can be posted here
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> --
>>>>>>>> 
>>>>>>>> Oeyvind Brandtsegg
>>>>>>>> Professor of Music Technology
>>>>>>>> NTNU
>>>>>>>> 7491 Trondheim
>>>>>>>> Norway
>>>>>>>> Cell: +47 92 203 205
>>>>>>>> 
>>>>>>>> http://www.partikkelaudio.com/
>>>>>>>> http://soundcloud.com/brandtsegg
>>>>>>>> http://flyndresang.no/
>>>>>>>> http://soundcloud.com/t-emp
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> --
>>>>>>> 
>>>>>>> Oeyvind Brandtsegg
>>>>>>> Professor of Music Technology
>>>>>>> NTNU
>>>>>>> 7491 Trondheim
>>>>>>> Norway
>>>>>>> Cell: +47 92 203 205
>>>>>>> 
>>>>>>> http://www.partikkelaudio.com/
>>>>>>> http://soundcloud.com/brandtsegg
>>>>>>> http://flyndresang.no/
>>>>>>> http://soundcloud.com/t-emp
>>>>>>> 
>>>>>>> Csound mailing list
>>>>>>> Csound@listserv.heanet.ie
>>>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>>>> Send bugs reports to
>>>>>>>      https://github.com/csound/csound/issues
>>>>>>> Discussions of bugs and features can be posted here
>>>>>> 
>>>>>> 
>>>>>> Csound mailing list
>>>>>> Csound@listserv.heanet.ie
>>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>>> Send bugs reports to
>>>>>>       https://github.com/csound/csound/issues
>>>>>> Discussions of bugs and features can be posted here
>>>>> 
>>>>> Csound mailing list
>>>>> Csound@listserv.heanet.ie
>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>> Send bugs reports to
>>>>>     https://github.com/csound/csound/issues
>>>>> Discussions of bugs and features can be posted here
>>>> 
>>>> 
>>>> 
>>>> --
>>>> 
>>>> Oeyvind Brandtsegg
>>>> Professor of Music Technology
>>>> NTNU
>>>> 7491 Trondheim
>>>> Norway
>>>> Cell: +47 92 203 205
>>>> 
>>>> http://www.partikkelaudio.com/
>>>> http://soundcloud.com/brandtsegg
>>>> http://flyndresang.no/
>>>> http://soundcloud.com/t-emp
>>>> 
>>>> Csound mailing list
>>>> Csound@listserv.heanet.ie
>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>> Send bugs reports to
>>>>      https://github.com/csound/csound/issues
>>>> Discussions of bugs and features can be posted here
>>> 
>>> Csound mailing list
>>> Csound@listserv.heanet.ie
>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>> Send bugs reports to
>>>       https://github.com/csound/csound/issues
>>> Discussions of bugs and features can be posted here
>> 
>> 
>> 
>> -- 
>> 
>> Oeyvind Brandtsegg
>> Professor of Music Technology
>> NTNU
>> 7491 Trondheim
>> Norway
>> Cell: +47 92 203 205
>> 
>> http://www.partikkelaudio.com/
>> http://soundcloud.com/brandtsegg
>> http://flyndresang.no/
>> http://soundcloud.com/t-emp
>> 
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>       https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2016-05-12 09:13
FromAnders Genell
SubjectRe: conditionals and audio signals
That was my point. asig1 is initialized at init time, asig2 is not, but is still "allowed" (or did I missunderstand?)

Regards,
Anders


On Thu, May 12, 2016 at 10:05 AM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
asig2 = asig1 is not an initialisation, it’s a perf-pass assignment.

========================
Dr Victor Lazzarini
Dean of Arts, Celtic Studies and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952

> On 12 May 2016, at 09:01, Anders Genell <anders.genell@gmail.com> wrote:
>
> Maybe clarify to something like "Whenever a csound instrument is called, all calls to the init opcode will be performed and corresponding variables will thus be initialized. All other variables will retain their respective value from the last performance time cycle in the previous instrument instance."?
> Maybe also add something about error messages received when not initializing variables before use, and how that relates to variables that are "allowed" to not be initialized, like
>
> asig1 init 0
> asig2 = asig1
>
> and some complementary bits about what happens at the very first call to an csound instrument when there are no previous instances to inherit?
>
> Regards,
> Anders
>
>> 12 maj 2016 kl. 00:53 skrev Oeyvind Brandtsegg <oyvind.brandtsegg@NTNU.NO>:
>>
>> Indeed, when commenting on the text description I just meant that it
>> can be assumed from:
>> "Whenever a Csound instrument is called, all variables are set to
>> initial values."
>> ... that all variables are somehow implicitly initialized
>> I know that they are not, it was just a comment on how the description
>> can be interpreted by a novice reader.
>>
>> 2016-05-12 0:08 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
>>> All variables that are initialised:
>>>
>>> a1 init 0  is an init-pass op
>>> a1 = 0 is a perf-pass op
>>>
>>> Victor Lazzarini
>>> Dean of Arts, Celtic Studies, and Philosophy
>>> Maynooth University
>>> Ireland
>>>
>>>> On 11 May 2016, at 22:43, Oeyvind Brandtsegg <oyvind.brandtsegg@NTNU.NO> wrote:
>>>>
>>>> Hi Joachim, thanks for the link. I must admit I had not read that part
>>>> of the Floss manual with enough focus. It is very nice and
>>>> informative, with good examples. As far as I can see they are all
>>>> k-rate. Maybe an a-rate example could be used to show that also a-rate
>>>> vectors keep their contents until explicitly overwritten? Something
>>>> like the csd I posted at the start of this thread could do(?)
>>>>
>>>> There is also a lure in the formulation "Whenever a Csound instrument
>>>> is called, all variables are set to initial values. This is called the
>>>> initialization pass.",
>>>> as it can lead one to think (as I did, wrongly) that all variables are
>>>> reset whenever a new instance starts.
>>>> Not sure how to phrase it better though :-)
>>>>
>>>>
>>>>
>>>> 2016-05-10 22:05 GMT+02:00 joachim heintz <jh@joachimheintz.de>:
>>>>> i have written something about it in the floss manual, as i came across
>>>>> this, too, some time ago:
>>>>> http://floss.booktype.pro/csound/a-initialization-and-performance-pass/
>>>>>
>>>>> "What happens on a k-variable if an instrument is called multiple times?
>>>>> What is the initialization value of this variable on the first call, and on
>>>>> the subsequent calls?
>>>>>
>>>>> If this variable is not set explicitely, the init value in the first call of
>>>>> an instrument is zero, as usual. But, for the next calls, the k-variable is
>>>>> initialized to the value which was left when the previous instance of the
>>>>> same instrument turned off."
>>>>>
>>>>> and see the examples 03A08, 03A09 and 03A10.
>>>>>
>>>>> let me know if something can be expressed better, or is missing.
>>>>>
>>>>>      joachim
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> On 10/05/16 13:59, Victor Lazzarini wrote:
>>>>>>
>>>>>> yes, something that could go into the manual or even into the FLOSS
>>>>>> manual.
>>>>>> ========================
>>>>>> Dr Victor Lazzarini
>>>>>> Dean of Arts, Celtic Studies and Philosophy,
>>>>>> Maynooth University,
>>>>>> Maynooth, Co Kildare, Ireland
>>>>>> Tel: 00 353 7086936
>>>>>> Fax: 00 353 1 7086952
>>>>>>
>>>>>>> On 10 May 2016, at 08:50, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no>
>>>>>>> wrote:
>>>>>>>
>>>>>>> I wonder how this could be documented so users don't stumble upon this
>>>>>>> unknowingly.
>>>>>>> As mentioned, this happened to some students working on an exam, when
>>>>>>> they tried to build a keyboard split samples instrument (different
>>>>>>> sounds for each key on the midi keyboard).They have not specifically
>>>>>>> been taught how to do that, but musical need caused experimentation
>>>>>>> and they did what they could. I must admit their assumption that this
>>>>>>> should work is not totally unreasonable. Which is why it would be good
>>>>>>> to document it somehow(?)
>>>>>>>
>>>>>>> 2016-05-10 9:38 GMT+02:00 Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no>:
>>>>>>>>
>>>>>>>> Hi Victor,
>>>>>>>> Thanks for the clarification.
>>>>>>>> I was just surprised that this happens across instrument instances,
>>>>>>>> i.e. that the audio variables are not zeroed when the next instance
>>>>>>>> starts.
>>>>>>>>
>>>>>>>> 2016-05-10 9:19 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
>>>>>>>>>
>>>>>>>>> yes, any perf time var (a or otherwise) will hold its last value. For
>>>>>>>>> this reason if we want for instance to switch off audio, we need to zero a
>>>>>>>>> variable when we stop filling it, e.g.
>>>>>>>>>
>>>>>>>>> if k1 < iend then
>>>>>>>>> a1 oscili ...
>>>>>>>>> else
>>>>>>>>> a1 = 0
>>>>>>>>> endif
>>>>>>>>> out a1
>>>>>>>>>
>>>>>>>>> without the else part, whatever was last put in the a1 variable will be
>>>>>>>>> looped over and over each kcycle.
>>>>>>>>>
>>>>>>>>> Victor Lazzarini
>>>>>>>>> Dean of Arts, Celtic Studies, and Philosophy
>>>>>>>>> Maynooth University
>>>>>>>>> Ireland
>>>>>>>>>
>>>>>>>>>> On 10 May 2016, at 07:46, Oeyvind Brandtsegg
>>>>>>>>>> <oyvind.brandtsegg@NTNU.NO> wrote:
>>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>> Are audio variables saved between instrument instances?
>>>>>>>>>> It may seem so from the example below, where I use a conditional to
>>>>>>>>>> selectively process a section of the instrument. The first and second
>>>>>>>>>> instances plays cleanly, then I change the conditional on the third
>>>>>>>>>> instance and it seems like the audio variable a1 keeps its last ksmps
>>>>>>>>>> values (from instrument instance number two). Similarly, instance 5
>>>>>>>>>> has a residue of the last ksmps audio samples in the variable a2.
>>>>>>>>>>
>>>>>>>>>> Is this related to how conditionals are processed? I tried changing
>>>>>>>>>> the conditional to k-rate, and the audio output is the same.
>>>>>>>>>> This is not really the way I would have programmed this kind of signal
>>>>>>>>>> switching, but some of our students stumbled upon this issue while
>>>>>>>>>> they were experimenting.
>>>>>>>>>>
>>>>>>>>>> <CsoundSynthesizer>
>>>>>>>>>> <CsOptions>
>>>>>>>>>> </CsOptions>
>>>>>>>>>> <CsInstruments>
>>>>>>>>>>
>>>>>>>>>> sr = 44100
>>>>>>>>>> ksmps = 10
>>>>>>>>>> nchnls = 2
>>>>>>>>>> 0dbfs = 1
>>>>>>>>>>
>>>>>>>>>> giSine ftgen 0, 0, 65536, 10, 1
>>>>>>>>>>
>>>>>>>>>> instr 1
>>>>>>>>>>     ;a1 = 0
>>>>>>>>>>     ;a2 = 0
>>>>>>>>>>     i1 = p4
>>>>>>>>>>     if i1 == 0 then
>>>>>>>>>>     a1 poscil 0.5, 220, giSine
>>>>>>>>>>     endif
>>>>>>>>>>     if i1 == 1 then
>>>>>>>>>>     a2 poscil 0.5, 2500, giSine
>>>>>>>>>>     endif
>>>>>>>>>> outs a1, a2
>>>>>>>>>> endin
>>>>>>>>>>
>>>>>>>>>> </CsInstruments>
>>>>>>>>>> <CsScore>
>>>>>>>>>> ; start dur     num
>>>>>>>>>> i1 0 .1 0
>>>>>>>>>> i1 1 . 0
>>>>>>>>>> i1 2 . 1
>>>>>>>>>> i1 3 . 1
>>>>>>>>>> i1 4 . 0
>>>>>>>>>> i1 5 . 0
>>>>>>>>>> i1 6 . 1
>>>>>>>>>> i1 7 . 1
>>>>>>>>>> e
>>>>>>>>>>
>>>>>>>>>> </CsScore>
>>>>>>>>>> </CsoundSynthesizer>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>>
>>>>>>>>>> Oeyvind Brandtsegg
>>>>>>>>>> Professor of Music Technology
>>>>>>>>>> NTNU
>>>>>>>>>> 7491 Trondheim
>>>>>>>>>> Norway
>>>>>>>>>> Cell: +47 92 203 205
>>>>>>>>>>
>>>>>>>>>> http://www.partikkelaudio.com/
>>>>>>>>>> http://soundcloud.com/brandtsegg
>>>>>>>>>> http://flyndresang.no/
>>>>>>>>>> http://soundcloud.com/t-emp
>>>>>>>>>>
>>>>>>>>>> Csound mailing list
>>>>>>>>>> Csound@listserv.heanet.ie
>>>>>>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>>>>>>> Send bugs reports to
>>>>>>>>>>     https://github.com/csound/csound/issues
>>>>>>>>>> Discussions of bugs and features can be posted here
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Csound mailing list
>>>>>>>>> Csound@listserv.heanet.ie
>>>>>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>>>>>> Send bugs reports to
>>>>>>>>>      https://github.com/csound/csound/issues
>>>>>>>>> Discussions of bugs and features can be posted here
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>>>>>> Oeyvind Brandtsegg
>>>>>>>> Professor of Music Technology
>>>>>>>> NTNU
>>>>>>>> 7491 Trondheim
>>>>>>>> Norway
>>>>>>>> Cell: +47 92 203 205
>>>>>>>>
>>>>>>>> http://www.partikkelaudio.com/
>>>>>>>> http://soundcloud.com/brandtsegg
>>>>>>>> http://flyndresang.no/
>>>>>>>> http://soundcloud.com/t-emp
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>> Oeyvind Brandtsegg
>>>>>>> Professor of Music Technology
>>>>>>> NTNU
>>>>>>> 7491 Trondheim
>>>>>>> Norway
>>>>>>> Cell: +47 92 203 205
>>>>>>>
>>>>>>> http://www.partikkelaudio.com/
>>>>>>> http://soundcloud.com/brandtsegg
>>>>>>> http://flyndresang.no/
>>>>>>> http://soundcloud.com/t-emp
>>>>>>>
>>>>>>> Csound mailing list
>>>>>>> Csound@listserv.heanet.ie
>>>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>>>> Send bugs reports to
>>>>>>>      https://github.com/csound/csound/issues
>>>>>>> Discussions of bugs and features can be posted here
>>>>>>
>>>>>>
>>>>>> Csound mailing list
>>>>>> Csound@listserv.heanet.ie
>>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>>> Send bugs reports to
>>>>>>       https://github.com/csound/csound/issues
>>>>>> Discussions of bugs and features can be posted here
>>>>>
>>>>> Csound mailing list
>>>>> Csound@listserv.heanet.ie
>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>> Send bugs reports to
>>>>>     https://github.com/csound/csound/issues
>>>>> Discussions of bugs and features can be posted here
>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> Oeyvind Brandtsegg
>>>> Professor of Music Technology
>>>> NTNU
>>>> 7491 Trondheim
>>>> Norway
>>>> Cell: +47 92 203 205
>>>>
>>>> http://www.partikkelaudio.com/
>>>> http://soundcloud.com/brandtsegg
>>>> http://flyndresang.no/
>>>> http://soundcloud.com/t-emp
>>>>
>>>> Csound mailing list
>>>> Csound@listserv.heanet.ie
>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>> Send bugs reports to
>>>>      https://github.com/csound/csound/issues
>>>> Discussions of bugs and features can be posted here
>>>
>>> Csound mailing list
>>> Csound@listserv.heanet.ie
>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>> Send bugs reports to
>>>       https://github.com/csound/csound/issues
>>> Discussions of bugs and features can be posted here
>>
>>
>>
>> --
>>
>> Oeyvind Brandtsegg
>> Professor of Music Technology
>> NTNU
>> 7491 Trondheim
>> Norway
>> Cell: +47 92 203 205
>>
>> http://www.partikkelaudio.com/
>> http://soundcloud.com/brandtsegg
>> http://flyndresang.no/
>> http://soundcloud.com/t-emp
>>
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>       https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2016-05-12 10:01
FromVictor Lazzarini
SubjectRe: conditionals and audio signals
yes, it’s allowed alright.
========================
Dr Victor Lazzarini
Dean of Arts, Celtic Studies and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 12 May 2016, at 09:13, Anders Genell  wrote:
> 
> That was my point. asig1 is initialized at init time, asig2 is not, but is still "allowed" (or did I missunderstand?)
> 
> Regards,
> Anders
> 
> 
> On Thu, May 12, 2016 at 10:05 AM, Victor Lazzarini  wrote:
> asig2 = asig1 is not an initialisation, it’s a perf-pass assignment.
> 
> ========================
> Dr Victor Lazzarini
> Dean of Arts, Celtic Studies and Philosophy,
> Maynooth University,
> Maynooth, Co Kildare, Ireland
> Tel: 00 353 7086936
> Fax: 00 353 1 7086952
> 
> > On 12 May 2016, at 09:01, Anders Genell  wrote:
> >
> > Maybe clarify to something like "Whenever a csound instrument is called, all calls to the init opcode will be performed and corresponding variables will thus be initialized. All other variables will retain their respective value from the last performance time cycle in the previous instrument instance."?
> > Maybe also add something about error messages received when not initializing variables before use, and how that relates to variables that are "allowed" to not be initialized, like
> >
> > asig1 init 0
> > asig2 = asig1
> >
> > and some complementary bits about what happens at the very first call to an csound instrument when there are no previous instances to inherit?
> >
> > Regards,
> > Anders
> >
> >> 12 maj 2016 kl. 00:53 skrev Oeyvind Brandtsegg :
> >>
> >> Indeed, when commenting on the text description I just meant that it
> >> can be assumed from:
> >> "Whenever a Csound instrument is called, all variables are set to
> >> initial values."
> >> ... that all variables are somehow implicitly initialized
> >> I know that they are not, it was just a comment on how the description
> >> can be interpreted by a novice reader.
> >>
> >> 2016-05-12 0:08 GMT+02:00 Victor Lazzarini :
> >>> All variables that are initialised:
> >>>
> >>> a1 init 0  is an init-pass op
> >>> a1 = 0 is a perf-pass op
> >>>
> >>> Victor Lazzarini
> >>> Dean of Arts, Celtic Studies, and Philosophy
> >>> Maynooth University
> >>> Ireland
> >>>
> >>>> On 11 May 2016, at 22:43, Oeyvind Brandtsegg  wrote:
> >>>>
> >>>> Hi Joachim, thanks for the link. I must admit I had not read that part
> >>>> of the Floss manual with enough focus. It is very nice and
> >>>> informative, with good examples. As far as I can see they are all
> >>>> k-rate. Maybe an a-rate example could be used to show that also a-rate
> >>>> vectors keep their contents until explicitly overwritten? Something
> >>>> like the csd I posted at the start of this thread could do(?)
> >>>>
> >>>> There is also a lure in the formulation "Whenever a Csound instrument
> >>>> is called, all variables are set to initial values. This is called the
> >>>> initialization pass.",
> >>>> as it can lead one to think (as I did, wrongly) that all variables are
> >>>> reset whenever a new instance starts.
> >>>> Not sure how to phrase it better though :-)
> >>>>
> >>>>
> >>>>
> >>>> 2016-05-10 22:05 GMT+02:00 joachim heintz :
> >>>>> i have written something about it in the floss manual, as i came across
> >>>>> this, too, some time ago:
> >>>>> http://floss.booktype.pro/csound/a-initialization-and-performance-pass/
> >>>>>
> >>>>> "What happens on a k-variable if an instrument is called multiple times?
> >>>>> What is the initialization value of this variable on the first call, and on
> >>>>> the subsequent calls?
> >>>>>
> >>>>> If this variable is not set explicitely, the init value in the first call of
> >>>>> an instrument is zero, as usual. But, for the next calls, the k-variable is
> >>>>> initialized to the value which was left when the previous instance of the
> >>>>> same instrument turned off."
> >>>>>
> >>>>> and see the examples 03A08, 03A09 and 03A10.
> >>>>>
> >>>>> let me know if something can be expressed better, or is missing.
> >>>>>
> >>>>>      joachim
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>> On 10/05/16 13:59, Victor Lazzarini wrote:
> >>>>>>
> >>>>>> yes, something that could go into the manual or even into the FLOSS
> >>>>>> manual.
> >>>>>> ========================
> >>>>>> Dr Victor Lazzarini
> >>>>>> Dean of Arts, Celtic Studies and Philosophy,
> >>>>>> Maynooth University,
> >>>>>> Maynooth, Co Kildare, Ireland
> >>>>>> Tel: 00 353 7086936
> >>>>>> Fax: 00 353 1 7086952
> >>>>>>
> >>>>>>> On 10 May 2016, at 08:50, Oeyvind Brandtsegg 
> >>>>>>> wrote:
> >>>>>>>
> >>>>>>> I wonder how this could be documented so users don't stumble upon this
> >>>>>>> unknowingly.
> >>>>>>> As mentioned, this happened to some students working on an exam, when
> >>>>>>> they tried to build a keyboard split samples instrument (different
> >>>>>>> sounds for each key on the midi keyboard).They have not specifically
> >>>>>>> been taught how to do that, but musical need caused experimentation
> >>>>>>> and they did what they could. I must admit their assumption that this
> >>>>>>> should work is not totally unreasonable. Which is why it would be good
> >>>>>>> to document it somehow(?)
> >>>>>>>
> >>>>>>> 2016-05-10 9:38 GMT+02:00 Oeyvind Brandtsegg :
> >>>>>>>>
> >>>>>>>> Hi Victor,
> >>>>>>>> Thanks for the clarification.
> >>>>>>>> I was just surprised that this happens across instrument instances,
> >>>>>>>> i.e. that the audio variables are not zeroed when the next instance
> >>>>>>>> starts.
> >>>>>>>>
> >>>>>>>> 2016-05-10 9:19 GMT+02:00 Victor Lazzarini :
> >>>>>>>>>
> >>>>>>>>> yes, any perf time var (a or otherwise) will hold its last value. For
> >>>>>>>>> this reason if we want for instance to switch off audio, we need to zero a
> >>>>>>>>> variable when we stop filling it, e.g.
> >>>>>>>>>
> >>>>>>>>> if k1 < iend then
> >>>>>>>>> a1 oscili ...
> >>>>>>>>> else
> >>>>>>>>> a1 = 0
> >>>>>>>>> endif
> >>>>>>>>> out a1
> >>>>>>>>>
> >>>>>>>>> without the else part, whatever was last put in the a1 variable will be
> >>>>>>>>> looped over and over each kcycle.
> >>>>>>>>>
> >>>>>>>>> Victor Lazzarini
> >>>>>>>>> Dean of Arts, Celtic Studies, and Philosophy
> >>>>>>>>> Maynooth University
> >>>>>>>>> Ireland
> >>>>>>>>>
> >>>>>>>>>> On 10 May 2016, at 07:46, Oeyvind Brandtsegg
> >>>>>>>>>>  wrote:
> >>>>>>>>>>
> >>>>>>>>>> Hi,
> >>>>>>>>>> Are audio variables saved between instrument instances?
> >>>>>>>>>> It may seem so from the example below, where I use a conditional to
> >>>>>>>>>> selectively process a section of the instrument. The first and second
> >>>>>>>>>> instances plays cleanly, then I change the conditional on the third
> >>>>>>>>>> instance and it seems like the audio variable a1 keeps its last ksmps
> >>>>>>>>>> values (from instrument instance number two). Similarly, instance 5
> >>>>>>>>>> has a residue of the last ksmps audio samples in the variable a2.
> >>>>>>>>>>
> >>>>>>>>>> Is this related to how conditionals are processed? I tried changing
> >>>>>>>>>> the conditional to k-rate, and the audio output is the same.
> >>>>>>>>>> This is not really the way I would have programmed this kind of signal
> >>>>>>>>>> switching, but some of our students stumbled upon this issue while
> >>>>>>>>>> they were experimenting.
> >>>>>>>>>>
> >>>>>>>>>> 
> >>>>>>>>>> 
> >>>>>>>>>> 
> >>>>>>>>>> 
> >>>>>>>>>>
> >>>>>>>>>> sr = 44100
> >>>>>>>>>> ksmps = 10
> >>>>>>>>>> nchnls = 2
> >>>>>>>>>> 0dbfs = 1
> >>>>>>>>>>
> >>>>>>>>>> giSine ftgen 0, 0, 65536, 10, 1
> >>>>>>>>>>
> >>>>>>>>>> instr 1
> >>>>>>>>>>     ;a1 = 0
> >>>>>>>>>>     ;a2 = 0
> >>>>>>>>>>     i1 = p4
> >>>>>>>>>>     if i1 == 0 then
> >>>>>>>>>>     a1 poscil 0.5, 220, giSine
> >>>>>>>>>>     endif
> >>>>>>>>>>     if i1 == 1 then
> >>>>>>>>>>     a2 poscil 0.5, 2500, giSine
> >>>>>>>>>>     endif
> >>>>>>>>>> outs a1, a2
> >>>>>>>>>> endin
> >>>>>>>>>>
> >>>>>>>>>> 
> >>>>>>>>>> 
> >>>>>>>>>> ; start dur     num
> >>>>>>>>>> i1 0 .1 0
> >>>>>>>>>> i1 1 . 0
> >>>>>>>>>> i1 2 . 1
> >>>>>>>>>> i1 3 . 1
> >>>>>>>>>> i1 4 . 0
> >>>>>>>>>> i1 5 . 0
> >>>>>>>>>> i1 6 . 1
> >>>>>>>>>> i1 7 . 1
> >>>>>>>>>> e
> >>>>>>>>>>
> >>>>>>>>>> 
> >>>>>>>>>> 
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>> --
> >>>>>>>>>>
> >>>>>>>>>> Oeyvind Brandtsegg
> >>>>>>>>>> Professor of Music Technology
> >>>>>>>>>> NTNU
> >>>>>>>>>> 7491 Trondheim
> >>>>>>>>>> Norway
> >>>>>>>>>> Cell: +47 92 203 205
> >>>>>>>>>>
> >>>>>>>>>> http://www.partikkelaudio.com/
> >>>>>>>>>> http://soundcloud.com/brandtsegg
> >>>>>>>>>> http://flyndresang.no/
> >>>>>>>>>> http://soundcloud.com/t-emp
> >>>>>>>>>>
> >>>>>>>>>> Csound mailing list
> >>>>>>>>>> Csound@listserv.heanet.ie
> >>>>>>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> >>>>>>>>>> Send bugs reports to
> >>>>>>>>>>     https://github.com/csound/csound/issues
> >>>>>>>>>> Discussions of bugs and features can be posted here
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> Csound mailing list
> >>>>>>>>> Csound@listserv.heanet.ie
> >>>>>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> >>>>>>>>> Send bugs reports to
> >>>>>>>>>      https://github.com/csound/csound/issues
> >>>>>>>>> Discussions of bugs and features can be posted here
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> --
> >>>>>>>>
> >>>>>>>> Oeyvind Brandtsegg
> >>>>>>>> Professor of Music Technology
> >>>>>>>> NTNU
> >>>>>>>> 7491 Trondheim
> >>>>>>>> Norway
> >>>>>>>> Cell: +47 92 203 205
> >>>>>>>>
> >>>>>>>> http://www.partikkelaudio.com/
> >>>>>>>> http://soundcloud.com/brandtsegg
> >>>>>>>> http://flyndresang.no/
> >>>>>>>> http://soundcloud.com/t-emp
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> --
> >>>>>>>
> >>>>>>> Oeyvind Brandtsegg
> >>>>>>> Professor of Music Technology
> >>>>>>> NTNU
> >>>>>>> 7491 Trondheim
> >>>>>>> Norway
> >>>>>>> Cell: +47 92 203 205
> >>>>>>>
> >>>>>>> http://www.partikkelaudio.com/
> >>>>>>> http://soundcloud.com/brandtsegg
> >>>>>>> http://flyndresang.no/
> >>>>>>> http://soundcloud.com/t-emp
> >>>>>>>
> >>>>>>> Csound mailing list
> >>>>>>> Csound@listserv.heanet.ie
> >>>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> >>>>>>> Send bugs reports to
> >>>>>>>      https://github.com/csound/csound/issues
> >>>>>>> Discussions of bugs and features can be posted here
> >>>>>>
> >>>>>>
> >>>>>> Csound mailing list
> >>>>>> Csound@listserv.heanet.ie
> >>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> >>>>>> Send bugs reports to
> >>>>>>       https://github.com/csound/csound/issues
> >>>>>> Discussions of bugs and features can be posted here
> >>>>>
> >>>>> Csound mailing list
> >>>>> Csound@listserv.heanet.ie
> >>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> >>>>> Send bugs reports to
> >>>>>     https://github.com/csound/csound/issues
> >>>>> Discussions of bugs and features can be posted here
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>>
> >>>> Oeyvind Brandtsegg
> >>>> Professor of Music Technology
> >>>> NTNU
> >>>> 7491 Trondheim
> >>>> Norway
> >>>> Cell: +47 92 203 205
> >>>>
> >>>> http://www.partikkelaudio.com/
> >>>> http://soundcloud.com/brandtsegg
> >>>> http://flyndresang.no/
> >>>> http://soundcloud.com/t-emp
> >>>>
> >>>> Csound mailing list
> >>>> Csound@listserv.heanet.ie
> >>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> >>>> Send bugs reports to
> >>>>      https://github.com/csound/csound/issues
> >>>> Discussions of bugs and features can be posted here
> >>>
> >>> Csound mailing list
> >>> Csound@listserv.heanet.ie
> >>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> >>> Send bugs reports to
> >>>       https://github.com/csound/csound/issues
> >>> Discussions of bugs and features can be posted here
> >>
> >>
> >>
> >> --
> >>
> >> Oeyvind Brandtsegg
> >> Professor of Music Technology
> >> NTNU
> >> 7491 Trondheim
> >> Norway
> >> Cell: +47 92 203 205
> >>
> >> http://www.partikkelaudio.com/
> >> http://soundcloud.com/brandtsegg
> >> http://flyndresang.no/
> >> http://soundcloud.com/t-emp
> >>
> >> Csound mailing list
> >> Csound@listserv.heanet.ie
> >> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> >> Send bugs reports to
> >>       https://github.com/csound/csound/issues
> >> Discussions of bugs and features can be posted here
> >
> > Csound mailing list
> > Csound@listserv.heanet.ie
> > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> > Send bugs reports to
> >        https://github.com/csound/csound/issues
> > Discussions of bugs and features can be posted here
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> 
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here