Csound Csound-dev Csound-tekno Search About

Re: [Csnd] Question(s) re ftables, guard points, wavetables etc.

Date2023-03-29 00:47
FromScott Daughtrey
SubjectRe: [Csnd] Question(s) re ftables, guard points, wavetables etc.
Oops... did something wrong there... trying again:
Question(s) re ftables, guard points, wavetables etc.

I'm experimenting with wavetables. I'm trying to make an instr that uses ftsamplebank to load 44 short single-cycle waves (or 32, power of 2, would be fine), 600 points each.

What I'd like to do is essentially like the ftmorf manual example, but instead using something like an rspline to traverse thru the tables as opposed to a line:
 
giTabls ftgen   1, 0, 4, -2, 3, 4, 5, 6        
giMorph ftgen   2, 0, 4096, 10, 0
giPart1 ftgen   3, 0, 4096, 10, 1
giPart2 ftgen   4, 0, 4096, 10, 0, 1
giPart3 ftgen   5, 0, 4096, 10, 1, 0, 1
giPart4 ftgen   6, 0, 4096, 10, 0, 0, 0, 1, 1  

    instr 1
kNdx  = rspline(.1, 3.9, .1, .5)
        ftmorf kNdx, 1, 2
kEnv  = linseg(0, 1, p5, p3-2, p5, 1, 0)
iFreq = cpspch(p4)
aSig  = oscili(kEnv, iFreq, 2)
outs aSig, aSig
    endin

I've had limited success with tabmorphak - if using more than 2 samples attempting to switch samples via ktabnum1 or 2 can be difficult to manage at k rate without the sample changes being abrupt & obvious.

ftmorf seems like a better option.  The issue here is the 600 points sample length. Here's an ex instr:   
 
giFirstTableNumber = 3;
giFileCount init 1
giNumFiles ftsamplebank "/sdcard/Samples/Wt1", giFirstTableNumber, 0, 0, 1

    instr preload
giTables   ftgen 1, 0, 4, -2, 3, 4, 5, 6
giMorph    ftgen 2, 0, -600, 10, 1    
    endin

    instr 2
kIdx  = rspline(3.1, 5.9, .1, .5)
;printk .5, kIdx
        
        ftmorf kIdx, 1, 2
kEnv  = adsr(2, 0, 1, 2)
aSig  = oscili(.7 * kEnv, p4, 2)
        outs(aSig, aSig)
    endin

The size of the giMorph table has to equal the samples (600) or an error occurs in ftmorf, but if the size of giMorph is 600 (or -600) then an error occurs for oscili (illegal table length).

Is there a way to play the morphed samples coming from ftmorf without an oscil, like asig with some table opcode and maybe a phasor? ex. 
asig tabmorphak

Or an oscil that can loop samples that are not power of 2 or 2+1? I did try loscil but with no success (error: sustain defers to non looping source).

I'm still not familiar with so many of the numerous options, table opcodes & GEN, any suggestions would be greatly appreciated.

I uploaded a zip with the csd & samples in case anyone wants to give it a go or look it over more closely.
https://www.dropbox.com/s/tjma22fbcjltl7s/Wt1.zip?dl=0

Thanks, 
Scott

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here