Cabbage Logo
Back to Cabbage Site

Audio File value to a Wavetable tool

Hi,

I’m new to Csound and Cabbage and I would Like to understand if it is possible to create one tool that coded in one .txt file the audio values readed on one single cycle of a waveform…
The tool that I image has these features: the possibility to analyze cycle from Mono/Stereo file, with different Sample Rate, Bit depth and so on… the output is one file .txt with one dimension that the user have sets: 4096? or 1024?
Than, the user uses GEN23(?) to read the values or simply copy/paste these values in the GEN01 fields…

At the time of analysis, the values ​​are quantized based on the size of the final table set by the user…

In this mode all the “wavetable synth” shared are only with the .csd file.

this is only the GUI that I imagined:

thanks, bye…

Yes, this shouldn’t be too tricky to do. You’re on the right track. Simple write the values to a table using tabw or any other of the table writing opcodes. Then you can save that table if you wish, alternatively you can simply write the values to a text file. I can prepare an example once I get back from my holidays if you can wait that long. Should be about a week or so!

I’m also very interested in this…

Here is a simple example that will write the current audio stream (in this case a soundfile) to a table, that is then used by the synth instrument that plays on a note press. Note that I also apply a fade to the table as otherwise the discontinuities will cause clipping. Also note that I don’t have speakers to really test this on right now!

fileToWavetable.csd (1.5 KB)

You will need to swap out the sound file for you own. Of course you will want to add lots of extra options such as the ability to load any sound file. But note that this brute force approach may lead to lots of aliasing.

Dumping the table to a txt file should be simply enough. As you say, GEN23 can then easily read back the values. Sorry I don’t have time to prepare a better example, but this should get you moving in the right direction at least :wink:

thanks for this starting point… I’m work it…