当前位置:网站首页>MATLAB realizes voice signal resampling and normalization, and plays the comparison effect
MATLAB realizes voice signal resampling and normalization, and plays the comparison effect
2022-07-02 01:29:00 【Hu Gang 2016】
On the basis of the previous sections , Carry out the experiment in this section .
Recommended reading :
matlab Use audiorecorder、recordblocking Recording sound ,play The play ,audiowrite Save sound
matlab Use audioread 、 sound Read and play wav file
matlab Use resample Complete resampling
Be careful :
Used this time wav The length of the file is 5 second , So a few lines of my code are written pause(6); The purpose is to make the sound still have 1 Seconds of spare time , Let's play the next sound .
I'm using matlab2018a, So in this version wavread The function has been abandoned , I can only use audioread function .
If you don't wav Voice files , You can refer to the first blog recommended to read and make one by yourself , Very convenient .
% Speech signal sampling frequency conversion experiment
clc
clear all
%[x,fs1]=wavread('C2_2_y.wav');% wavread The function has been abandoned
[x,fs1]=audioread('C2_2_y.wav');%matlab2018a, have access to audioread This function
s1=1:length(x);
t1=s1/fs1;
xmax=max(abs(x));% Get all sample The absolute value of the maximum value of
x=x/xmax;% take wav Every one of the files sample Value divided by the largest sample value , Make all of x All in [-1,1] Within the interval , Complete normalization
figure(1)
subplot(311)
plot(t1,x);
xlabel(' Time /s');
ylabel(' Normalized amplitude ');
title('(a) The original signal ');
sound(x,fs1);
pause(6);% Because the voice time played is 5 second , So the interval here 6 second , So that it can be played next time , Otherwise, the three sounds will overlap
%2 Double resampling
p=2;q=1;
x1=resample(x,p,q);% Resampling signal , Make the number of elements of the signal double
x1max=max(abs(x1));
x1=x1/x1max;% normalization
fa=fs1*p/q;% The frequency of the signal after resampling , That is to say The frequency of the original signal * Multiple of resampling
ta=(1:length(x1))/fa;% Time coordinates of each signal after resampling
subplot(312);
plot(ta,x1);
sound(x1,fa);
pause(6);% Because the voice time played is 5 second , So the interval here 6 second , So that it can be played next time , Otherwise, the three sounds will overlap
xlabel(' Time /s');
ylabel(' Normalized amplitude ');
title('(b)2 Times the sampling rate ');
%0.5 Double resampling
p=1;q=2;
x2=resample(x,p,q);
x2max=max(abs(x2));
x2=x2/x2max;
fb=fs1*p/q;
tb=(1:length(x2))/fb;
subplot(313);
plot(tb,x2);
xlabel(' Time /s');
ylabel(' Normalized amplitude ');
title('(c)1/2 Sampling rate ');
sound(x2,fb);
边栏推荐
- 只是以消费互联网的方式和方法来落地和实践产业互联网,并不能够带来长久的发展
- 遊戲思考15:全區全服和分區分服的思考
- Fastadmin controls the length of fields in the table
- Penser au jeu 15: penser au service complet et au sous - service
- Shell Function
- Global and Chinese markets of edge AI software 2022-2028: Research Report on technology, participants, trends, market size and share
- Look at the industrial Internet from a new perspective and seek the correct ways and methods of industrial Internet
- Liteos learning - first knowledge of development environment
- 学习笔记25--多传感器前融合技术
- Réseau neuronal convolutif (y compris le Code et l'illustration correspondante)
猜你喜欢
人工智能在网络安全中的作用
[IVX junior engineer training course 10 papers to get certificates] 03 events and guessing numbers games
matlab 实现语音信号重采样和归一化,并播放比对效果
What are the affordable Bluetooth headsets? Student party parity Bluetooth headset recommendation
Sql--- related transactions
[rust web rokcet Series 2] connect the database and add, delete, modify and check curd
Docker installing Oracle_ 11g
KS006基于SSM实现学生成绩管理系统
matlab 使用 audiorecorder、recordblocking录制声音,play 播放声音,audiowrite 保存声音
Based on Simulink and FlightGear, the dynamic control of multi rotor UAV in equilibrium is modeled and simulated
随机推荐
微信小程序中使用tabBar
首场“移动云杯”空宣会,期待与开发者一起共创算网新世界!
MPLS experiment operation
Leetcode, 3 repeatless longest subsequence
error: . repo/manifests/: contains uncommitted changes
Convolutional neural network (including code and corresponding diagram)
Altium designer measure distance (ctrl+m)
Based on Simulink and FlightGear, the dynamic control of multi rotor UAV in equilibrium is modeled and simulated
关于ASP.NET CORE使用DateTime日期类型参数的一个小细节
Global and Chinese market of avionics systems 2022-2028: Research Report on technology, participants, trends, market size and share
Réseau neuronal convolutif (y compris le Code et l'illustration correspondante)
A problem about function template specialization
6-2漏洞利用-ftp不可避免的问题
学习笔记2--高精度地图定义及价值
三分钟学会基础k线图知识
MySQL winter vacation self-study 2022 12 (4)
Design and implementation of radio energy transmission system
Just using the way and method of consuming the Internet to land and practice the industrial Internet will not bring long-term development
笔者更加愿意将产业互联网看成是一个比消费互联网要丰富得多的概念
[Chongqing Guangdong education] Tianshui Normal University universe exploration reference