Ripple Sounds

From biophysics
Jump to navigation Jump to search

Introduction

%todo

FFT-iFFT method

Below is an example of an implementation in matlab. It is based on a broadband signal consisting of pink noise. The input parameters are

  • t = time domain array
  • octaves = frequency domain array
  • ripples_per_sec = the ripple velocity
  • phi = a phase that can be added to the time modulation
  • ripples_per_octave = the ripple density
  • ripple_type = determines if the ripple is ascending or descending
    % create array with pink noise
    noise = pinknoise(n);
   
    % Create modulation for time domain
    sin_modulation_t = sin(2 * pi * ripples_per_sec * t + phi);
    cos_modulation_t = cos(2 * pi * ripples_per_sec * t + phi);        

    % Create modulation for frequency domain    
    sin_modulation_f = sin(2 * pi * ripples_per_octave * octaves);
    cos_modulation_f = cos(2 * pi * ripples_per_octave * octaves);
    
    % Mirror the modulation frequency components for ifft compatibility
    sin_modulation_f = [sin_modulation_f, fliplr(sin_modulation_f)];
    cos_modulation_f = [cos_modulation_f, fliplr(cos_modulation_f)];

    % Apply time modulation to noise, perform fft 
    fft_sin_mod_t = fft(sin_modulation_t .* noise);
    fft_cos_mod_t = fft(cos_modulation_t .* noise);
  
    % Apply frequency modulation and perform ifft
    sin_modulated =  ifft(sin_modulation_f .* fft_sin_mod_t, 'symmetric');
    cos_modulated =  ifft(cos_modulation_f .* fft_cos_mod_t, 'symmetric');   

    % Determine the ripple type (ascending vs. Descending)
    switch ripple_type
        case ascending
            rippleStimulus = sin_modulated + cos_modulated;
        case descending
            rippleStimulus = sin_modulated - cos_modulated;
    end 

    % calculate the modulated stimulus          
    rippleStimulus = noise + modulationDepth * rippleStimulus;

Band filter method

%todo

References