hdf5write

hdf5write — Write signals and arrays to an hdf5 file.

Description

hdf5write writes N signals and arrays to a specified hdf5 file.

Syntax

hdf5write ifilename, xout1[, xout2, xout3, ..., xoutN]

Initialization

ifilename -- the hdf5 file's name (in double-quotes). If the file does not exist it will be created.

Performance

xout1,... xoutN -- signals or arrays to be written to the hdf5 file. This opcode accepts i-rate, k-rate, a-rate signals or i-rate, k-rate, a-rate arrays of any dimension. These signals or arrays are written to a dataset within the hdf5 file using the same variable name as in Csound. For example, if the Csound variable is called 'ksignal', then the name of the hdf5 dataset is 'ksignal'. Any number and multiple types of datasets may be written at a time.

Examples

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

Example 367. Example of the hdf5write 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 = 8
sr = 44100

instr hdf5write

    aArray[] init 2,2 ; Initialise a 2 X 2 a-rate array

    aArray[0][0] vco2 0.2, 100 ; Fill array with vco2 signals
    aArray[0][1] vco2 0.4, 200
    aArray[1][0] vco2 0.8, 300
    aArray[1][1] vco2 1, 400

    aVar vco2 0.2, 100 ; Initialise an a-rate variable with a vco2 signal

    kVar phasor 1 ; Initalise a k-rate variable with a phasor signal

    hdf5write "example.h5", aArray, aVar, kVar ; Write variables to an hdf5 file

endin

</CsInstruments>
<CsScore>

i "hdf5write" 0 1

</CsScore>
</CsoundSynthesizer>


See Also

hdf5read

Credits

Author: Edward Costello;
NUIM, 2014