[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/diy/ - Do It Yourself

Search:


View post   

>> No.1219432 [View]
File: 34 KB, 1327x1030, file.png [View same] [iqdb] [saucenao] [google]
1219432

I'm trying to make an audio spectrum analyzer from a microcontroller and an individually addressable LED strip. I'm doing some tests and simulations in matlab to figure out the best-looking algorithm. One thing I noticed is that the Fourier transform of music doesn't look at all like I'd expect from the spectrum analyzer in my music player.

This graph is the FFT of 480 samples of The XX's Intro at 5 seconds.
https://youtu.be/H4UtBYUMVJk?t=3
At that time, the song is one note played repeatedly and a bass note playing constantly. Yet the most prominent frequency is 17360Hz, which is barely even audible. Can anyone explain what's going on?

Code below.

data2 = []
for n=1:length(data)
data2(n) = .5*(data(n,1) + data(n,2));
% data2(n) = (data(n,1));
end

start_point = 5;
data2 = data2((fs*start_point):(fs*(start_point)+480));
player_fft = fft(data2);
P2 = abs(data2/length(data2));
P1 = P2(1:length(data2)/2+1);
P1(2:end-1) = 2*P1(2:end-1);
data_fft = fs*(0:(length(data2)/2))/length(data2);
plot(data_fft,P1)

Navigation
View posts[+24][+48][+96]