声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 3476|回复: 5

[综合讨论] 在matlab下语音信号加噪声

[复制链接]
发表于 2010-11-6 22:16 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
本帖最后由 killkyolyx 于 2010-11-6 22:19 编辑

本人最近在做一个语音信号处理的课程小课题,题目是:在语音信号中分别添加white噪声、pink噪声、f16噪声和babble噪声,实现不同信噪比下的带噪语音,分析讨论各种噪声对语音基频的影响.
因为本人没学过matlab,所以只能硬着头皮在网上找程序一点点试,现在有一个加噪声的程序但是运行出来只会在command  window显示ans=233233(233233是文件名。。)求各位高手帮帮忙
以下是程序:function [Y,NOISE] = add_noisem(X,filepath_name,SNR,fs)
% add_noisem add determinated noise to a signal.
% X is signal, and its sample frequency is fs;
% filepath_name is NOISE's path and name, and the SNR is signal to noise ratio in dB.
[wavin,fs1,nbits]=wavread(filepath_name);
if fs1~=fs
    wavin1=resample(wavin,fs,fs1);
end
nx=size(X,1);
NOISE=wavin1(1:nx);
NOISE=NOISE-mean(NOISE);
signal_power = 1/nx*sum(X.*X);
noise_variance = signal_power / ( 10^(SNR/10) );
NOISE=sqrt(noise_variance)/std(NOISE)*NOISE;
Y=X+NOISE;

%其中X是纯信号,filepath_name是指定噪声文件(.wav)的路径和文件名,SNR是要求的信噪比,fs是信号X的采样频率,Y是带噪信号,NOISE是叠加在信号上的噪声。


clear all; clc; close all;
[filename,pathname]=uigetfile('C:\Users\lx\Desktop\语音信号\语音信号处理-实验1\003\a.wav','请选择语音文件:');
[filename1,pathname1]=uigetfile('C:\Users\lx\Desktop\语音信号\noise\pink1.wav','请选择噪声文件:');
filepath_name=[pathname1 filename1];
[X,fs]=wavread([pathname filename]);
[Y,NOISE] = add_noisem(X,filepath_name,10,fs);

subplot 311; plot(X);
subplot 312; plot(NOISE);
subplot 313; plot(Y);
mn=mean(NOISE)
snr=SNR_singlech(X,Y)

语音文件是个一秒的“a”音,噪声文件是一秒的pink噪声
运行出来只会在command  window显示ans=233233(233233是文件名。。)
a.rar (2.9 KB, 下载次数: 7) pink1.rar (29.2 KB, 下载次数: 7)
回复
分享到:

使用道具 举报

 楼主| 发表于 2010-11-7 15:03 | 显示全部楼层
修改了文件名后,提示错误
??? Input argument "filepath_name" is undefined.
Error in ==> X3 at 5
[wavin,fs1,nbits]=wavread(filepath_name);

谁能帮我看看吗、、、
 楼主| 发表于 2010-11-7 17:25 | 显示全部楼层
我的问题已经解决了,还是因为没看懂源程序

版主锁了此贴吧

评分

1

查看全部评分

发表于 2010-11-7 18:06 | 显示全部楼层
回帖测试
发表于 2012-5-1 17:50 | 显示全部楼层
look 下
发表于 2013-11-7 18:08 | 显示全部楼层
楼主,你的附件里噪声pink1.rar就是传说中的粉红噪声吗?
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-6-23 11:14 , Processed in 0.071597 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表