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
% Generate array with pink noise
pink_noise = pinknoise(n);
% Create modulation functions for time domain (velocity modulation)
time_modulation_sin = sin(2 * pi * ripples_per_sec * t + phi);
time_modulation_cos = cos(2 * pi * ripples_per_sec * t + phi);
% Create modulation functions for frequency domain (density modulation)
freq_modulation_sin = sin(2 * pi * ripples_per_octave * octaves);
freq_modulation_cos = cos(2 * pi * ripples_per_octave * octaves);
% Mirror the frequency modulation components for IFFT compatibility
mirrored_freq_mod_sin = [freq_modulation_sin, fliplr(freq_modulation_sin)];
mirrored_freq_mod_cos = [freq_modulation_cos, fliplr(freq_modulation_cos)];
% Apply time modulation to pink noise in the time domain
modulated_noise_sin_time = time_modulation_sin .* pink_noise;
modulated_noise_cos_time = time_modulation_cos .* pink_noise;
% Perform fft to get the signals in the frequency domain
modulated_noise_sin_freq = fft(modulated_noise_sin_time);
modulated_noise_cos_freq = fft(modulated_noise_cos_time);
% Apply frequency modulation in the frequency domain
rippled_noise_sin_freq = mirrored_freq_mod_sin .* modulated_noise_sin_freq;
rippled_noise_cos_freq = mirrored_freq_mod_cos .* modulated_noise_cos_freq;
% Perform ifft to get rippled noise in the time domain
sin_rippled_noise = ifft(sin_rippled_noise_freq , 'symmetric');
cos_rippled_noise = ifft(cos_rippled_noise_freq , 'symmetric');
% Determine the ripple type (ascending vs. descending)
switch ripple_type
case 'ascending'
combined_rippled_noise = sin_rippled_noise + cos_rippled_noise;
case 'descending'
combined_rippled_noise = sin_rippled_noise - cos_rippled_noise;
end
% Calculate the final rippled stimulus
rippled_stimulus = pink_noise + modulation_depth * combined_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