Cabbage Logo
Back to Cabbage Site

How do you pitch an audiofile from ftgen?

e.g how would I pitch this:

giSnare ftgen 0, 0, 0, 1, “/Users/Documents/Drums/Snare”, 0, 0, 1

You need to read the samples back at teh correct pitch. You can do this with a phaser:

giSnare ftgen 1, 0, 0, 1, "Snare.wav", 0, 4, 1

instr 1
    iLen = ftlen(giSnare)
    print iLen
    aPhs phasor sr/iLen
    aTab table aPhs*iLen, giSnare
    outs aTab, aTab 
endin

You can also use a loscil opcode:

instr 1
    aTab loscil 1, 1, giSnare, 1
    outs aTab, aTab 
endin

You might want to have a look over this thread which covers sample playback with tables in more detail. Note that reading directly from disk is also a valid option. I know people that have built well-functioning samplers using only diskin2 opcodes. It all depends on what you plan to do.

Oh man you made life so much easier with diskin2

Thank you so much