pvscross
Prev | Orchestra Opcodes and Operators | Next

## pvscross

pvscross — Performs cross-synthesis between two source fsigs.

## Description

Performs cross-synthesis between two source fsigs.

## Syntax

    fsig pvscross fsrc, fdest, kamp1, kamp2

## Performance

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.

## Examples

Here is an example of the use of the pvscross opcode. It uses the file pvscross.csd.

Example 791. 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>
    -odac
    </CsOptions>
    <CsInstruments>

    sr = 44100
    ksmps = 16
    nchnls = 1
    0dbfs = 1

    ;; example written 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 = "fox.wav"
      Sfile2 = "wave.wav"
      ain1 = soundin:a(Sfile1)
      ain2 = soundin:a(Sfile2)
      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, 1) ; linear transition
      if ipermut == 1 then
        fcross = pvscross(fftin2, fftin1, ktrans, 1 - ktrans)
      else
        fcross = pvscross(fftin1, fftin2, ktrans, 1 - ktrans)
      endif
      aout = pvsynth(fcross)
      out(aout)
    endin

    </CsInstruments>
    <CsScore>
    i 1 0 2.757 0 ; frequencies from fox.wav, amplitudes moving from wave to fox
    i 1 3 2.757 1 ; frequencies from wav.wav, amplitudes moving from fox to wave
    e
    </CsScore>
    </CsoundSynthesizer>

## See Also

pvsanal, pvsynth, pvsadsyn

## Credits

Author: Richard Dobson
August 2001

November 2003. Thanks to Kanata Motohashi, fixed the link to the pvcross opcode.

New in version 4.13

Prev | Up | Next
pvscfs | Home | pvsdemix