Stream audio from sd card to a table


#1

So trying to find a way to do glitchless sample loading into a table i had the idea of simply using the wave/play object to overwrite the table in the background, since this streaming function doesn't interrupt the audio stream as the table/load does.

It's working really nicely so far, obviously you might get some other glitchy sounds while the table is being overwritten but most times it's fast enough to be inaudible, and even if you hear something weird for 1-2 notes it's still much better than the half second complete dropout table/load causes.

Here's a screenshot of my test setup, i guess it would be neat to include the wave/play and table/record part into a single oject but this works for me for now.

maybe someone has ideas on how to improve this? eg. Is there an easy way to stream from SD at a faster speed? Right now the whole table is being overwritten in realtime which is not ideal of course.

I still want to include the filesize somehow to maybe flush the unused end of the table with zeros, and also currently fixing the table/pitch play loop object so the loop actually works and it has an inlet for sample length as opposed to table length.

edit:
oh i just had an idea. i could create a buffer table, same size, stream into that, and on completion just swap the tables/table content. this would then have zero glitches, but at the same time it would take the whole sample length in time to load a new sound, instead of being instant with possible small glitches like the current solution.

edit:
can i do an amount n of simultaneous wave/play streams into several table/record of the same table, with the same pos offset of length/n for each wave/play and table/record? obvisouly the wave/play end outlets would have to be adjusted.


#2

I am doing some stuff similar to what you are doing, using @rbrt's rbrt/data/tcopy object, but it doesn't record the audio form table to table, it just copies it. I think it's better.

Example:
- Make a main table, where you have all the samples you want in a long file. Copy FROM this table.
- Make a buffer table, for playback. Copy TO this table
- When you want to load a new sample to the buffer table, you just copy it over from the main table to the buffer table, using the rbrt/data/tcopy object.

This is 100% click free and drop out free, no issues what so ever. But yeah, you would need to have that main table loaded all the time, into the SD-RAM.


#3

well one big table won't be enough for me i definately have to read from SD card, each of the 40-50 samples is about 1mb. that tcopy objects sounds interesting though, i would probably need that if i end up using a buffer table, ie. the glitchless but delayed option. right now i'm rolling with immediate & glitches instead.
the streaming into a table solution is way better than regular table load for me even at this very basic stadium.

lol i even thought about getting an smd rework of the axo board since the SMT32F supports up to 64mb ram but yeah that would open another giant firmware rabbbithole...


#4

I've modded the sample player to write to a table directly instead of the output buffer.
it's in sss/wave
also added a sample-index to load multiple sample unto the same table.
So the size-attribute sets the max sample-length and the samples-attribute sets the max amount of samples.
So total table size is samplelength*samples.
To select a sample, just give the readposition an offset by multiplying the index with sample length, eg:
readpos=(readpos+1)&LENGTHMASK;
sample=(inlet_sample&(attr_table.SAMPLES-1))*attr_table.LENGTH; (attr_table.SAMPLES is the amount of samples set in the table)
outlet_out=array[readpos+sample];

running a breakcore pattern now, just randomising a random sample every beat.. no problems or glitches and tight clocking


#5

Doing the Lord's work!

the tablestream/streamplay look great, especially for slicing loops?

Didn't have a chance to try in real life yet but your playertest objects looks just like a neat perfected version of my mess. Is that one new too? I only remember you having 2 wave objects before i synced today and now its 4 so not sure... Does it still stream to the table in realtime?


#6

those earlier ones were tests for something else that I couldn't get to work. Changing that player is a bit of a hassle as you cannot embed the module, but first have to copy it to a new folder and edit it directly all the time.
I did find some bugs in the new player btw, so I added new version.