Cabbage Logo
Back to Cabbage Site

.wav tables?

So i am finally getting around to working on the engine because ive been procrastinating (oops) And i wanted to implement morphing wavetables like Spire or T0NIT0RMX’s ToneZ. Ive found that the tabmorphak opcode is what i am going after, but i want to implement noise as a selectable waveform , while still being able to morph it with other waveforms. with the rand opcode, i can do that. Is there a way to load a .wav file into a table that way i could 1, use it with tabmorphak, and 2, just use a white noise sample.

You can load a .wav into a GEN01 table. There is an example here. And another here. Post back if you have any questions. I have never used the tabmorphak opcode, but loading soundfiles to a table is simple.

Aah yes, the first one seemed to work. Since they are all the same table size, the looping of the noise sample is repeated over and over, and there is clicking. Do you know of anything that might help this?

Sidenote: for anyone in the future that wants to do this, it has to be in the same directory as the csd, putting it in a subfolder crashes cabbage

I assume you are using GEN01 and a 0 sized table so that Csound automatically assigns the correct table size? I’m not really sure why you might be getting clicking. Does it play back without clicks when you run it in a loop in an audio editor?

no, not a 0 sized table. tabmorphak requires that all tables are the same size so i have it at 8193. the .wav file is longer than whats being played back, as the table has a set size, but it sounds like this

Hmm, might be best to generate the noise yourself and dump it to a table like this:

giNoise ftgen 100, 0, 8193, 7, -1, 8193, 1

instr 1
    prints "Creating noise table..."
    setksmps 1

    iCnt init 0
    while iCnt < 8192 do
        tabw_i birnd(1), iCnt, giNoise
        iCnt += 1
    od
endin

instr 2
    prints "\nPlaying noise"
    a1 oscili .1, 1, giNoise
    outs a1, a1
endin

Full .csd here (662 Bytes)