gpt4 book ai didi

matlab - 如何从 wav 文件制作频谱图

转载 作者:太空宇宙 更新时间:2023-11-03 20:00:21 34 4
gpt4 key购买 nike

好吧,我想制作一首歌的频谱图。前 10 秒是我感兴趣的点。我应该这样做吗?如果我错了,请纠正我。

命令:

song = wavread('C:\Path of My FIle\song.wav')

length(song)/44100

song_seg = lovers(44100*1 : 44100*10)

plot(song_seg) % this command makes my spectogram Hz/Time

最佳答案

首先,恋人从何而来,44100这个数字有什么意义?创建频谱图的最简单方法是使用 Matlab 的频谱图功能。以下代码将为指定的波形文件生成频谱图——您可以试验窗口大小和窗口重叠参数以找到最适合您需要的图。

[song, fs] = wavread('C:\Path of My File\song.wav');
song = song(1:fs*10);
spectrogram(song, windowSize, windowOverlap, freqRange, fs, 'yaxis');

%Larger Window Size value increases frequency resolution
%Smaller Window Size value increases time resolution
%Specify a Frequency Range to be calculated for using the Goertzel function
%Specify which axis to put frequency

%%EXAMPLE
spectrogram(song, 256, [], [], fs, 'yaxis');
%Window Size = 256, Window Overlap = Default, Frequency Range = Default
%Feel free to experiment with these values

关于matlab - 如何从 wav 文件制作频谱图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18299568/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com