dct

dct — Discrete Cosine Transform of a sample array (type-II DCT)

Description

Applies a forward Discrete Cosine Transform to an input 1-dimensional array producing an array of the same size containing the transform. Currently only power-of-two sizes are implemented. Available in i-time or perf (k-rate) versions.

Syntax

kout[] dct kin[]
iout[] dct iin[]

Initialization

iout[] -- output array containing the DCT. It will be created if it does not exist.

iin[] -- input array containing the input

Performance

kout[] -- output array containing the DCT. It will be created if it does not exist.

kin[] -- input array containing the input

Examples

Here is an example of the dct opcode. Play dct.csd

Example 212. Example of the dct opcode.

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

<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>

instr 1

iArr[] fillarray 1,2,3,4
iDCT[] dct iArr
iiDCT[] dctinv iDCT

prints "%.1f %.1f %.1f %.1f => %.1f %.1f %.1f %.1f\n",
        iArr[0], iArr[1], iArr[2], iArr[3], 
        iiDCT[0], iiDCT[1], iiDCT[2], iiDCT[3]
                
endin
</CsInstruments>
<CsScore>
i1 0 0
</CsScore>
</CsoundSynthesizer>

See Also

Vectorial opcodes, array opcodes, dctinv

Credits

Author: Victor Lazzarini
NUI Maynooth
2014

New in version 6.04