framebuffer

framebuffer — Read audio signals into 1 dimensional k-rate arrays and vice-versa with a specified buffer size.

Description

framebuffer converts audio signals into a 1 dimensional k-rate array of a specified size. The size of the k-rate array must be larger than ksmps. It also converts 1 dimensional k-rate arrays back into audio signals, the k-rate arrays must be uninitialised and also be larger than ksmps in size. The buffer works as a circular buffer and may be used for doing frame based audio processing such as spectral analysis/synthesis or as a simple delay line.

Syntax

kout[] framebuffer ain, isize
aout framebuffer kin, isize

Initialization

isize -- The amount of samples that the buffer will contain.

Performance

kout[] -- The k-rate array output from the framebuffer. ain -- The audio signal input to the framebuffer.

aout -- The audio signal output from the framebuffer. kin -- The k-rate array input to the framebuffer.

Examples

Here is a simple example of the framebuffer opcode. It uses the file framebuffer.csd.

Example 326. Example of the framebuffer opcode.

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

<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>
nchnls = 2
0dbfs = 1
ksmps = 128
sr = 44100

instr 1
    isize init 1024
    ioverlaps init 4

    asig diskin2 "fox.wav", 1, 0, 1
    kframe[] framebuffer asig, isize
    kwindowedFrame[] window kframe, isize

    aout olabuffer kwindowedFrame, ioverlaps
    aout = aout / 2

    outs aout, aout
endin

</CsInstruments>
<CsScore>
i 1 0 400
</CsScore>
</CsoundSynthesizer>


See Also

olabuffer shiftin shiftout

Credits

Author: Edward Costello;
NUIM, 2015

New in version 6.06