[Csnd] ftsamplebank

Hi.
I am studying ftsamplebank opcode. I am running the example from the Reference Manual with experimenting with my own sounds (just 3 small WAV files). Most of the time, I get just two of them (tables 61 and 62). Table 60 is considered invalid. Why?
The WAV files are ok for diskin2 opcode, but one of them never plays back with the ftsamplebank example.
I pasted the Console message and the code below. Sounds are attached to this email message.
What am I doing wrong here?
Thank you.
Best wishes,
Marcelo

Invalid ftable no. 60.000000ftable 60:

deferred alloc for /Users/marcelocarneiro/Dropbox/MacMini_Back/Csound/porcos_teste_player/mictorio_1_trecho1.wav

audio sr = 48000, stereo, reading both channels

opening WAV infile /Users/marcelocarneiro/Dropbox/MacMini_Back/Csound/porcos_teste_player/mictorio_1_trecho1.wav

defer length 241115

ftable 61:

deferred alloc for /Users/marcelocarneiro/Dropbox/MacMini_Back/Csound/porcos_teste_player/mictorio_1_trecho2.wav

audio sr = 48000, stereo, reading both channels

opening WAV infile /Users/marcelocarneiro/Dropbox/MacMini_Back/Csound/porcos_teste_player/mictorio_1_trecho2.wav

defer length 105902

ftable 62:

deferred alloc for /Users/marcelocarneiro/Dropbox/MacMini_Back/Csound/porcos_teste_player/porcos_mamando_01_gaintrecho.wav

audio sr = 48000, stereo, reading both channels

opening WAV infile /Users/marcelocarneiro/Dropbox/MacMini_Back/Csound/porcos_teste_player/porcos_mamando_01_gaintrecho.wav

defer length 236524

(Attachment mictorio_1_trecho2.wav is missing)

(Attachment mictorio_1_trecho1.wav is missing)

(Attachment porcos_mamando_01_gaintrecho.wav is missing)

Hi Marcelo. I just tested here and I get no such error about table 60? Here is my Csound output:

sr = 48000.0, kr = 1500.000, ksmps = 32
0dBFS level = 1.0, A4 tuning = 440.0
orch now loaded
audio buffered in 1024 sample-frame blocks
SECTION 1:
CABBAGE: Version:2.9.222
new alloc for instr 1:
instr 1: iNumberOfFiles = 3.000
ftable 60:
deferred alloc for /Users/rwalsh/Downloads//mictorio_1_trecho1.wav
audio sr = 48000, stereo, reading both channels
opening WAV infile /Users/rwalsh/Downloads//mictorio_1_trecho1.wav
defer length 241115
ftable 61:
deferred alloc for /Users/rwalsh/Downloads//mictorio_1_trecho2.wav
audio sr = 48000, stereo, reading both channels
opening WAV infile /Users/rwalsh/Downloads//mictorio_1_trecho2.wav
defer length 105902
ftable 62:
deferred alloc for /Users/rwalsh/Downloads//porcos_mamando_01_gaintrecho.wav
audio sr = 48000, stereo, reading both channels
opening WAV infile /Users/rwalsh/Downloads//porcos_mamando_01_gaintrecho.wav
defer length 236524
rtevent: T 1.000 TT 1.000 M: 0.00000 0.00000
new alloc for instr 1000:
rtevent: T 2.000 TT 2.000 M: 0.99537 0.99537
new alloc for instr 1000:
B 0.000 … 15.000 T 15.000 TT 15.000 M: 1.00000 1.00000

Hi

Works for me too but these messages from the mailing list possibly related:
https://ml.csound.1bpm.net/mailinglist.csound/thread/126340

https://ml.csound.1bpm.net/mailinglist.csound/thread/126343

…although your event_i is not playing them immediately so not sure if the issue described in those is related… Also I with the p4 passed to i1000 is iFirstTableNumber + iFileCount, then it never passes 60 as p4 to i1000, as iFileCount starts at 1 so I’m seeing only 61 and 62 passed to i1000, so curious how it could have the result you have experienced…

Richard

Hi Marcelo, although I didn’t get the error every time, I did get it sporadically. However, it never played all 3 samples.

The issue appears to be you are not allowing adequate time for the first sample to load before attempting playback. This becomes even more important when using larger sample directories. In this case, even a .1 second delay resolves the issue (see score below).

If you don’t want to initialize the samples outside of an instr, you can always use a seperate instr to load them.

It is also necessary to init iFileCount at 0, not 1, or else the first file played will be 60 + 1.

//////////

; Select audio/midi flags here according to platform

-odac -d ;;RT audio out

;-iadc ;;;uncomment -iadc if RT audio input is needed too

; For Non-realtime ouput leave only the line below:

; -o diskin.wav -W ;;; for file output any platform

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

;load all samples in a given directory into function tables and play them using instrument 1000

giFirstTableNumber = 60;

giNumberOfFiles ftsamplebank “/sdcard/download/wav”, giFirstTableNumber, 0, 4, 0

instr 1
iFileCount init 0

print giNumberOfFiles

until iFileCount>=giNumberOfFiles do

event_i “i”, 1000, iFileCount * 4, 5, giFirstTableNumber+iFileCount

print iFileCount

iFileCount += 1

od

endin

instr 1000

iTable = p4

print iTable

aOut,aOut loscil3 1, 1, iTable, 1, 0;

outs aOut, aOut

endin

i1 .1 15

//////////

I also changed the event start times just to make it more obvious all 3 samples are played.

Best,
Scott