input type problem to speech enhancement algorithm

4 views (last 30 days)
==================================UPDATE2.0==================================
now I'm trying to run another algorithm for comparison on Matlab R2019b, this is the full code.
I'm able to run it and I'm getting good results when looking at the plotting, but I can see only the plots, and cannot hear the clean outputed audio.
main algorithms function declaration:
function [esTSNR,esHRNR]=WienerNoiseReduction(ns,fs,IS)
Authors remarks on the main function:
% [esTSNR,esHRNR]=WIENERNOISEREDUCTION(ns,fs,IS)
%
% Title : Wiener Noise Suppressor with TSNR & HRNR algorithms
%
% Description : Wiener filter based on tracking a priori SNR using Decision-Directed
% method, proposed by Plapous et al 2006. The two-step noise reduction
% (TSNR) technique removes the annoying reverberation effect while
% maintaining the benefits of the decision-directed approach. However,
% classic short-time noise reduction techniques, including TSNR, introduce
% harmonic distortion in the enhanced speech. To overcome this problem, a
% method called harmonic regeneration noise reduction (HRNR)is implemented
% in order to refine the a priori SNR used to compute a spectral gain able
% to preserve the speech harmonics.
%
%
% Reference : Plapous, C.; Marro, C.; Scalart, P., "Improved Signal-to-Noise Ratio
% Estimation for Speech Enhancement", IEEE Transactions on Audio, Speech,
% and Language Processing, Vol. 14, Issue 6, pp. 2098 - 2108, Nov. 2006
%
% Input Parameters :
% ns Noisy speech
% fs Sampling frequency (in Hz)
% IS Initial Silence (or non-speech activity) Period (in number of samples)
%
% Output Parameters : enhanced speech
% esTSNR enhanced speech with the Two-Step Noise Reduction method
% esHNRN enhanced speech with the Harmonic Regeneration Noise Reduction method
%
%Author : LIU Ming, 2008
%Modified : SCALART Pascal october, 2008
%
I'm calling the main function like this:
[data, fs] = audioread('noisy.wav');
l = length(data);
samples = (l/fs);
[esTSNR,esHRNR] = WienerNoiseReduction(data,fs,samples);
the output esTSNR,esHRNR has the type 637920x1 double
and I'm trying to play the sound like this:
playerTSNR = audioplayer(esTSNR, fs);
playblocking(playerTSNR);
playerHRNR = audioplayer(esHRNR, fs);
playblocking(playerHRNR);
I've also tried:
sound(esTSNR);
sound(esHRNR);
and:
soundsc(esTSNR,fs);
soundsc(esHRNR,fs);
when I used the sound or soundsc function I've heared a little bit of the audio but I was excpecting to also hear speech in the audio, and I heared only a bit of the noise that was left without the speech.
any idea how can I hear the outputed clean audio?
thank you.
==================================UPDATE==================================
I was able t solve the problem by first turning the .wav file into a sampled data using audioread
[data, fs] = audioread('n.wav');
result = WienerScalart96(data,fs,36);
but now I'm haveing a new problem, I've got the output in results which has 577520x1 double type, and I want to play it so I can hear the sound which the algorithm cleaned. I'm trying to use audioplay to play the audio data as follows:
player = audioplayer(results, fs);
play(player);
but I'm not able to hear anything. How can I play the outputed clean audio?
the documentation of audioplayer:
player = audioplayer(Y,Fs) creates an audioplayer object for signal Y, using sample rate Fs. The function returns the audio player object, player.
the documentation of play:
play(playerObj) plays the audio associated with audioplayer object playerObj from beginning to end.
I think my problem is similar to this one but I don't fully understand the solutions suggested there (the first one - using playblocking instead of play doesn't work, and the others I can implement)
=============================================================================================
Hello,
I'm trying to run the Wiener Filter algorithm on Matlab R2019b to see if it suits my needs, I want to insert a .wav file as an input, but the filter function which is used cant proccess it. Is there any way to use the filter function on .wav file?
a link to the full implementation.
Wiener Filter algorithm main function declaration
function output=WienerScalart96(signal,fs,IS)
use of filter function line 37 in the algorithm
signal=filter([1 -pre_emph],1,signal);
I'm trying to call the function with the following arguments:
result = WienerScalart96('n.wav',16000,36);
so in my case signal = 'n.wav', fs = 16000 and IS = 36 seconds
filter function documentation:
y = filter(b,a,x) filters the input data x using a rational transfer function defined by the numerator and denominator coefficients b and a.
If a(1) is not equal to 1, then filter normalizes the filter coefficients by a(1). Therefore, a(1) must be nonzero.
If x is a vector, then filter returns the filtered data as a vector of the same size as x.
If x is a matrix, then filter acts along the first dimension and returns the filtered data for each column.
If x is a multidimensional array, then filter acts along the first array dimension whose size does not equal 1.
Thank you.
  4 Comments
Walter Roberson
Walter Roberson on 1 Sep 2020
audioplayer() and play() should work -- provided that there is a connect speaker, and provided the mute is not on, and provided that the volume is loud enough, and provided that the numeric values have sufficient dynamic range that they do not come out as silence.
Test with
load handel
player = audioplayer(y, Fs);
play(player);
Elinor Ginzburg
Elinor Ginzburg on 1 Sep 2020
It works. I'm very new to this, I think I understood what could be the problem, I think I didn't nderstand what I should be excpecting to hear as the output: the 'n.wav' file has only background noise in it, not a speech with noise which needs to be cleared, so I guess it cleared all the noise and I'm left with no sound. does that sound logical?
thank you very much for your advice.

Sign in to comment.

Answers (0)

Products


Release

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!