Cabbage Logo
Back to Cabbage Site

Does selecting a range in soundfiler produce a output?

Sweet, what was the issue?

I’ll test when it’s built :+1:

A mismatch of sampling rates between the session and the file, coupled with a hard coded 44100 hidden in my code :roll_eyes:

1 Like

I think there’s still something wrong. Now it’s showing too few samples. Btw, did you add a form of intellisense to Cabbage? I seem to be getting suggestions for opcodes when I write them now? It’s nice :+1:

Looks right to me? If you’re using the same sound file the sample rate is 24,000, it’s a stereo file so that x 2 gives the numbers of samples because the sound is 2 seconds. And you’ve selected the almost all of the sound which should be around half the total samples. Cabbage will always return the position within a single channel.

The file length in seconds are 1.608 seconds.

24000 * 1.608 = 38592 samples

So the file is 38592 samples per channel right? This is the correct calculation no?

Yes, I mistakingly thought the total number of samples, left and right, was circa 40,000. Ok. So we try again :slight_smile:

It seems to be an issue with mp3 files. When I try wav/aif it works as expected…

You’re right, I also see different read-outs from mp3 to wav. But I also still see that the regionLength is still longer than the file’s samples

New build triggered. I have to head out now, can you test and let me know. Thanks :+1:

1 Like

I think you got it this time, not seeing any issues at first sight :+1:

Could I suggest triggering an initialization of the regionLength when changing files? Currently, it will store the previous files regionLength after loading a new file. Just clearing the region would be great IMO :+1:

Done. New build just triggered.

Awesome, the only thing I notice is that the regionLength-number is not initialized, meaning when triggering the print, the regionLength from before dropping the new file still persists.

Anyway, I handled this by initializing the region in Csound when changing files.

gSfile cabbageGet "LAST_FILE_DROPPED"

if (changed(gSfile) == 1) then
    cabbageSet 1, "Soundfiler1", "file", gSfile
    cabbageSet 1, "Soundfiler1", "regionLength", 0
    cabbageSet 1, "Soundfiler1", "regionStart", 0
endif

Thanks for posting the solution. I’ll try to add this when I get a chance, but I’m really busy at the moment enjoying some well needed sunshine :rofl:

1 Like