Clear Filters
Clear Filters

I'm dealing with Speech compression using Linear Predictive Coding. When I run the code I get a few errors.

1 view (last 30 days)
%MAIN BODY
clear all;
clc;
disp('It will take approaximately 18 seconds for an INTEL PENTIUM 4 [2.4GHz], 256 RAM machine to finish a 2sec [16kHz] wavfile');
%TAKING INPUT WAVEFILE,
kdt_003 = fullfile('C:\Users\user\Desktop\Yeni klasör');
[y, Fs] =audioread(kdt_003);
% x=wavrecord(,);
%LENGTH (IN SEC) OF INPUT WAVEFILE,
t=length(y)./Fs;
sprintf('Processing the wavefile "%s"', kdt_003)
sprintf('The wavefile is %3.2f seconds long', t)
%THE ALGORITHM STARTS HERE,
M=10; %prediction order
[aCoeff, pitch_plot, voiced, gain] = f_ENCODER(y, Fs, M); %pitch_plot is pitch periods
synth_speech = f_DECODER (aCoeff, pitch_plot, voiced, gain);
%RESULTS,
beep;
disp('Press a key to play the original sound!');
pause;
soundsc(y, Fs);
disp('Press a key to play the LPC compressed sound!');
pause;
soundsc(synth_speech, Fs);
figure;
subplot(2,1,1), plot(y); title(['Original signal = "', kdt_003, '"']); %title('original signal = "%s"', inpfilenm);
subplot(2,1,2), plot(synth_speech); title(['synthesized speech of "', kdt_003, '" using LPC algo']);
When I run the code
Error using audioread>readaudio (line 143)
The filename specified was not found in the MATLAB path.
Error in audioread (line 136)
[y, Fs] = readaudio (filename, range, datatype);
Error in MAIN (line 9)
[y, Fs] =audioread(kdt_003);
I'm getting errors.

Accepted Answer

Star Strider
Star Strider on 13 Jan 2024
This is the path to the file, however it does not include the file name (and extension):
kdt_003 = fullfile('C:\Users\user\Desktop\Yeni klasör');
If you are already specifying the full path, it should be either
kdt_003 = fullfile('C:\Users\user\Desktop','Yeni klasör','MyFile.wav');
or more simply:
kdt_003 = 'C:\Users\user\Desktop\Yeni klasör\MyFile.wav';
Since you apparently want to load a .wav file.
.

More Answers (1)

Image Analyst
Image Analyst on 13 Jan 2024
Edited: Image Analyst on 13 Jan 2024
The error is clear: the file does not exist. Check the spelling and location. Perhaps add a file extension if the file has one. Perhaps
kdt_003 = 'C:\Users\user\Desktop\Yeni klasör.wav'; % fullfile not needed in this case
or
kdt_003 = fullfile('C:\Users\user\Desktop\Yeni klasör', 'blahblah.wav'); % Add the base file name as second argument.

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!