Ripple Sounds
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
- modulation_depth = half the amplitude of the modulation
% 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
rippled_noise = sin_modulated + cos_modulated;
case descending
rippled_noise = sin_modulated - cos_modulated;
end
% calculate the modulated stimulus
ripple_stimulus = noise + modulation_depth * rippled_noise;
N.B. when the density is zero 'rippled_noise' by itself has an envelope of a rectified sine wave (which has double the velocity). Only after adding the original noise the envelope is the correct one.
Band filter method
%todo