当前位置:网站首页>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);

边栏推荐
- Recommend an online interface mock tool usemock
- We should make clear the branch prediction
- GL Studio 5 installation and experience
- How does schedulerx help users solve the problem of distributed task scheduling?
- matlab 使用 audiorecorder、recordblocking录制声音,play 播放声音,audiowrite 保存声音
- 6-2 vulnerability exploitation - inevitable problems of FTP
- [IVX junior engineer training course 10 papers to get certificates] 03 events and guessing numbers games
- 现货黄金分析的技巧有什么呢?
- Develop a simple login logic based on SSM
- [IVX junior engineer training course 10 papers to get certificates] 0708 news page production
猜你喜欢

The concept and application of Cartland number

Data visualization in medical and healthcare applications

Develop a simple login logic based on SSM
![[WesternCTF2018]shrine writeup](/img/26/1700095c9b38b9b74a1b1136e5d5de.jpg)
[WesternCTF2018]shrine writeup

Edge computing accelerates live video scenes: clearer, smoother, and more real-time

Convolutional neural network (including code and corresponding diagram)

Android: how can golden nine and silver ten squeeze into the first-line big factories from small and medium-sized enterprises? The depth of interview questions in large factories

k线图形态这样记(口诀篇)
![[rust web rokcet Series 2] connect the database and add, delete, modify and check curd](/img/23/cfa13ad30e45ef7cdda690775964a7.jpg)
[rust web rokcet Series 2] connect the database and add, delete, modify and check curd

SAP ui5 beginner tutorial 20 - explanation of expression binding usage of SAP ui5
随机推荐
[IVX junior engineer training course 10 papers to get certificates] 03 events and guessing numbers games
Another programmer "deleted the library and ran away", deleted the code of the retail platform, and was sentenced to 10 months
Datawhale 社区黑板报(第1期)
Data visualization in medical and healthcare applications
Two TVs
成功实现边缘编码需要了解的六大经验教训
Android: the kotlin language uses grendao3, a cross platform app development framework
Based on Simulink and FlightGear, the dynamic control of multi rotor UAV in equilibrium is modeled and simulated
8.8.4-PointersOnC-20220215
Basic usage of shell script
Unity AssetBundle subcontracting
Using tabbar in wechat applet
The concept and application of Cartland number
A problem about function template specialization
The first "mobile cloud Cup" empty publicity meeting, looking forward to working with developers to create a new world of computing!
技术大佬准备就绪,话题C位由你决定
KS006基于SSM实现学生成绩管理系统
GL Studio 5 installation and experience
How can I batch produce the same title for the video?
站在新的角度来看待产业互联网,并且去寻求产业互联网的正确方式和方法