Getting error inMatlab 2008 but code is fine in Matlab 2011

1 view (last 30 days)
Hi i have written a code which is working fine with me in Matlab 2011
when i send same code tomy frd who is using Matlab 2008,he is gettiing the error on this line no 34
[~, start_sample] = find_voice_activity(noisy_voice , starting_point);
error is
EDU>> dtmfmain(y,fs) ??? Error: File: dtmfmain.m Line: 34 Column: 3 Expression or statement is incorrect--possibly unbalanced (, {, or [.
How can i help him kindly tell me the changes which are required in this line to make it compatible with Matlab 2008
Thanks a lot

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 27 Oct 2011
The use of ~ notation is only available in R2009b or later. You can replace ~ with a unwanted variable name such as temp, trash, dummy,...

More Answers (2)

moonman
moonman on 27 Oct 2011
Ok this code i got from net
i have pasted it. Can u kindly tell me what should i write instead of ~. Thanks a lot
if nargin < 2
Fs = 8000;
end
starting_point = 1;
voice_detected = [];
noisy_voice = dtmftones;
%%Audio Pre-processing
% Fifteen thousand samples containing 0 are added to the actual data so as to
% make sure that algorithm below can easily dissect the tone at the end.
noisy_voice = [noisy_voice;zeros(15000,1)];
% In order to reduce noise in presumably 'silent zone', we replace all the
% magnitutudes less or equal to 0.21 in noisy data to 0, so that our
% algorithm can clearly see different tone presses.
ind = find(abs(noisy_voice) <= 0.1);
for a = 1:length(ind)
noisy_voice(ind(a)) = 0;
end
% First 500 samples are replaced with zeros in order to eliminate the
% effects of high amplitudes in initial samples (When microphone
% initializes, it gives some undesired output initially, and that is
% neutralized.)
noisy_voice = [zeros(500,1);noisy_voice(500:length(noisy_voice)-1)];
% Audio is trimmed from start till first valid speech sample is detected,
% and then audio stream is reveresed and trimmed again, which provides last
% valid speech sample. This is done because otherwise in the last part of
% audio, if there is only noise, it may also be treated as speech.
[~, start_sample] = find_voice_activity(noisy_voice , starting_point);
start_of_speech = start_sample;
[~, start_sample] = find_voice_activity(flipud(noisy_voice) , starting_point);
end_of_speech = start_sample;

moonman
moonman on 27 Oct 2011
Thanks a lot for quick solution it is resolved

Categories

Find more on Audio Processing Algorithm Design in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!