Csound Csound-dev Csound-tekno Search About

[Csnd] ftsamplebank

Date2024-06-03 16:46
FromMarcelo Carneiro de Lima
Subject[Csnd] ftsamplebank
Attachmentsmictorio_1_trecho2.wav  mictorio_1_trecho1.wav  porcos_mamando_01_gaintrecho.wav  
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



######

<CsoundSynthesizer>

<CsOptions>

; Select audio/midi flags here according to platform

-odac     ;;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

</CsOptions>

<CsInstruments>

sr = 48000

nchnls=2

0dbfs = 1

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

instr 1

   iFirstTableNumber = 60;

  iNumberOfFiles ftsamplebank "/Users/marcelocarneiro/Dropbox/MacMini_Back/Csound/porcos_teste_player", iFirstTableNumber, 0, 4, 0

      iFileCount init 1


print iNumberOfFiles


until iFileCount>=iNumberOfFiles do

event_i "i", 1000, iFileCount, 5, iFirstTableNumber+iFileCount


iFileCount = iFileCount+1

   enduntil


endin


instr 1000

   iTable = p4

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


   outs aOut, aOut

endin 


</CsInstruments>

<CsScore>

i1 0 15

</CsScore>

</CsoundSynthesizer>



--

Marcelo Carneiro
Prof. of Composition
Instituto Villa-Lobos- Rio de Janeiro State Federal University, UNIRIO
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2024-06-03 17:38
FromRory Walsh
SubjectRe: [Csnd] ftsamplebank
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 

On Mon, 3 Jun 2024 at 16:47, Marcelo Carneiro de Lima <marcelo.arcos2@gmail.com> wrote:
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



######

<CsoundSynthesizer>

<CsOptions>

; Select audio/midi flags here according to platform

-odac     ;;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

</CsOptions>

<CsInstruments>

sr = 48000

nchnls=2

0dbfs = 1

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

instr 1

   iFirstTableNumber = 60;

  iNumberOfFiles ftsamplebank "/Users/marcelocarneiro/Dropbox/MacMini_Back/Csound/porcos_teste_player", iFirstTableNumber, 0, 4, 0

      iFileCount init 1


print iNumberOfFiles


until iFileCount>=iNumberOfFiles do

event_i "i", 1000, iFileCount, 5, iFirstTableNumber+iFileCount


iFileCount = iFileCount+1

   enduntil


endin


instr 1000

   iTable = p4

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


   outs aOut, aOut

endin 


</CsInstruments>

<CsScore>

i1 0 15

</CsScore>

</CsoundSynthesizer>



--

Marcelo Carneiro
Prof. of Composition
Instituto Villa-Lobos- Rio de Janeiro State Federal University, UNIRIO
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2024-06-03 21:46
FromRichard Knight
SubjectRe: [Csnd] ftsamplebank

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

 


On 2024-06-03 16:46, Marcelo Carneiro de Lima wrote:

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

 

 

######

<CsoundSynthesizer>

<CsOptions>

; Select audio/midi flags here according to platform

-odac     ;;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

</CsOptions>

<CsInstruments>

 

sr = 48000

nchnls=2

0dbfs = 1

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

 

instr 1

 

   iFirstTableNumber = 60;

  iNumberOfFiles ftsamplebank "/Users/marcelocarneiro/Dropbox/MacMini_Back/Csound/porcos_teste_player", iFirstTableNumber, 0, 4, 0

      iFileCount init 1

 

print iNumberOfFiles

 

until iFileCount>=iNumberOfFiles do

event_i "i", 1000, iFileCount, 5, iFirstTableNumber+iFileCount

 

iFileCount = iFileCount+1

 

   enduntil

 

endin

 

instr 1000

   iTable = p4

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

 

   outs aOut, aOut

 

endin 

 

</CsInstruments>

<CsScore>

 

i1 0 15

 

</CsScore>

</CsoundSynthesizer>

 

 

 

--

Marcelo Carneiro
Prof. of Composition
Instituto Villa-Lobos- Rio de Janeiro State Federal University, UNIRIO
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2024-06-03 23:17
FromST Music
SubjectRe: [Csnd] ftsamplebank
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.

//////////

<CsoundSynthesizer>
<CsOptions>

; 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

</CsOptions>
<CsInstruments>

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 

</CsInstruments>
<CsScore>
i1 .1 15
</CsScore>
</CsoundSynthesizer>

//////////

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

Best,
Scott

On Mon, Jun 3, 2024, 11:47 a.m. Marcelo Carneiro de Lima <marcelo.arcos2@gmail.com> wrote:
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



######

<CsoundSynthesizer>

<CsOptions>

; Select audio/midi flags here according to platform

-odac     ;;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

</CsOptions>

<CsInstruments>

sr = 48000

nchnls=2

0dbfs = 1

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

instr 1

   iFirstTableNumber = 60;

  iNumberOfFiles ftsamplebank "/Users/marcelocarneiro/Dropbox/MacMini_Back/Csound/porcos_teste_player", iFirstTableNumber, 0, 4, 0

      iFileCount init 1


print iNumberOfFiles


until iFileCount>=iNumberOfFiles do

event_i "i", 1000, iFileCount, 5, iFirstTableNumber+iFileCount


iFileCount = iFileCount+1

   enduntil


endin


instr 1000

   iTable = p4

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


   outs aOut, aOut

endin 


</CsInstruments>

<CsScore>

i1 0 15

</CsScore>

</CsoundSynthesizer>



--

Marcelo Carneiro
Prof. of Composition
Instituto Villa-Lobos- Rio de Janeiro State Federal University, UNIRIO
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here