Line opcode question

Hi all,

in this code I generate two glissando (one ascending and one descending).
Why do I hear a “click” at the junction point?
Is there a way to avoid this audio “discontinuity”?

Thank you,
t.

<CsoundSynthesizer>
<CsOptions>

-odac  

</CsOptions>
<CsInstruments>

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

instr 1 

kp = p6
;choose between expon or line
if (kp == 0) then 	
  kpitch expon p4, p3, p5 
elseif (kp == 1) then
  kpitch line p4, p3, p5 
endif

asig   vco2 .6, kpitch 
       outs asig, asig

endin 

instr 1000
aL, aR monitor
fout "Gliss.wav", 4 ,aL, aR
endin 
</CsInstruments>
<CsScore>
 
i 1 0  2 300  600  1	
i 1 2 5 600 30 1

i 1000 0 7
e
</CsScore>
</CsoundSynthesizer>

Try using a single instr call with a transeg envelope to control the pitch. Transeg allows for seperate expon or line segments ex. expon attack & linear decay.

See:
transeg

<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>


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

instr 1 
; transeg with expon rise and linear decay

kpitch transeg 300, 2, -2, 600, 3, 0, 30
asig   vco2 .6, kpitch

       outs asig, asig

endin 

instr 1000
aL, aR monitor
fout "/sdcard/Gliss.wav", 14 ,aL, aR
endin 


</CsInstruments>
<CsScore>
i 1 0 5
i 1000 0 5
e
</CsScore>
</CsoundSynthesizer>

Thanks, it works fine.
But I see that in the score there are no glissandi data (time event, start freq, duration, end freq).
I’m thinking about how I could manage a score with a large number of glissandi, it would be convenient to write in the score in the form (for example) of the type:

i1 0 300 2 600 ;instr/time event/start_freq/duration/end_freq
i1 2 600 3 30
…etc…

Thanks,
t.

You can use parameters in transeg just as you use p3 for duration in other envelopes:
transeg p4, 2, 2, p5, 0, 3, p6

You can also create multiple segments, hence the “seg” in transeg, so one transeg could contain multiple glissandi.

<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>


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

instr 1 
if p9 == 1 then
    kpitch transeg p4, 2, -2, p5, 3, 0, p6
  elseif p9 == 2 then
    kpitch transeg p4, .5, -2, p5, .5, 1, p6, 3, -4, p7, 2, 2, p8       
  elseif p9 == 3 then
    kpitch transeg p4, .25, -2, p5, .5, 1, p6, .5, -4, p7, .5, 2, p8
endif

asig   vco2 .6, kpitch

       outs asig, asig

endin 

instr 1000
aL, aR monitor
fout "Gliss.wav", 14 ,aL, aR
endin 


</CsInstruments>
<CsScore>
i 1  0 5  300 600  30   0   0  1
i 1  6 6  110 440 220 880  55  2
i 1 13 4  580 240 280 240 280  3
i 1000 0 5
e
</CsScore>
</CsoundSynthesizer>

Nice, using “transeg” as you say, here I tried to make 12 glissandi (graphically it is a polyline of 12 segments):

<CsoundSynthesizer>

<CsOptions>

-odac

</CsOptions>

<CsInstruments>

sr = 44100

ksmps = 32

nchnls = 2

0dbfs = 1

instr 1

;if p9 == 1 then

kpitch transeg p4, p6, 0, p5, p8, 0, p7, p10, 0, p9, p12, 0, p11, p14, 0, p13, p16, 0, p15, p18, 0, p17, p20, 0, p19, p22, 0, p21, p24, 0, p23, p26, 0, p25, p28, 0, p27

asig vco2 .6, kpitch

outs asig, asig

endin

</CsInstruments>

<CsScore>

i 1 0 14 50

676 2

106 0.9

116 0.6

50 1.3

334 1.2

913 0.7

305 2.4

287 0.2

849 0.1

152 0.2

726 1.4

440 3

e

</CsScore>

</CsoundSynthesizer>

Thank you,
t.

:laughing: Well you definitely got the hang of it quickly. The transeg opcode is really useful at times, very flexible. And you’re welcome, glad I could help.