| RESPITE: The CASA Toolkit Page: Documentation: Block Library Index:BinaryInputFile |
Read data from a binary file. The file name is supplied as a parameter. A file path and file extension may also be supplied.
The binary file type is user configurable and can be used in an attempt to read alien files of a type that is not directly supported. The table below lists the parameters that can be configured. If the file has a header then the HEADER_SIZE parameter should be set to an appropriate value so that the header is not treated as part of the signal data.
If SAMPLES_PER_FRAME is set to 1 then the data is treated as a simple signal (e.g. a sound signal). If SAMPLES_PER_FRAME is greater than 1 then the data is treated as a series of frames (e.g. a feature vector).
NOUTPUTS can be set to any positive value. The file is then assumed to have this many interleaved channels and a corresponding number of output sockets will be constructed. e.g. if NOUTPUTS is set to 2 then the data is assumed to be an interleaved stereo signal and output sockets named out1 and out2 will be used.
The byte order of the data in the file must be specified using the BYTE_ORDER parameter. This must be set to either:
| Inputs | Meaning | Sample | 1-D frame | |
|---|---|---|---|---|
| No inputs | ||||
| Outputs | Meaning |
|---|---|
| out1 | signal channel 1 |
| ... | ... |
| out n | signal channel n |
| Parameters | Type | Default | Meaning |
|---|---|---|---|
| FILE_NAME | String | - | The file to open |
| FILE_PATH | String | "" | Directory path to prefix to filename |
| FILE_EXTENSION | String | "" | Extension to postfix to filename |
| HEADER_SIZE | Integer | 28 | Size of header in bytes |
| BYTE_ORDER | {BE, LE} | BE | BE=Big Endian, LE=Little Endian |
| NUMBER_OF_CHANNELS | Integer | 1 | Number of interleaved channels |
| BYTES_PER_SAMPLE | Integer | 2 | Valid values are 1, 2 or 4 |
| SAMPLES_PER_FRAME | Integer | 1 | Number of samples per frame |
| MULAW_ENCODING | Boolean | False | `Yes' = treat as mulaw encoded data1 |
| FLOATING_POINT | Boolean | False | Treat data of floating point rather than integer |
| SAMPLE_RATE | Float | - | The data sampling rate (samples/second) |
| DURATION | Integer | 0 (0=whole file) | Number of samples to read |
| NOUTPUTS | Integer | 1 | Number of channels |