r2c — Real to complex format conversion.


Converts a real-valued input array in real-imaginary interleaved complex format, setting its imaginary parts to 0. The output array will be double the size of the input. This is a utility operation to facilitate complex-value operations on real arrays.


kout[] r2c kin[]


kout[] -- output array containing the complex-valued real-imaginary output. It will be created if it does not exist.

kin[] -- input array containing the real-valued input.


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

Example 893. Example of the r2c opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

-d -o dac
ksmps = 64

instr 1
ifftsize = 1024
kcnt init 0
kIn[] init  ifftsize
kOut[] init ifftsize

a1 oscili 0dbfs/2, 440

if kcnt >= ifftsize then
 kCmplx[] r2c kIn
 kSpec[] fft kCmplx
 kCmplx fftinv kSpec
 kOut c2r kCmplx
 kcnt = 0 

kIn[] shiftin a1
a2 shiftout kOut
kcnt += ksmps
   out a2
i1 0 10

See Also

Vectorial opcodes

array opcodes

Array-based spectral opcodes


Author: Victor Lazzarini
NUI Maynooth

New in version 6.04