您当前的位置: 首页 >  matlab

川川菜鸟

暂无认证

  • 3浏览

    0关注

    969博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

matlab绘制鸟类语谱图教程

川川菜鸟 发布时间:2021-08-31 03:17:12 ,浏览量:3

文章目录
    • 一.配置语音箱
    • 二.绘制语谱图

一.配置语音箱

跳转这一篇文章有教程 配置语音箱

二.绘制语谱图

测试代码:

clear all; clc; close all;
[x,Fs]=audioread(['./mat_file/yunque/XC2' ...
    '86466 - 云雀 - Alauda arvensis.mp3']);   %读入数据文件
wlen=800; inc=80; win=hanning(wlen);% 设置帧长,帧移和窗函数
N=length(x); time=(0:N-1)/Fs;       % 计算时间
y=enframe(x,win,inc)';              % 分帧
fn=size(y,2);                       % 帧数
frameTime=(((1:fn)-1)*inc+wlen/2)/Fs; % 计算每帧对应的时间
W2=wlen/2+1; n2=1:W2;
freq=(n2-1)*Fs/wlen;                % 计算FFT后的频率刻度
Y=fft(y);                           % 短时傅里叶变换
clf                                 % 初始化图形
%=====================================================%
% Plot the STFT result              % 画出语谱图        
%=====================================================%
set(gcf,'Position',[20 100 600 500]);            
axes('Position',[0.1 0.1 0.85 0.5]);  
imagesc(frameTime,freq,abs(Y(n2,:))); % 画出Y的图像  
axis xy; ylabel('频率/Hz');xlabel('时间/s');
title('语谱图');
%=====================================================%
% Plot the Speech Waveform          % 画出语音信号的波形  
%=====================================================%
axes('Position',[0.07 0.72 0.9 0.22]);
plot(time,x,'k');
xlim([0 max(time)]);
xlabel('时间/s'); ylabel('幅值');
title('语音信号波形');

返回: 在这里插入图片描述

关注
打赏
1665165634
查看更多评论
立即登录/注册

微信扫码登录

0.0496s