| File
name
|
FiDataFile.[ch]
|
| Description
|
Sound
data file format reading/writing module. When using the generic programming level, the DoProcess(GenerateSignal,...) routine call will use the ReadSignal_DataFile_Named(...) routine. This enables the "DataFile" module to be compatible with the other signal generation module's: the ReadPars routine call will read the appropriate parameters, e.g. the file name, etc. from a parameter file. The supported file extensions are:
".aiff" or "aif" - AIFF (audio interchange file format), ".wav", Microsoft WAV format, ".dat" multi-column ASCII files (without a time column) and ".raw" - raw binary file.
If the main portion of the file name is given as a minus sign, e.g. "-.aif", the "DataFile" module will read or write to stdin or stdout . This allows data to be passed using UNIX pipes (e.g. "lutear_program1 | other_program").
The AIFF standard has now provision to save the magnitude of a signal, however,
AIFF files created using this module include a custom AIFF "chunk" or header
which records the signal magnitude,. This means that when read in by this
module, such a file will have the correct magnitude set.
|
| Example
parameter file format
|
sine.aif Stimulus file name. 2 Default word size for sound data (1 or 2). 0 Default (for format), big- or little-endian: 0, 1 or 2. 1 Number of Channels (only used for raw binary files.) 10e3.0 Default sample rate - used for raw binary and ASCII files. -1 Maximum samples read (-1 = unlimited). 30.0 Signal gain (dB). |
| Test
program directory
|
Tests/Combinations,
Tests/Filing
|
| Syntax
|
BOOLN ReadSignal_DataFile_Named(EarObjectPtr
data);
|
| Returns
|
TRUE
if the function is successful, otherwise it returns FALSE.
|
| Syntax
|
BOOLN ReadSignal_DataFile(char *fileName,
EarObjectPtr data);
|
| Returns
|
TRUE
if the function is successful, otherwise it returns FALSE.
|
| Syntax
|
BOOLN SetDefaultSampleRate_DataFile(double
theDefaultSampleRate);
|
| Special
Values
|
(This
is only used for the formats for which the sample rate is not defined, i.e. the
raw binary and ASCII file formats.)
|
| Returns
|
TRUE
if the function is successful, otherwise it returns FALSE.
|
| Syntax
|
BOOLN SetEndian_DataFile(int endian);
|
| Special
Values
|
Endian
mode options: default (for format), big- or little-endian: 0, 1 or 2.
|
| Returns
|
TRUE
if the function is successful, otherwise it returns FALSE.
|
| Syntax
|
BOOLN SetFileName_DataFile(char *fileName);
|
| Special
Values
|
A
minus file name, e.g. "-.aif" indicates that processing will be read/written to
stdin/stdout.
|
| Returns
|
TRUE
if the function is successful, otherwise it returns FALSE.
|
| Syntax
|
BOOLN SetGain_DataFile(char *fileName);
|
| Returns
|
TRUE
if the function is successful, otherwise it returns FALSE.
|
| Syntax
|
BOOLN SetMaxSamples_DataFile(double
theMaxSamples);
|
| Special
Values
|
A
negative value specifies unlimited input samples.
|
| Returns
|
TRUE
if the function is successful, otherwise it returns FALSE.
|
| Syntax
|
BOOLN SetPars_DataFile(char *theFileName, int
theWordSize, int theEndian, int theNumChannels, double
theDefaultSampleRate, double theMaxSamples, double
theGain);
|
| Returns
|
TRUE
if the function is successful, otherwise it returns FALSE.
|
| Syntax
|
BOOLN SetWordSize_DataFile(int wordSize);
|
| Returns
|
TRUE
if the function is successful, otherwise it returns FALSE.
|
# # Main Parameter file # output.dat Name of output file. # Module specifications #Par. file Name Description #--------- ----- ------------- ParFiles/St/DataFile1.par DataFile Stimulus generation paradigm. ParFiles/PE/PreEmph1.par null Outer-/middler-ear filter model. ParFiles/BM/GammaT5k.par null Basilar membrane filter model. ParFiles/IHC/CarneyRP1.par null IHC receptor potential model. ParFiles/IHC/Meddis86.par null Inner hair cell (IHC) model. ParFiles/AN/BinomSG1.par null Auditory nerve spike generation. ParFiles/NC/Dendrite3.par null Dendritic filtering. ParFiles/NC/MG92Stellate.par null Neural cell model. # Miscellaneous parameters 2.5e-3 Ramp up rise time for signal (s).
Figure [134] An AIFF stimulus read by the DataFile module.