🎧🎧🎧 Listen to Fourier transform 🎵🎵🎵
Adam Danz on 28 Oct 2021
% 🎧🎧🎧 Listen to this one 🎵🎵🎵
% Get out your headphones and play this on your machine.
% It produces an animation of 14 Fourier transform matricies
% The columns of each matrix produce a tone.
% More info:
axis square off
% Cycle through matrix sizes defined in n
% Set up data
% Set tone duration. Longer tones result is longer overlap.
d=.1; % seconds
% Replicate r values to duration length.
% Default sampling rate is 8192 hz.
s=8192*d; % ~number of samples needed to fill expected duration d.
a(ceil(s):end,:)=; % trim excess samples
% h=gobjects(1,n); % Add this for cleaner code
h(1)=plot(nan); % dummy line for first iteration
% Cycle through columns of matrix n
soundsc(a(:,i)) % play sound
f(h(i-1)) % change properties to previously drawn line
h(i)=plot(r(:,i),m(:,i),LineW=4); % plot(x(:,i)) won't work because some cols may not contain complex vals.
f(h(i)) % change properties to last line
% pause(.1) % pause() is banned from the commpetition so we'll use a while-loop