Hello,
Using vcopy and pvsftw I managed it. Thanks to studying the UDO by
Matt Ingalls implementing spectral stretch. I have used his UDO as a
starting point and change the core of it to enable warping. I have
also changed the instrument to take stereo signal.
Using csound~ maxmsp external I am now able to change the warping
table in real-time.
I have attached the UDO + a csd file demonstrating it's use. Please
feel free to let me know if it works and what you think about it.
Best
Peiman
<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>
sr=44100
ksmps=10
nchnls=2
opcode warp,0,iiiiii
inumbins, iampin, iampout, ifreqin, ifreqout, iwarp xin
; make sure we start with an empty table
iclear ftgen 0, 0, inumbins, 2, 0
tablecopy iampout, iclear
tablecopy ifreqout, iclear
kindex = 0
loop:
kind2 table kindex, iwarp
vcopy iampout, iampin, 1, kindex,kindex
vcopy ifreqout, ifreqin, 1, kindex, kindex
vcopy iampout, iampin, 1, kindex,kind2
vcopy iampout, iampin, 1, kind2,kindex
vcopy ifreqout, ifreqin, 1, kindex, kind2
vcopy ifreqout, ifreqin, 1, kind2, kindex
kindex = kindex + 1
if (kindex < inumbins) kgoto loop
endop
instr 1
;midi control
kdry invalue "dry"
kdry port kdry, 0.01
kwet invalue "wet"
kwet port kwet, 0.01
;;;;;;;;;;;;;;;;
ain1, ain2 ins ;;;input, can be changed with a soundfile
; get input and do pvanal
ifftsize = p4
iol = p5
iNumBins = ifftsize/2 + 1
fsigl pvsanal ain1, ifftsize, ifftsize/iol, ifftsize*4, 1
fsig2 pvsanal ain2, ifftsize, ifftsize/iol, ifftsize*4, 1
; [ or alternatively use pvsfread with a pvoc-ex file here ]
fsig3 pvsanal ain1, ifftsize, ifftsize/iol, ifftsize*4, 1
fsig4 pvsanal ain2, ifftsize, ifftsize/iol, ifftsize*4, 1
iwarp ftgen 0,0,iNumBins,-7,0,iNumBins, iNumBins ;warping table UNTOUCHED
;this should be modified for warping effects
iampin ftgen 0,0,iNumBins,2,0
iampout ftgen 0,0,iNumBins,2,0
ifreqin ftgen 0,0,iNumBins,2,0
ifreqout ftgen 0,0,iNumBins,2,0
iampin2 ftgen 0,0,iNumBins,2,0
iampout2 ftgen 0,0,iNumBins,2,0
ifreqin2 ftgen 0,0,iNumBins,2,0
ifreqout2 ftgen 0,0,iNumBins,2,0
; export fsig to tables
kflag pvsftw fsigl, iampin, ifreqin
if (kflag > 0) then ; only proc when frame is ready
;warp
warp iNumBins, iampin, iampout, ifreqin, ifreqout, iwarp
; read modified data back to fsrc
pvsftr fsigl, iampout, ifreqout
endif
; export fsig to tables
kflag2 pvsftw fsig2, iampin2, ifreqin2
if (kflag2 > 0) then ; only proc when frame is ready
; warp
warp iNumBins, iampin2, iampout2, ifreqin2, ifreqout2, iwarp
; read modified data back to fsrc
pvsftr fsig2, iampout2, ifreqout2
endif
; resynthesize and output - compare with untouched right channel
aout1 pvsynth fsigl
aout2 pvsynth fsig2
aout3 pvsynth fsig3
aout4 pvsynth fsig4
outs (aout1*kwet)+(aout3*kdry), (aout2*kwet)+(aout4*kdry)
endin
</CsInstruments>
<CsScore>
f0 86400
i2 0 -1 2048 8
e
</CsScore>
</CsoundSynthesizer>
2009/3/4 David Mooney/Maxine Heller <
moko@...>:
> Similarly, I've attempted to use vpvoc and tableseg for spectral warping
> operations, but this does not seem to work (using the example in the Csound
> Book as a test using a file created with pvanal. The file works fine with
> pvoc). Before spending more time on this, am I recalling correctly that
> there is some problem with vpvoc in 5.x? Is there something else Peiman and
> I should be using?
>
> Thanks--
>
> --David
>
> At 09:15 AM 3/2/2009, you wrote:
>>
>> Hello all,
>>
>> What is the best way to rearrange amplitude data in an FFT frame using
>> pvs signal?
>>
>> I basically want to swap the amplitude data of one bin with another
>> before synthesizing the FFT frame. So for instance to say that I want
>> the amplitude of bin one to be swapped with the amplitude of bin 10
>> and so on, but for every bin. I have tried pvsftw and vcopy but the
>> result is very wobbly and not what I expected at all.
>>
>> The aim is to imitate the GRM tools spectral Warp. Is this possible?
>>
>> Many thanks in advance
>>
>> Best
>> Peiman
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email
sympa@... with body "unsubscribe
>> csound"
>>
>> --
>> This message has been scanned for viruses and
>> dangerous content by MailScanner, and is
>> believed to be clean.
>
> David Mooney:
dmooney@...
> Maxine Heller:
mheller@...
> Opaque Melodies: www.city-net.com/~moko/
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email
sympa@... with body "unsubscribe
> csound"
>
Send bugs reports to this list.
To unsubscribe, send email
sympa@... with body "unsubscribe csound"