Cabbage Logo
Back to Cabbage Site

Question re: windowing ftables, vmultv opcode

Hello once again. I tried posting this on listserv but it doesn’t seem to propagate.

I’m working on a wavetable instr, but due to it’s design the ftable waveforms need to be windowed before playing at a-rate. I tried using vmultv but am experiencing unexpected results. It seems to be creating small pulse waveforms, quite different than one gets when the waveforms are multiplied as audio signals. See:


On the left is the result achieved using vmultv, on the right is the windowed audio.

This is the example code:

<CsoundSynthesizer>
<CsOptions>
-odac
; -o vmultv.wav
</CsOptions>
<CsInstruments>

sr = 48000
ksmps = 32
nchnls = 1
0dbfs  = 1

giWave  ftgen 0, 0, 2048, 10, 1
giWave2 ftgen 0, 0, 2048, 10, 1
giSinc  ftgen 0, 0, 2048, 20, 2

instr 1
  ifn1 = giWave
  ifn2 = giSinc
  ielements = 2049
  idstoffset = 0
  isrcoffset = 0
  vmultv ifn1, ifn2, ielements, idstoffset, isrcoffset, 1
  aSig  = poscil(1, 10, giWave)
          out aSig
endin

instr 2
  aSig  = poscil(1, 10, giWave2)
  aSig2 = poscil(1, 10, giSinc)
          out aSig * aSig2
endin
	
</CsInstruments>

<CsScore>
i1   0  .1
i2	.1  .1
e
</CsScore>
</CsoundSynthesizer>

Any suggestions would be appreciated, including other ideas as to how one might window an ftable waveform without first converting to audio.

Thanks,
Scott

Hi @ST_Music, I’ve never used those opcodes, but it looks like vmultv is k-rate, so you’re going to end up multiplying the tables on every k-pass. It doesn’t really explain what we see in the image but there is an i-rate version that might do the trick. Aside from that you can always window the tables quickly with an i-rate loop?

1 Like

Hi Rory. I forgot to add an update. You are right,
I found the vmultvi opcode worked perfectly.

Best,
Scott

1 Like