The Open Master Hearing Aid (openMHA)
openMHA
Open community platform for hearing aid algorithm research
|
Namespace for audio signal handling and processing classes. More...
Classes | |
class | hilbert_fftw_t |
class | spectrum_t |
a signal processing class for spectral data (based on mha_spec_t) More... | |
class | waveform_t |
signal processing class for waveform data (based on mha_wave_t) More... | |
class | doublebuffer_t |
Double-buffering class. More... | |
class | ringbuffer_t |
A ringbuffer class for time domain audio signal, which makes no assumptions with respect to fragment size. More... | |
class | hilbert_t |
Hilbert transformation of a waveform segment. More... | |
class | minphase_t |
Minimal phase function. More... | |
class | stat_t |
class | delay_wave_t |
Delayline containing wave fragments. More... | |
class | delay_spec_t |
class | async_rmslevel_t |
Class for asynchronous level metering. More... | |
class | uint_vector_t |
Vector of unsigned values, used for size and index description of n-dimensional matrixes. More... | |
class | matrix_t |
n-dimensional matrix with real or complex floating point values. More... | |
class | schroeder_t |
Schroeder tone complex class. More... | |
class | quantizer_t |
Simple simulation of fixpoint quantization. More... | |
class | loop_wavefragment_t |
Copy a fixed waveform fragment to a series of waveform fragments of other size. More... | |
class | delay_t |
Class to realize a simple delay of waveform streams. More... | |
class | subsample_delay_t |
implements subsample delay in spectral domain. More... | |
class | fft_t |
Functions | |
void | for_each (mha_wave_t *s, mha_real_t(*fun)(mha_real_t)) |
Apply a function to each element of a mha_wave_t. More... | |
mha_real_t | lin2db (mha_real_t x, mha_real_t eps) |
Conversion from linear scale to dB (no SPL reference) More... | |
mha_real_t | lin2db (mha_real_t x) |
Conversion from linear scale to dB (no SPL reference) More... | |
mha_real_t | db2lin (mha_real_t x) |
Conversion from dB scale to linear (no SPL reference) More... | |
mha_real_t | sq2db (mha_real_t x, mha_real_t eps=0.0f) |
conversion from squared values to dB (no SPL reference) More... | |
mha_real_t | db2sq (mha_real_t x) |
conversion from dB to squared values (no SPL reference) More... | |
mha_real_t | pa2dbspl (mha_real_t x, mha_real_t eps) |
Conversion from linear Pascal scale to dB SPL. More... | |
mha_real_t | pa2dbspl (mha_real_t x) |
Conversion from linear Pascal scale to dB SPL. More... | |
mha_real_t | dbspl2pa (mha_real_t x) |
Conversion from dB SPL to linear Pascal scale. More... | |
mha_real_t | pa22dbspl (mha_real_t x, mha_real_t eps=0.0f) |
Conversion from squared Pascal scale to dB SPL. More... | |
mha_real_t | dbspl2pa2 (mha_real_t x) |
conversion from dB SPL to squared Pascal scale More... | |
mha_real_t | smp2sec (mha_real_t n, mha_real_t srate) |
conversion from samples to seconds More... | |
mha_real_t | sec2smp (mha_real_t sec, mha_real_t srate) |
conversion from seconds to samples More... | |
mha_real_t | bin2freq (mha_real_t bin, unsigned fftlen, mha_real_t srate) |
conversion from fft bin index to frequency More... | |
mha_real_t | freq2bin (mha_real_t freq, unsigned fftlen, mha_real_t srate) |
conversion from frequency to fft bin index More... | |
mha_real_t | smp2rad (mha_real_t samples, unsigned bin, unsigned fftlen) |
conversion from delay in samples to phase shift More... | |
mha_real_t | rad2smp (mha_real_t phase_shift, unsigned bin, unsigned fftlen) |
conversion from phase shift to delay in samples More... | |
template<class elem_type > | |
std::vector< elem_type > | dupvec (std::vector< elem_type > vec, unsigned n) |
Duplicate last vector element to match desired size. More... | |
template<class elem_type > | |
std::vector< elem_type > | dupvec_chk (std::vector< elem_type > vec, unsigned n) |
Duplicate last vector element to match desired size, check for dimension. More... | |
void | copy_channel (mha_spec_t &self, const mha_spec_t &src, unsigned sch, unsigned dch) |
Copy one channel of a source signal. More... | |
void | copy_channel (mha_wave_t &self, const mha_wave_t &src, unsigned src_channel, unsigned dest_channel) |
Copy one channel of a source signal. More... | |
mha_real_t | rmslevel (const mha_spec_t &s, unsigned int channel, unsigned int fftlen) |
Return RMS level of a spectrum channel. More... | |
mha_real_t | colored_intensity (const mha_spec_t &s, unsigned int channel, unsigned int fftlen, mha_real_t *sqfreq_response=nullptr) |
Colored spectrum intensity. More... | |
mha_real_t | maxabs (const mha_spec_t &s, unsigned int channel) |
Find maximal absolute value. More... | |
mha_real_t | rmslevel (const mha_wave_t &s, unsigned int channel) |
Return RMS level of a waveform channel. More... | |
mha_real_t | maxabs (const mha_wave_t &s, unsigned int channel) |
Find maximal absolute value. More... | |
mha_real_t | maxabs (const mha_wave_t &s) |
Find maximal absolute value. More... | |
mha_real_t | max (const mha_wave_t &s) |
Find maximal value. More... | |
mha_real_t | min (const mha_wave_t &s) |
Find minimal value. More... | |
mha_real_t | sumsqr_channel (const mha_wave_t &s, unsigned int channel) |
Calculate sum of squared values in one channel. More... | |
mha_real_t | sumsqr_frame (const mha_wave_t &s, unsigned int frame) |
Calculate sum over all channels of squared values. More... | |
void | scale (mha_spec_t *dest, const mha_wave_t *src) |
void | limit (mha_wave_t &s, const mha_real_t &min, const mha_real_t &max) |
Limit the singal in the waveform buffer to the range [min, max]. More... | |
template<class elem_type > | |
elem_type | kth_smallest (elem_type array[], unsigned n, unsigned k) |
Fast search for the kth smallest element of an array. More... | |
template<class elem_type > | |
elem_type | median (elem_type array[], unsigned n) |
Fast median search. More... | |
template<class elem_type > | |
elem_type | mean (const std::vector< elem_type > &data, elem_type start_val) |
Calculate average of elements in a vector. More... | |
template<class elem_type > | |
std::vector< elem_type > | quantile (std::vector< elem_type > data, const std::vector< elem_type > &p) |
Calculate quantile of elements in a vector. More... | |
void | saveas_mat4 (const mha_spec_t &data, const std::string &varname, FILE *fh) |
Save a openMHA spectrum as a variable in a Matlab4 file. More... | |
void | saveas_mat4 (const mha_wave_t &data, const std::string &varname, FILE *fh) |
Save a openMHA waveform as a variable in a Matlab4 file. More... | |
void | saveas_mat4 (const std::vector< mha_real_t > &data, const std::string &varname, FILE *fh) |
Save a float vector as a variable in a Matlab4 file. More... | |
void | copy_permuted (mha_wave_t *dest, const mha_wave_t *src) |
Copy contents of a waveform to a permuted waveform. More... | |
Variables | |
unsigned long int | signal_counter = 0 |
Signal counter to produce signal ID strings. More... | |
Namespace for audio signal handling and processing classes.
|
inline |
Apply a function to each element of a mha_wave_t.
s | Pointer to a mha_wave_t structure |
fun | Function to be applied (one argument) |
|
inline |
Conversion from linear scale to dB (no SPL reference)
x | Linear input |
eps | minimum linear value (if x < eps --> convert eps instead), eps < 0 not allowed |
MHA_Error | if eps < 0 |
|
inline |
Conversion from linear scale to dB (no SPL reference)
x | Linear input. |
|
inline |
Conversion from dB scale to linear (no SPL reference)
x | dB input. |
|
inline |
conversion from squared values to dB (no SPL reference)
x | squared value input |
eps | minimum squared value (if x < eps --> convert eps instead), eps < 0 not allowed |
MHA_Error | if eps < 0 |
|
inline |
conversion from dB to squared values (no SPL reference)
x | dB input |
|
inline |
Conversion from linear Pascal scale to dB SPL.
x | Linear input |
eps | minimum pascal value (if x < eps --> convert eps instead), |
MHA_Error | if eps < 0 |
|
inline |
Conversion from linear Pascal scale to dB SPL.
x | Linear input |
|
inline |
Conversion from dB SPL to linear Pascal scale.
x | Linear input. |
|
inline |
Conversion from squared Pascal scale to dB SPL.
x | squared pascal input |
eps | minimum squared-pascal value (if x < eps --> convert eps instead), eps < 0 not allowed |
MHA_Error | if eps < 0 |
|
inline |
conversion from dB SPL to squared Pascal scale
x | dB SPL input |
|
inline |
conversion from samples to seconds
n | number of samples |
srate | sampling rate / Hz |
|
inline |
conversion from seconds to samples
sec | time in seconds |
srate | sampling rate / Hz |
void MHASignal::scale | ( | mha_spec_t * | dest, |
const mha_wave_t * | src | ||
) |
void MHASignal::limit | ( | mha_wave_t & | s, |
const mha_real_t & | min, | ||
const mha_real_t & | max | ||
) |
Limit the singal in the waveform buffer to the range [min, max].
s | The signal to limit. The signal in this wave buffer is modified. |
min | lower limit |
max | upper limit |
elem_type MHASignal::kth_smallest | ( | elem_type | array[], |
unsigned | n, | ||
unsigned | k | ||
) |
Fast search for the kth smallest element of an array.
The order of elements is altered, but not completely sorted. Using the algorithm from N. Wirth, published in "Algorithms + data structures = programs", Prentice-Hall, 1976
array | Element array |
n | number of elements in array |
k | The k'th smalles element is returned: k = 0 returns the minimum, k = (n-1)/2 returns the median, k=(n-1) returns the maximum |
|
inline |
Fast median search.
The order of elements is altered, but not completely sorted.
array | Element array |
n | number of elements in array |
|
inline |
Calculate average of elements in a vector.
data | Input vector |
start_val | Value for initialization of the return value before sum. |
|
inline |
Calculate quantile of elements in a vector.
data | Input vector |
p | Vector of probability values. |
void MHASignal::saveas_mat4 | ( | const mha_spec_t & | data, |
const std::string & | varname, | ||
FILE * | fh | ||
) |
Save a openMHA spectrum as a variable in a Matlab4 file.
data | openMHA spectrum to be saved. |
varname | Matlab variable name (Matlab4 limitations on maximal length are not checked). |
fh | File handle to Matlab4 file. |
void MHASignal::saveas_mat4 | ( | const mha_wave_t & | data, |
const std::string & | varname, | ||
FILE * | fh | ||
) |
Save a openMHA waveform as a variable in a Matlab4 file.
data | openMHA waveform to be saved. |
varname | Matlab variable name (Matlab4 limitations on maximal length are not checked). |
fh | File handle to Matlab4 file. |
void MHASignal::saveas_mat4 | ( | const std::vector< mha_real_t > & | data, |
const std::string & | varname, | ||
FILE * | fh | ||
) |
Save a float vector as a variable in a Matlab4 file.
data | Float vector to be saved. |
varname | Matlab variable name (Matlab4 limitations on maximal length are not checked). |
fh | File handle to Matlab4 file. |
void MHASignal::copy_permuted | ( | mha_wave_t * | dest, |
const mha_wave_t * | src | ||
) |
Copy contents of a waveform to a permuted waveform.
dest | Destination waveform |
src | Source waveform |
The total size of src and dest must be the same, num_frames and num_channels must be exchanged in dest.
|
extern |
Signal counter to produce signal ID strings.