Csound Csound-dev Csound-tekno Search About

[Csnd] kgoto issue

Date2013-11-24 15:15
FromPablo Frank
Subject[Csnd] kgoto issue
Attachmentsspectrogram.jpg  kgoto.wav  
Using the kgoto at the a) code below, the first sine is not silenced after 1.5 seconds, but it's listened with a sort of aliasing (spectrogram and wave attached). If a1=0 is put at the very end of the instr 1, as in the code at b) so the a1 is not listened at all. What's the matter?
The code:


a)

<CsoundSynthesizer>

<CsOptions>

-odac -iadc -d ;;;RT audio I/O

 

</CsOptions>

<CsInstruments>

 

sr = 44100

kr = 4410

ksmps = 10

nchnls = 1

 

instr 1

 

kcounter line 0, p3, p3 ; time counter

 

if kcounter > 1.5 kgoto second ; after 1.5 secs

 

a1 oscil 2000, 330, 1 ; first oscil

 

second:

a2 oscil 2000, 220, 1 ; second oscil

 

 

out a2 + a1

endin

</CsInstruments>

<CsScore>

 

f1 0 4096 10 1

 

; Play Instrument #1 for 2 seconds.

i 1 0 5

e

 

</CsScore>

</CsoundSynthesizer>

 


b)
<CsoundSynthesizer>

<CsOptions>

-odac -iadc -d ;;;RT audio I/O

 

</CsOptions>

<CsInstruments>

 

sr = 44100

kr = 4410

ksmps = 10

nchnls = 1

 

instr 1

 

kcounter line 0, p3, p3 ; time counter

 

if kcounter > 1.5 kgoto second ; after 1.5 secs

 

a1 oscil 2000, 330, 1 ; first oscil

 

second:

a2 oscil 2000, 220, 1 ; second oscil

 a1 = 0

 

out a2 + a1

endin

</CsInstruments>

<CsScore>

 

f1 0 4096 10 1

 

; Play Instrument #1 for 2 seconds.

i 1 0 5

e

 

</CsScore>

</CsoundSynthesizer>

 
 

Date2013-11-24 15:23
FromJustin Smith
SubjectRe: [Csnd] kgoto issue
in the first case, the goto prevents a1 from being generated, but the a1 signal is still being used, so the last values put in a1 will be reused, generating a sound at 4410 hz (since each a buffer is ksmps long, and you are repeating a random a buffer).


On Sun, Nov 24, 2013 at 7:15 AM, Pablo Frank <frank_pablo@hotmail.com> wrote:
Using the kgoto at the a) code below, the first sine is not silenced after 1.5 seconds, but it's listened with a sort of aliasing (spectrogram and wave attached). If a1=0 is put at the very end of the instr 1, as in the code at b) so the a1 is not listened at all. What's the matter?
The code:


a)

<CsoundSynthesizer>

<CsOptions>

-odac -iadc -d ;;;RT audio I/O

 

</CsOptions>

<CsInstruments>

 

sr = 44100

kr = 4410

ksmps = 10

nchnls = 1

 

instr 1

 

kcounter line 0, p3, p3 ; time counter

 

if kcounter > 1.5 kgoto second ; after 1.5 secs

 

a1 oscil 2000, 330, 1 ; first oscil

 

second:

a2 oscil 2000, 220, 1 ; second oscil

 

 

out a2 + a1

endin

</CsInstruments>

<CsScore>

 

f1 0 4096 10 1

 

; Play Instrument #1 for 2 seconds.

i 1 0 5

e

 

</CsScore>

</CsoundSynthesizer>

 


b)
<CsoundSynthesizer>

<CsOptions>

-odac -iadc -d ;;;RT audio I/O

 

</CsOptions>

<CsInstruments>

 

sr = 44100

kr = 4410

ksmps = 10

nchnls = 1

 

instr 1

 

kcounter line 0, p3, p3 ; time counter

 

if kcounter > 1.5 kgoto second ; after 1.5 secs

 

a1 oscil 2000, 330, 1 ; first oscil

 

second:

a2 oscil 2000, 220, 1 ; second oscil

 a1 = 0

 

out a2 + a1

endin

</CsInstruments>

<CsScore>

 

f1 0 4096 10 1

 

; Play Instrument #1 for 2 seconds.

i 1 0 5

e

 

</CsScore>

</CsoundSynthesizer>