Re: [Csnd] nice working version of fractional voice legato

Hello Iain,

first, really, many thanks for the new csound6~ object ! :slight_smile:

To some years, I work in a Max GUI environment generated in JS and write score instructions for Csound via antescofo~.

About this question, the Csound score, I will have a lot a feature requests for Csound 8 (I say not 7, but 8).
Indeed Score and writing music in Csound has to be now a lot developed, Csound sounds great like that, all the world knows that Csound is the "best" dsp program... but not all musician know that music is not just make sound, but make sense... I would like to composed, in Csound 8 (not 7), a new piece juste in score, with possibility of scripting music function directly in score, without Python Antescofo or other langage... This piece will titled 'Mon Amour Csound' :wink:

Anyway Iain, I am a noon in programming music but listening those two csd: the first is the approximately same as yours, the second a part of my music... Both in MaxMsp context and your csound~object... I post that just to share different ways to do it....

Thanks again,

JB

FIRST:

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

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

opcode chn_ctrl, k, iSiS
i_pchamp, S_param_name, i_inst, S_end xin
S_string sprintf "s.02f%s", S_param_name, i_inst, S_end
chnset i_pchamp, S_string
k_value chnget S_string
xout k_value
endop

opcode init_skip, 0, iii
ip1, ival_tab, icnt xin
indx = 0
loop:
S_val sprintf "ctrl-%.02f_d&quot;, ip1, icnt chnset\(tab\_i\(indx\-1,ival\_tab\), sprintf\(&quot;ctrl\-.02f_%d", ip1, indx))
loop_lt indx, 1, icnt, loop
endop

instr 1

kfrq chn_ctrl p4, "ctrl-", p1,"_1"
kfrq_portamento chn_ctrl p5, "ctrl-", p1,"_2"

kfrq portk kfrq, kfrq_portamento

    asig = vco2(.1, cpsmidinn(kfrq) * 1.00, 2, 0.5)
    asig += vco2(.1, cpsmidinn(kfrq) * 1.002, 2, 0.51)
    asig += vco2(.1, cpsmidinn(kfrq) * 0.997, 2, 0.49)
    outs asig, asig
    
endin

instr 81

S_portk = p4
ival_port = p5
S_chn1 sprintf "%s", S_portk
chnset ival_port, S_chn1
ival_port chnget S_chn1

S_chnName = p6
ival = p7
S_chn sprintf "%s", S_chnName
chnset ival, S_chn
ival chnget S_chn
print ival

endin

</CsInstruments>
<CsScore>

f0 8

i 1.01 0 10 48 0
i 1.02 0 10 52 0
i 1.03 0 10 55 0

i 81.01 2.2 1 "ctrl-1.01_2" 0.13 "ctrl-1.01_1" 55
i 81.02 2.2 1 "ctrl-1.02_2" 0.13 "ctrl-1.02_1" 59
i 81.03 2.2 1 "ctrl-1.03_2" 0.13 "ctrl-1.03_1" 62

i 81.01 4 1 "ctrl-1.01_2" 0. "ctrl-1.01_1" 48
i 81.02 4 1 "ctrl-1.02_2" 0. "ctrl-1.02_1" 52
i 81.03 4 1 "ctrl-1.03_2" 0. "ctrl-1.03_1" 55

</CsScore>

</CsoundSynthesizer>

SECOND:

<CsoundSynthesizer>
<CsOptions>

</CsOptions>
<CsInstruments>

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

opcode FORMATAGE_CTRL, k, iSiS
i_pchamp, S_param_name, i_inst, S_end xin
S_string sprintf "s.02f%s", S_param_name, i_inst, S_end
chnset i_pchamp, S_string
k_value chnget S_string
xout k_value
endop

opcode FORMATAGE_FXCTRL, k, iSiS
i_pchamp, S_param_name, i_inst, S_end xin
S_string sprintf "s.03f%s", S_param_name, i_inst, S_end
chnset i_pchamp, S_string
k_value chnget S_string
xout k_value
endop

opcode jbfilter, aa, aakkkkkkk

achanL, achanR, kmodDepth, kmodFreq, kmodType, kfiltFreq, kfiltType, kbalance, kreso xin

    if kmodType < 5 then
        kTable = kmodType + 1
        kmodd oscilikt kmodDepth, kmodFreq, kTable
    else
        kmodd randh kmodDepth, kmodFreq, .365
    endif
    
    kfiltFreq = octcps(cpsmidinn((kfiltFreq * 0.001) * 122.00))
    kmodd = cpsoct(kmodd+kfiltFreq)

    kfr limit kmodd, 40, 9300
    kfr port kfr, .04
    
    denorm achanL, achanR

    aloL, ahiL, abdL svfilter achanL, kfr, kreso, 1, 1
    aloR, ahiR, abdR svfilter achanR, kfr, kreso, 1, 1

    if kfiltType == 0 then
        aoutL = aloL
        aoutR = aloR
    elseif kfiltType == 1 then
        aoutL = ahiL
        aoutR = ahiR
    else
        aoutL = abdL
        aoutR = abdR
    endif

    if kbalance > 0 then
        aoutL balance aoutL, achanL
        aoutR balance aoutR, achanR
    endif

xout aoutL, aoutR

endop

opcode jbpan, aa, k

kpani xin

aPan lfo 0.5, kpani, 1
aPan = aPan + 0.5
aPanL = aPan
aPanR = 1 - aPan

xout aPanL, aPanR

endop

opcode jbdlay, aa, aakkk

aOut1, aOut2, kdelL, kdelR, kfb xin

iPdelL = 0.01
iPdelR = 0.01
kdelL port kdelL, iPdelL
kdelR port kdelR, iPdelR

aKfb interp kfb

abuf2 delayr 3
adelL deltapi kdelL * 0.001
  delayw aOut1 + (adelL * aKfb)
abuf3 delayr 3
adelR deltapi kdelR * 0.001
  delayw aOut2 + (adelR * aKfb)

xout adelL, adelR

endop

instr 1
;------
ifnEnv = p1*100
idlt1A = p4
idlt1B = p5
ifn1 = p6
ifn2 = p7
ifn3 = p8
ifn4 = p9
;---------------------------------------------
kLoop FORMATAGE_CTRL p10, "ctrl-", p1,"_1"
kPTloop FORMATAGE_CTRL p11, "ctrl-", p1,"_2"
kcps1 FORMATAGE_CTRL p12,"ctrl-", p1, "_3"
ktimiA FORMATAGE_CTRL p13, "ctrl-", p1, "_4"
kamp1 FORMATAGE_CTRL p14, "ctrl-", p1, "_5"
ktimiB FORMATAGE_CTRL p15, "ctrl-", p1, "_6"
kpani FORMATAGE_CTRL p16,"ctrl-", p1, "_7"
ktimiC FORMATAGE_CTRL p17,"ctrl-", p1, "_8"
kmodDepth FORMATAGE_CTRL p18, "ctrl-", p1, "_9"
kmodFreq FORMATAGE_CTRL p19, "ctrl-", p1, "_10"
kmodType FORMATAGE_CTRL p20, "ctrl-", p1, "_11"
kfiltFreq FORMATAGE_CTRL p21, "ctrl-", p1, "_12"
kfiltType FORMATAGE_CTRL p22, "ctrl-", p1, "_13"
kbalance FORMATAGE_CTRL p23, "ctrl-", p1, "_14"
kreso FORMATAGE_CTRL p24, "ctrl-", p1, "_15"
kvol FORMATAGE_CTRL p25, "ctrl-", p1, "_16"
kdetA FORMATAGE_CTRL p26, "ctrl-", p1, "_17"
kdetB FORMATAGE_CTRL p27, "ctrl-", p1, "_18"
kdetC FORMATAGE_CTRL p28, "ctrl-", p1, "_19"
;---------------------------------------------

p3 = abs(p3)
if timeinsts()>=(p3) then
turnoff
endif
;----------
kLoop portk kLoop, kPTloop
kampE = kLoop/p3
kndx phasor kampE
ixmode = 1
kampA tablei kndx, ifnEnv, ixmode
kampA limit kampA,0,1
kampA expcurve kampA,8
aenv interp kampA

;------
adelayed1A init 0.001
adelayed1B init 0.001
;------
;------
kcps1 portk kcps1, ktimiA
kamp1 portk kamp1, ktimiB

;-----------------------------------------------------
  asig1A poscil kamp1, kcps1, ifn1
  asig1B poscil kamp1/2, kcps1*kdetA, ifn2
  asig1C poscil kamp1/3, kcps1*kdetB, ifn3
  asig1D poscil kamp1/4, kcps1*kdetC, ifn4
;-----------------------------------------------------
aSiG1A = (asig1A + asig1B + asig1C + asig1D) * aenv
aSiG1B = (asig1A + asig1B + asig1C + asig1D) * aenv
;-----------------------------------------------------
aDeClick linsegr 1,0.01,0
;----------
kpani portk kpani, ktimiC
aPanL, aPanR jbpan kpani
;----------
  adelayed1A = (adelayed1A * 0.5) + aSiG1A
  adelayed1A delay adelayed1A, idlt1A
  adelayed1B = adelayed1B * 0.5 + aSiG1B
  adelayed1B delay adelayed1B, idlt1B
;-------------------------------------
achani1a = (adelayed1A)*aDeClick*aPanL
achani1b = (adelayed1B)*aDeClick*aPanR
;-----------------------------------------------
aoutL, aoutR jbfilter achani1a, achani1b, kmodDepth, kmodFreq, kmodType, kfiltFreq, kfiltType, kbalance, kreso
;-----------------------------------------
ageniL = ((aoutL*kvol) + achani1a) * aenv
ageniR = ((aoutR*kvol) + achani1b) * aenv
;-----------------------------------------

;outch 1, ageniL, 2, ageniR

S_chn1 sprintf "audioL_\.04f&quot;, \(90 \+ \(p1/10\)\) S\_chn2 sprintf &quot;audioR\_.04f", (90 + (p1/10))

  chnset ageniL, S_chn1
  chnset ageniR, S_chn2

endin

instr 90
;-------
S_chn1 sprintf "audioL_\.04f&quot;, p1 S\_chn2 sprintf &quot;audioR\_.04f", p1
; DELAYS CONTROLS
;---------
kdelL FORMATAGE_FXCTRL p4, "fx_ctrl-", p1,"_1"
kdelR FORMATAGE_FXCTRL p5, "fx_ctrl-", p1,"_2"
kfb FORMATAGE_FXCTRL p6,"fx_ctrl-", p1, "_3"

aOut1 chnget S_chn1
aOut2 chnget S_chn2
;------------------ DELAYS
adelL, adelR jbdlay aOut1, aOut2, kdelL, kdelR, kfb
;------------------------------------------------------
;------------------ REVERB
;aRevL, aRevR jbverb adelL, adelR, kRevfb, kSpace
;------------------------------------------------------
adeclik linsegr 1,0.01,0.
;------------------------------------------------------
  aOut_1 = adelL*adeclik
  aOut_2 = adelR*adeclik
;------------------------------------------------------
         outch 1, aOut_1, 2, aOut_2
;------------------------------------------------------
S_foutFXL sprintf "ageniL_\.04f&quot;, \(999 \+ frac\(p1\)\) S\_foutFXR sprintf &quot;ageniR\_.04f", (999 + frac(p1))

chnmix aOut_1, S_foutFXL
chnmix aOut_2, S_foutFXR

chnclear S_chn1
chnclear S_chn2

endin

</CsInstruments>
<CsScore>

f0 36000

f1 0 16384 11 10 1 .7

f 101 0 1024 16 1 1024 1.9499999999999962 0.3611111111111111
i 1.01 0.0000 -240 0.0160 0.0100 1.0000 1.0000 1.0000 1.0000 120.0000 0.0000 329.6276 0.0000 0.7000 16.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 1.0000 0.0000 1.0110 1.0130 1.0120
i 90.101 0.0000 -60 34.0000 95.0000 0.3000

f 102 0 1024 16 0.7006172839506173 725.6900832678579 4 1 298.30991673214214 -4.0500000000000025 0.2932098765432099
i 1.02 0.0000 -240 0.0080 0.0270 1.0000 1.0000 1.0000 1.0000 80.0000 0.0000 195.9977 0.0000 0.3900 12.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 1.0000 0.0000 i i 90.102 0.0000 -60 236.0000 113.0000 0.7300
i 90.102 0.0000 -60 236.0000 113.0000 0.7300

f 103 0 1024 16 0.5771604938271605 396.429600797657 2 1 627.570399202343 -6.050000000000005 0
i 1.03 0.0000 -240 0.0050 0.0120 1.0000 1.0000 1.0000 1.0000 160.0000 0.0000 246.9417 0.0000 0.2900 4.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 1.0000 0.0000 1.0160 1.0120 1.0100
i 90.103 0.0000 -60 238.0000 416.0000 0.5650

f 104 0 1024 16 0.44135802469135804 244.96977886136452 1.5000000000000002 0.9722222222222222 167.92284605980248 -1.5000000000000002 0.6327160493827161 428.0386272112612 4.999999999999999 1 183.0687478675718 -3.550000000000002 0.4537037037037037
i 1.04 0.0000 -240 0.0091 0.0061 1.0000 1.0000 1.0000 1.0000 220.0000 0.0000 261.6256 0.0000 0.4900 8.0000 1.2300 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 1.0000 0.0000 1.0122 1.0100 1.0090
i 90.104 0.0000 -60 399.0000 275.0000 0.5800

e

</CsScore>

</CsoundSynthesizer>

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

Thanks Jean, I will take a look at this. And I’m glad you are finding the csound6~ object for Max useful! :slight_smile:

iain

I’ve noticed that the program doesn’t seem to like fractions
that are not in decimal form.

It didn’t take kindly to fractions, especially transcendental
types like 22/7, 1/6, 1/16 as such. It does like decial form
of fractions.

Just something I noticed when doing a project. Is that a
characteristic of Csound?

-Partev

I use fractions as pitch ratios all the time. As in, pretty much every piece.

Ah, have to remember that. Doesn’t seem to like it when I use
that on amplitudes. Seems to like decimals for that.

Thanks,
-Partev

Shouldn‚Äôt make any difference. A ‚Äúfraction‚ÄĚ in Csound is just a divide that resolves to a floating point (actually double) number., equivalent to a literal decimal.