Cabbage Logo
Back to Cabbage Site

First Cabbage instrument

Hi, I have created my first instrument, based on Iain McCurdy’s PM (Carrier with Feedback) orc.
I get a message, that is related to the function I use to control the several LFOs of the orchestra:
INIT ERROR in instr 1: Invalid ftable no. 0.000000
kFreq_base_tab table.k kndx1 #i2 1 0 0
INIT ERROR in instr 1: table: could not find ftable 0
kFreq_base_tab table.k kndx1 #i2 1 0 0
INIT ERROR in instr 1: Invalid ftable no. 0.000000
kFdb_ratio_tab table.k kndx2 #i7 1 0 0
INIT ERROR in instr 1: table: could not find ftable 0
kFdb_ratio_tab table.k kndx2 #i7 1 0 0
INIT ERROR in instr 1: Invalid ftable no. 0.000000
kamp_env_tab1 table.k kamp_env_indx1 #i10 1 0 0
INIT ERROR in instr 1: table: could not find ftable 0
kamp_env_tab1 table.k kamp_env_indx1 #i10 1 0 0
INIT ERROR in instr 1: Invalid ftable no. 0.000000
aCarrier tablei.a #a13 #i14 1 0 1
INIT ERROR in instr 1: table: could not find ftable 0
aCarrier tablei.a #a13 #i14 1 0 1

Isn’t the syntax of the following orchestra correct to control the function of a table?

<Cabbage>
rslider bounds(0, 0, 50, 50), channel("Base1"), range(1, 20000, 100, .5, 1), text("CarrBase    ", ""),  
rslider bounds(50, 0, 50, 50), channel("Range1"), range(0, 20, 0, 1, 0.1), text("Range    ", ""),  
rslider bounds(100, 0, 50, 50), channel("cps1"), range(0, 16, .1, 1, 0.1), text("Cps    ", ""), 
combobox bounds(366, 0, 71, 29), channel("Fnz1"), items("100", "101", "102")
combobox bounds(586, 0, 71, 29), channel("Fnz2"), items("100", "101", "102") 
combobox bounds(150, 0, 71, 29), channel("Fnz3"), items("100", "101", "102"), popuptext("text", ""),
rslider bounds(218, 0, 50, 50), channel("Base2"), range(0, 10, 1, 1, 0.1), text("FeedBase    ", ""),  
rslider bounds(268, 0, 50, 50), channel("Range2"), range(0, 20, 0, 1, 0.1), text("Range    ", ""),  
rslider bounds(318, 0, 50, 50), channel("cps2"), range(0, 16, .1, 1, 0.1), text("Cps    ", ""),  
rslider bounds(438, 0, 50, 50), channel("Base3"), range(0, 10, .1, 1, 0.1), text("AmpBase    ", ""),  
rslider bounds(488, 0, 50, 50), channel("Range3"), range(0, 10, 0, 1, 0.1), text("Range    ", ""),  
rslider bounds(538, 0, 50, 50), channel("cps3"), range(0, 16, .1, 1, 0.1), text("Cps    ", ""),  
rslider bounds(658, 0, 50, 50), channel("pan"), range(0, 1, .5, 1, 0.1), text("Pan    ", ""),  
combobox bounds(708, 0, 71, 29), channel("wave1"), items("100", "101", "102")

label bounds(712, 32, 50, 15), text("Wave", ""),  

</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d 
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 64
nchnls = 2
0dbfs=1

instr 1

kporttime    linseg    0,0.001,1
    
;==========freq_base 
kfreq_base_base chnget "Base1"
kfreq_base_base    portk    kfreq_base_base,kporttime*0.05
kfreq_base_range chnget "Range1" ; %%%%%
kfreq_base_range = kfreq_base_base * kfreq_base_range
kcps1 chnget "cps1"
kndx1 phasor kcps1
kFreq_base_fnz chnget "Fnz1"
kFreq_base_tab table kndx1, i(kFreq_base_fnz), 1
kfreq_base = kFreq_base_tab * kfreq_base_range
kfreq_base = kfreq_base_base + kfreq_base

;==========Fdb_ratio1
kFdb_ratio_base chnget "Base2"
kFdb_ratio_base    portk    kFdb_ratio_base,kporttime*0.05
kFdb_ratio_range chnget "Range2" ; %%%%%
kFdb_ratio_range = kFdb_ratio_base * kFdb_ratio_range
kcps2 chnget "cps2"
kndx2 phasor kcps2
kFdb_ratio_fnz chnget "Fnz2"
kFdb_ratio_tab table kndx2, i(kFdb_ratio_fnz), 1
kFdb_ratio = kFdb_ratio_tab * kFdb_ratio_range
kFdb_ratio = kFdb_ratio_base + kFdb_ratio

kwave chnget "wave1"

;==========amplitude envelope
kamp_env_base_base1 chnget "Base3"
iamp_env_base_range1 chnget "Range3"   
kamp_env_cps1 chnget "cps3" 
kamp_Env_base_fnz1 chnget "Fnz3"
kamp_env_indx1 phasor kamp_env_cps1
kamp_env_tab1 table kamp_env_indx1, i(kamp_Env_base_fnz1), 1
kamp_env_base1 = kamp_env_tab1 * iamp_env_base_range1 
kamp_env_base1 = kamp_env_base_base1 + kamp_env_base1

kpan chnget "pan"


aFB            init        0                                            
aCarPhase        phasor    kfreq_base                                         
aCarrier        tablei    aCarPhase + aFB, i(kwave),1,0,1                        
aFB            =        aCarrier * kFdb_ratio            

aCarrier = aCarrier * kamp_env_base1


outs        aCarrier * kpan, aCarrier * kpan                                                            ;SEND AUDIO TO OUTPUTS

endin

</CsInstruments>  
<CsScore>
;rampa up concavo>>convesso
f 100 0 8193 5 0.01 164 0.01 164 0.01 164 0.01 163 0.01 164 0.01 164 0.01 164 0.01 164 0.01 164 0.01 164 0.01 163 0.01 164 0.01 246 0.01 164 0.01 164 0.01 164 0.01 164 0.01 163 0.01 164 0.01 164 0.01 164 0.01 164 0.01 164 0.01 164 0.02 163 0.02 164 0.02 164 0.02 164 0.03 164 0.03 164 0.04 164 0.04 163 0.05 164 0.06 164 0.079 164 0.089 164 0.109 246 0.139 164 0.159 163 0.198 164 0.228 164 0.277 164 0.327 164 0.386 164 0.455 164 0.535 163 0.634 164 0.743 164 0.861 164 1.0
f 101 0 8193 5 0.01 164 0.01 164 0.01 164 0.01 163 0.01 164 0.01 164 0.01 164 0.01 164 0.01 164 0.01 164 0.02 163 0.02 164 0.02 246 0.02 164 0.03 164 0.03 164 0.03 164 0.04 163 0.05 164 0.05 164 0.06 164 0.069 164 0.079 164 0.089 164 0.099 163 0.119 164 0.129 164 0.149 164 0.168 164 0.188 164 0.208 164 0.228 163 0.248 164 0.277 164 0.307 164 0.337 164 0.366 246 0.396 164 0.436 163 0.475 164 0.515 164 0.554 164 0.604 164 0.653 164 0.703 164 0.752 163 0.812 164 0.871 164 0.931 164 1.0
f 102 0 8193 5 0.01 164 0.01 164 0.02 164 0.03 163 0.03 164 0.04 164 0.05 164 0.069 164 0.079 164 0.089 164 0.099 163 0.119 164 0.129 246 0.149 164 0.159 164 0.178 164 0.198 164 0.218 163 0.228 164 0.248 164 0.267 164 0.287 164 0.307 164 0.327 164 0.356 163 0.376 164 0.396 164 0.416 164 0.436 164 0.465 164 0.485 164 0.515 163 0.535 164 0.554 164 0.584 164 0.614 164 0.634 246 0.663 164 0.683 163 0.713 164 0.743 164 0.772 164 0.802 164 0.822 164 0.852 164 0.881 163 0.911 164 0.941 164 0.97 164 1.0
f 103 0 8193 5 0.01 164 0.079 164 0.129 164 0.159 163 0.198 164 0.228 164 0.257 164 0.277 164 0.307 164 0.327 164 0.356 163 0.376 164 0.396 246 0.416 164 0.436 164 0.455 164 0.475 164 0.495 163 0.515 164 0.535 164 0.554 164 0.574 164 0.594 164 0.604 164 0.624 163 0.644 164 0.653 164 0.673 164 0.693 164 0.703 164 0.723 164 0.743 163 0.752 164 0.772 164 0.782 164 0.802 164 0.812 246 0.832 164 0.842 163 0.861 164 0.871 164 0.891 164 0.901 164 0.921 164 0.931 164 0.95 163 0.96 164 0.97 164 0.99 164 1.0
 


f0 3600
i1 0 200
</CsScore>
</CsoundSynthesizer>

Well you’re off to a good start! I think hacking one of Iain’s instrument is a rite of passage for most Csounders :wink:

Unless I’m mistaken, the problem here is that when the instrument runs through its init pass, the value returned by the k-rate chnget will be 0. Same happens with any k-rate opcode. For example, check out this instrument.

instr 1
    p3 = ksmps/sr
    k1 line 10, 10, 0
    print i(k1)
    printk2 k1
endin

This instrument prints the following as soon as it’s started:

instr 1:  #i1 = 0.000
i1    10.00000

Printing i(k1) returns a 0 (#i1 = 0.00), while using a k-rate print opcodes returns 10.00000, which is what one would expect from a line opcode starting at 10. Casting k-rate variables as i-rate will work IF the variable has been initialised using the init opcode. Why not just use an i-rate variables for you tables? In your instrument they will not be able to change anyway.

If you wish to change the tables during performance you may need to rethink your instrument design as the table opcodes only accept i-rate table numbers. Post back if any of this is confusing. I know it still confuses me and I’ve been using Csound for years.

In this case I may try and replace table with tableikt, which is what I actually did, but there is still one message of error:

INIT ERROR: Invalid ftable no. 0.000000
end of section 1 sect peak amps: 0.00000 0.00000
SECTION 1:

rslider bounds(0, 0, 50, 50), channel("Base1"), range(1, 20000, 100, .5, 1), text("CarrBase ", ""), rslider bounds(50, 0, 50, 50), channel("Range1"), range(0, 20, 0, 1, 0.1), text("Range ", ""), rslider bounds(100, 0, 50, 50), channel("cps1"), range(0, 16, .1, 1, 0.1), text("Cps ", ""), combobox bounds(366, 0, 71, 29), channel("Fnz1"), items("100", "101", "102") combobox bounds(586, 0, 71, 29), channel("Fnz2"), items("100", "101", "102") combobox bounds(150, 0, 71, 29), channel("Fnz3"), items("100", "101", "102"), popuptext("text", ""), rslider bounds(218, 0, 50, 50), channel("Base2"), range(0, 10, 1, 1, 0.1), text("FeedBase ", ""), rslider bounds(268, 0, 50, 50), channel("Range2"), range(0, 20, 0, 1, 0.1), text("Range ", ""), rslider bounds(318, 0, 50, 50), channel("cps2"), range(0, 16, .1, 1, 0.1), text("Cps ", ""), rslider bounds(438, 0, 50, 50), channel("Base3"), range(0, 10, .1, 1, 0.1), text("AmpBase ", ""), rslider bounds(488, 0, 50, 50), channel("Range3"), range(0, 10, 0, 1, 0.1), text("Range ", ""), rslider bounds(538, 0, 50, 50), channel("cps3"), range(0, 16, .1, 1, 0.1), text("Cps ", ""), rslider bounds(658, 0, 50, 50), channel("pan"), range(0, 1, .5, 1, 0.1), text("Pan ", ""), combobox bounds(708, 0, 71, 29), channel("wave1"), items("100", "101", "102")

label bounds(712, 32, 50, 15), text(“Wave”, “”),

-n -d sr = 44100 ksmps = 64 nchnls = 2 0dbfs=1

instr 1

kporttime linseg 0,0.001,1

;==========freq_base
kfreq_base_base chnget “Base1”
kfreq_base_base portk kfreq_base_base,kporttime*0.05
kfreq_base_range chnget “Range1” ; %%%%%
kfreq_base_range = kfreq_base_base * kfreq_base_range
kcps1 chnget “cps1”
kndx1 phasor kcps1
kFreq_base_fnz chnget “Fnz1”
kFreq_base_tab tableikt kndx1, kFreq_base_fnz, 1
kfreq_base = kFreq_base_tab * kfreq_base_range
kfreq_base = kfreq_base_base + kfreq_base

;==========Fdb_ratio1
kFdb_ratio_base chnget “Base2”
kFdb_ratio_base portk kFdb_ratio_base,kporttime*0.05
kFdb_ratio_range chnget “Range2” ; %%%%%
kFdb_ratio_range = kFdb_ratio_base * kFdb_ratio_range
kcps2 chnget “cps2”
kndx2 phasor kcps2
kFdb_ratio_fnz chnget “Fnz2”
kFdb_ratio_tab tableikt kndx2, kFdb_ratio_fnz, 1
kFdb_ratio = kFdb_ratio_tab * kFdb_ratio_range
kFdb_ratio = kFdb_ratio_base + kFdb_ratio

kwave chnget “wave1”

;==========amplitude envelope
kamp_env_base_base1 chnget “Base3”
iamp_env_base_range1 chnget “Range3”
kamp_env_cps1 chnget “cps3”
kamp_Env_base_fnz1 chnget “Fnz3”
kamp_env_indx1 phasor kamp_env_cps1
kamp_env_tab1 tableikt kamp_env_indx1, kamp_Env_base_fnz1, 1
kamp_env_base1 = kamp_env_tab1 * iamp_env_base_range1
kamp_env_base1 = kamp_env_base_base1 + kamp_env_base1

kpan chnget “pan”

aFB init 0
aCarPhase phasor kfreq_base

aCarrier tableikt aCarPhase + aFB, kwave,1,0,1
aFB = aCarrier * kFdb_ratio

aCarrier = aCarrier * kamp_env_base1

outs aCarrier * kpan, aCarrier * kpan ;SEND AUDIO TO OUTPUTS

endin

;rampa up concavo>>convesso f 100 0 8193 5 0.01 164 0.01 164 0.01 164 0.01 163 0.01 164 0.01 164 0.01 164 0.01 164 0.01 164 0.01 164 0.01 163 0.01 164 0.01 246 0.01 164 0.01 164 0.01 164 0.01 164 0.01 163 0.01 164 0.01 164 0.01 164 0.01 164 0.01 164 0.01 164 0.02 163 0.02 164 0.02 164 0.02 164 0.03 164 0.03 164 0.04 164 0.04 163 0.05 164 0.06 164 0.079 164 0.089 164 0.109 246 0.139 164 0.159 163 0.198 164 0.228 164 0.277 164 0.327 164 0.386 164 0.455 164 0.535 163 0.634 164 0.743 164 0.861 164 1.0 f 101 0 8193 5 0.01 164 0.01 164 0.01 164 0.01 163 0.01 164 0.01 164 0.01 164 0.01 164 0.01 164 0.01 164 0.02 163 0.02 164 0.02 246 0.02 164 0.03 164 0.03 164 0.03 164 0.04 163 0.05 164 0.05 164 0.06 164 0.069 164 0.079 164 0.089 164 0.099 163 0.119 164 0.129 164 0.149 164 0.168 164 0.188 164 0.208 164 0.228 163 0.248 164 0.277 164 0.307 164 0.337 164 0.366 246 0.396 164 0.436 163 0.475 164 0.515 164 0.554 164 0.604 164 0.653 164 0.703 164 0.752 163 0.812 164 0.871 164 0.931 164 1.0 f 102 0 8193 5 0.01 164 0.01 164 0.02 164 0.03 163 0.03 164 0.04 164 0.05 164 0.069 164 0.079 164 0.089 164 0.099 163 0.119 164 0.129 246 0.149 164 0.159 164 0.178 164 0.198 164 0.218 163 0.228 164 0.248 164 0.267 164 0.287 164 0.307 164 0.327 164 0.356 163 0.376 164 0.396 164 0.416 164 0.436 164 0.465 164 0.485 164 0.515 163 0.535 164 0.554 164 0.584 164 0.614 164 0.634 246 0.663 164 0.683 163 0.713 164 0.743 164 0.772 164 0.802 164 0.822 164 0.852 164 0.881 163 0.911 164 0.941 164 0.97 164 1.0 f 103 0 8193 5 0.01 164 0.079 164 0.129 164 0.159 163 0.198 164 0.228 164 0.257 164 0.277 164 0.307 164 0.327 164 0.356 163 0.376 164 0.396 246 0.416 164 0.436 164 0.455 164 0.475 164 0.495 163 0.515 164 0.535 164 0.554 164 0.574 164 0.594 164 0.604 164 0.624 163 0.644 164 0.653 164 0.673 164 0.693 164 0.703 164 0.723 164 0.743 163 0.752 164 0.772 164 0.782 164 0.802 164 0.812 246 0.832 164 0.842 163 0.861 164 0.871 164 0.891 164 0.901 164 0.921 164 0.931 164 0.95 163 0.96 164 0.97 164 0.99 164 1.0

f0 3600
i1 0 200