hdf5read

hdf5read — Read signals and arrays from an hdf5 file.

Description

Plugin opcode in hdf5ops. This opcode is part of the plugin repository and has to be installed separately. The plugin repository can be found here: https://github.com/csound/plugins

hdf5read reads N signals and arrays from a specified hdf5 file.

Syntax

xout1[, xout2, xout3, ..., xoutN] hdf5read ifilename, ivariablename1[, ivariablename2, ivariablename3, ..., ivariablenameN]

Initialization

ifilename -- the hdf5 file's name (in double-quotes).

ivariablename1[, ivariablename2, ivariablename3, ..., ivariablenameN] -- the names of the datasets (in double-quotes) to be read from the hdf5 file, if the dataset name is suffixed with an asterisk, e.g. "mydataset*", the entire dataset is copied to the array regardless of array type.

Performance

xout1,... xoutN -- The specified types of variables that the hdf5 datasets are to be read as. Datasets with a rank larger than 1 must be read as arrays, i-rate signals must also be read as i-rate signals. Other than these restrictions datasets may be read as any type of array or signal. When reading has reached the end of a dataset it no longer outputs any new values.

Examples

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

Example 439. Example of the hdf5read 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 hdf5read

    aArray[], aVar, kVar hdf5read "example.h5", "aArray", "aVar", "kVar" ; Open hdf5 file and read variables

    aLeft = (aArray[0][0] + aArray[0][1] + aVar) / 3 ; Add audio signals together for stereo out
    aRight = (aArray[1][0] + aArray[1][1] + aVar) / 3

    outs aLeft * kVar, aRight * kVar ; Multiply audio signals by k-rate signal
endin

</CsInstruments>
<CsScore>

i "hdf5read" 0 1

</CsScore>
</CsoundSynthesizer>


See also

Signal Input

Credits

Author: Edward Costello;
NUIM, 2014