csound / csound

Main repository for Csound
https://csound.com
GNU Lesser General Public License v2.1
1.2k stars 189 forks source link

skip initialization for original soundfont opcodes #1729

Open tjingboem opened 12 months ago

tjingboem commented 12 months ago

option to prohibit initialization for tied-note usage.

ar1, ar2 sfplay3 ivel, inotenum, xamp, xfreq, ipreindex [, iflag] [, ioffset] [, ienv]

I do think these "original" soundfont opcodes are still relevant as they allow for a different usage than the fluid opcodes. A tied notes option could be another one.

Here is a list of soundfont opcodes that do not have this option:

tjingboem commented 10 months ago

i have added sflooper as i presume this is part of sfont.c This opcode is created later and i do see there is already a skip parameter. Have to look into this....

tjingboem commented 10 months ago

The simple example where you hear the clicks:

<CsoundSynthesizer>
<CsOptions> 
-odac ;;;realtime audio out
</CsOptions> 
<CsInstruments>

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

giSF    sfload  "/media/menno/datae/onderzoek/manualExamples/sf_GMbank.sf2" 
        sfplist giSF 
gipre   sfpreset 42, 0, giSF, 0 ; Cello

instr 1

ikey    = p4
ivel    = p5

iamp    = 0.000004                      ;scale amplitude down a lot, due to 0dbfs  = 1 
iamp    *= ivel                      ;make velocity-dependent

aL, aR  sfplay3 ivel, ikey, iamp, p4, gipre, 1 
        outs aL, aR 

    endin

</CsInstruments>
<CsScore>
s
i1.1 0 -1 60 100 
i1.1 3 -1 80 <  
i1.1 6 -1 100 <   
i1.1 9 1 60 40  
s
i1.1 0 -1 60 100 
i1.1 3 -1 80 <  
i1.1 6 -1 100 <   
i1.1 9 1 60 40  
i1.2 0 1 80 100 
e
</CsScore>
</CsoundSynthesizer>

The score uses fractional instrument numbers. The first section only plays one and the same fractional instr, while the second uses another, additional independent fractional instr.

The SoundFont can be found in /manual/examples. The Cello program 42 bank 0 is chosen because it contains a loop, needed for the held notes (-1)

Because all of these opcodes are based on the same sfont.c, i reckon that this change affects all of them?