pvscross — Performs cross-synthesis between two source fsigs.
The operation of this opcode is identical to that of pvcross (q.v.), except in using fsigs rather than analysis files, and the absence of spectral envelope preservation. The amplitudes from fsrc and fdest (using scale factors kamp1 for fsrc and kamp2 for fdest) are applied to the frequencies of fsrc. kamp1 and kamp2 must not exceed the range 0 to 1.
With this opcode, cross-synthesis can be performed on real-time audio input, by using pvsanal to generate fsrc and fdest. These must have the same format.
Warning | |
---|---|
It is unsafe to use the same f-variable for both input and output of pvs opcodes. Using the same one might lead to undefined behavior on some opcodes. Use a different one on the left and right sides of the opcode. |
Here is an example of the use of the pvscross opcode. Play pvscross.csd
Example 823. Example of the pvscross opcode.
See the sections Real-time Audio and Command Line Flags for more information on using command line flags.
<CsoundSynthesizer> <CsOptions> ; Select audio/midi flags here according to platform -odac ;;;realtime audio out ;-iadc ;;;uncomment -iadc if realtime audio input is needed too ; For Non-realtime ouput leave only the line below: ;-o pvscross.wav -W ;;; for file output any platform </CsOptions> <CsInstruments> sr = 44100 ksmps = 32 nchnls = 2 0dbfs = 1 ; by Menno Knevel 2021, after an example by joachim heintz 2009 instr 1 ipermut = p4 ; 1 = change order of soundfiles ifftsize = 1024 ioverlap = ifftsize / 4 iwinsize = ifftsize iwinshape = 1 ; von-Hann window Sfile1 = "oboe.aiff" Sfile2 = "finneganswake1.flac" ain1 = diskin2:a(Sfile1, .5, 0, 1) ain2 = diskin2:a(Sfile2, 1, 0, 1) ; the wave plays 4 x faster and higher fftin1 = pvsanal(ain1, ifftsize, ioverlap, iwinsize, iwinshape) ; fft-analysis of file 1 fftin2 = pvsanal(ain2, ifftsize, ioverlap, iwinsize, iwinshape) ; fft-analysis of file 2 ktrans = linseg(0, p3*.2, 0, p3*.6, p5, p3*.2, p5) ; transitions if ipermut == 1 then fcross = pvscross(fftin2, fftin1, ktrans, 1 - ktrans) else fcross = pvscross(fftin1, fftin2, ktrans, 1 - ktrans) endif aout = pvsynth(fcross) outs(aout, aout) endin </CsInstruments> <CsScore> ; use only first portion of sample (=p5) i 1 0 12.7 0 0 ; frequencies from the oboe, no transition i 1 14 12.7 1 0 ; frequencies from the voice, no transition ; transition over total sample (=p5) i 1 28 12.7 0 1 ; frequencies from the oboe, amplitude transition from voice to oboe i 1 42 12.7 1 1 ; frequencies from the voice, amplitude transition from oboe to voice e </CsScore> </CsoundSynthesizer>