Cabbage Logo
Back to Cabbage Site

Why does table3 alias here?

Hello

I’m making a kind of weird looper app but seem to be getting an issue with table3 reading the soundfile with phasor. At low phasor rates I get the type of aliasing I’d associate with a none interpolated opcode. It just sounds funky.

I’ve tried out different files an all the same. I appreciated there are hundreds of looper examples but I’ve not done much table based stuff in Csound until now, but I other environments I have, so I’m applying what I know to Cs! Am I missing something?

PhasorWerk 2.csd (8.1 KB)

(sorry this example is a CsoundQT file, but I plan to port it over to Cabbage)

cheers

Why are you using a k-rate variable for your index? Although you convert it to a later, I think this will result in issues. The following code seems to run fine for me:

instr 1
	gklooplen = abs(gkloopEnd - gkloopStart)	
	krate = 1/(gklooplen)
	aptr phasor krate
	aidx = (aptr*gklooplen) * giTabLen
	ares table3 aidx, 1, 0, 0, 1
	kamp port gkamp, 0.1
	outs ares*kamp, ares*kamp
endin

For some reason I had issues with ftgen in my Cabbage file. There were resolved when I used a old school function table in the score. I’ll look into the issue. Not quite sure what the problem is.

TBH I followed the example in McCurdy’s table_tablei_table3 in CsoundQT. Incidentally, one thing in that example which isn’t clear to me, is that kptr is defined using phasor at ln 74 and then redefined at line 80 using oscili.

I tried the instr code that you supplied and it still exhibits the same ringing artefacts when at a low rate unfortunately. :confused:

Can you try this one, along with the attached sample, Just dump them into the same directory and it should work. To me this sounds just as I would expect, but I get different results based on the samples I use.

table3.csd (542 Bytes)
http://forum.cabbageaudio.com:/uploads/default/original/1X/b6c3a9f7559a7b259ec63efc369ef4fd2e106bd9.wav

hmm l’m not sure. I think something is still a bit awry, as it did two tests using your guitar sample, and changing the rate: one in Csound and one in Plogue Bidule, using the 4-point spline4 (which I believe is equivalent to cubic?) and there is definitely an aliasing going on in Csound.

guitars.zip (3.0 MB)

sorry to bang on about this! I realise this is a Cabbage forum

You’re right. That’s interesting. For what it’s worth, I hear no issues when I use one of the file reading opcodes:

instr 1
	ares1, ares2 diskin "Guitar1.wav", chnget:k("freq"), 1, 0
	outs ares1, ares2
endin   

I’ll ask the Csound guys what gives.

Ahh! I was reading both channels into the ftgen. I set it to read from the first channel of a stereo wav. Trying to think what a 2chnl table does to a mono table reading opcode to cause the aliasing, does it sum the channels somehow?

Victor mentioned it has to do with the way it reads the interleaved audio. He also pointed me to p.355 of his last Csound book :joy: I will have to go through my copy now and do some reading!

Sorry I hope that wan’t too embarrassing :grimacing: ! Thanks for asking though

Which book is that incidentally? He seems to have a fair few to his name.

Not at all. I tried that myself, or at least I thought I did, it turned out I got the last 3 parameters of the GEN01 table mixed up. I think Victor might have been winding me up about the book because p.355 has nothing to do about the issue :joy: The book I believe he was referring to is Csound, A Sound and Music Computing System by Springer press. It’s a great book.

Yes the phasor on line 74 is redundant. I added the oscili so that I could include fwd/bwd looping but forgot to remove the phasor. Also it would indeed make more sense to create the pointer as aptr in the first place. Bear in mind I wrote this 12 years ago!