![]()  | 
  
    The Open Master Hearing Aid (openMHA)
    openMHA
    
   Open community platform for hearing aid algorithm research 
   | 
 
Runtime configuration class for plugin wave2spec. More...

Public Member Functions | |
| wave2spec_t (unsigned int nfft, unsigned int nwnd_, unsigned int nwndshift_, unsigned int nch, mha_real_t wndpos, const MHAWindow::base_t &window, MHA_AC::algo_comm_t &ac, std::string algo) | |
| Constructor computes window and zeropadding, allocates storage and FFT plan.  More... | |
| void | publish_ac_variables () | 
| Insert two AC variables into AC space:  More... | |
| mha_spec_t * | process (mha_wave_t *wave_in) | 
| Perform signal shift, windowing, zero-padding and FFT.  More... | |
| ~wave2spec_t () | |
| Destructor removes AC variables from AC space and deallocates memory.  More... | |
| unsigned | get_zeropadding (bool after) const | 
| Getter method to read zeropadding computed for the STFT configuration parameters.  More... | |
  Public Member Functions inherited from MHA_AC::spectrum_t | |
| spectrum_t (algo_comm_t &ac, const std::string &name, unsigned int bins, unsigned int channels, bool insert_now) | |
| Initialize memory and metadata of the AC variable.  More... | |
| ~spectrum_t () | |
| Destroy the AC variable: deallocate its memory.  More... | |
| void | insert () | 
| Insert or re-insert AC variable into AC space.  More... | |
| void | remove () | 
| Remove the AC variable by reference from the AC variable space.  More... | |
  Public Member Functions inherited from MHASignal::spectrum_t | |
| spectrum_t (const unsigned int &frames, const unsigned int &channels) | |
| constructor of spectrum class  More... | |
| spectrum_t (const mha_spec_t &) | |
| Copy constructor.  More... | |
| spectrum_t (const MHASignal::spectrum_t &) | |
| Copy constructor.  More... | |
| spectrum_t (const std::vector< mha_complex_t > &) | |
| mha_complex_t & | operator() (unsigned int f, unsigned int ch) | 
| Access to element.  More... | |
| mha_complex_t & | operator[] (unsigned int k) | 
| Access to a single element, direct index into data buffer.  More... | |
| mha_complex_t & | value (unsigned int f, unsigned int ch) | 
| Access to element.  More... | |
| void | copy (const mha_spec_t &) | 
| copy all elements from a spectrum  More... | |
| void | copy_channel (const mha_spec_t &s, unsigned sch, unsigned dch) | 
| Copy one channel of a given spectrum signal to a target channel.  More... | |
| void | export_to (mha_spec_t &) | 
| copy elements to spectrum structure  More... | |
| void | scale (const unsigned int &, const unsigned int &, const unsigned int &, const mha_real_t &) | 
| scale section [a,b) in channel "ch" by "val"  More... | |
| void | scale_channel (const unsigned int &, const mha_real_t &) | 
| scale all elements in one channel  More... | |
Private Member Functions | |
| void | calc_pre_wnd (MHASignal::waveform_t &dest, const MHASignal::waveform_t &src) | 
| Applies analysis window weights to current input signal and writes windowed signal to correct place in FFT buffer.  More... | |
Private Attributes | |
| unsigned int | nwnd | 
| window length  More... | |
| unsigned int | nwndshift | 
| window shift or hop size  More... | |
| mha_fft_t | ft | 
| FFT instance used for transformation.  More... | |
| unsigned int | npad1 | 
| length of zero padding before window  More... | |
| unsigned int | npad2 | 
| length of zero padding after window  More... | |
| MHAWindow::base_t | window | 
| Analysis window.  More... | |
| MHASignal::waveform_t | calc_in | 
| waveform buffer with FFT length samples per channel  More... | |
| MHASignal::waveform_t | in_buf | 
| waveform buffer with window length samples per channel  More... | |
| MHASignal::spectrum_t | spec_in | 
| spectrum buffer containing only the positive frequency bins  More... | |
| std::string | ac_wndshape_name | 
| name of window shape AC variable  More... | |
Additional Inherited Members | |
  Public Attributes inherited from mha_spec_t | |
| mha_complex_t * | buf | 
| signal buffer  More... | |
| unsigned int | num_channels | 
| number of channels  More... | |
| unsigned int | num_frames | 
| number of frames in each channel  More... | |
| mha_channel_info_t * | channel_info | 
| detailed channel description  More... | |
  Protected Attributes inherited from MHA_AC::spectrum_t | |
| algo_comm_t & | ac | 
| AC variable space.  More... | |
| const std::string | name | 
| Name of this AC variable in the AC variable space.  More... | |
| const bool | remove_during_destructor | 
| flag whether to remove from AC variable space in destructor.  More... | |
Runtime configuration class for plugin wave2spec.
Manages window shift, windowing, zero-padding, and FFT. Inserts current window shape and current STFT spectrum into AC space.
| wave2spec_t::wave2spec_t | ( | unsigned int | nfft, | 
| unsigned int | nwnd_, | ||
| unsigned int | nwndshift_, | ||
| unsigned int | nch, | ||
| mha_real_t | wndpos, | ||
| const MHAWindow::base_t & | window, | ||
| MHA_AC::algo_comm_t & | ac, | ||
| std::string | algo | ||
| ) | 
Constructor computes window and zeropadding, allocates storage and FFT plan.
| nfft | FFT length | 
| nwnd_ | window length in samples | 
| nwndshift_ | window shift (hop size) in samples | 
| nch | number of audio channels | 
| wndpos | for cases nfft > nwnd_, where to place the window inside the FFT buffer: 0 = at start, 1 = at end, 0.5 = centered. Position is rounded to full samples and determines zero-padding | 
| window | Analysis window shape | 
| ac | algorithm communication storage accessor | 
| algo | configured name of this plugin, used to name the AC variables published by wave2spec | 
| wave2spec_t::~wave2spec_t | ( | ) | 
Destructor removes AC variables from AC space and deallocates memory.
| void wave2spec_t::publish_ac_variables | ( | ) | 
Insert two AC variables into AC space:
| mha_spec_t * wave2spec_t::process | ( | mha_wave_t * | wave_in | ) | 
Perform signal shift, windowing, zero-padding and FFT.
| wave_in | latest block of audio signal (hop size samples per channel) | 
      
  | 
  inline | 
Getter method to read zeropadding computed for the STFT configuration parameters.
Result is only valid after prepare() has been called.
| after | When false, return length of zeropadding before the analysis window. When true, return length of zeropadding in samples after the analysis window. | 
      
  | 
  private | 
Applies analysis window weights to current input signal and writes windowed signal to correct place in FFT buffer.
Ensures zero-padding regions contain only zeros. To be invoked before applying FFT.
| [out] | dest | waveform buffer with FFT length audio samples, completely overwritten by this method | 
| [in] | src | waveform buffer with window length audio samples, these samples are written to dest after window shape has been applied to the individual samples. | 
      
  | 
  private | 
window length
      
  | 
  private | 
window shift or hop size
      
  | 
  private | 
FFT instance used for transformation.
      
  | 
  private | 
length of zero padding before window
      
  | 
  private | 
length of zero padding after window
      
  | 
  private | 
Analysis window.
      
  | 
  private | 
waveform buffer with FFT length samples per channel
      
  | 
  private | 
waveform buffer with window length samples per channel
      
  | 
  private | 
spectrum buffer containing only the positive frequency bins
      
  | 
  private | 
name of window shape AC variable