How to specify the folder for wavwrite?

below are my code that i have written for wavwrite in the last line, the folder for the "x_Low_.wav" file is saved inside this folder.
C:\Users\user\Documents\MATLAB
the question is, how can i change the placement of the "x_Low_.wav" file into another folder at other location that i want. Let say i want to put it on my desktop.
second question, can i rename the "x_Low_.wav" file into "seiska_filtered.wav" by itself? what is the proper function that i have to use?
[y,Fs,bits] = wavread('C:\Users\user\seiska.wav');
x = y(:,1);
clear y;
N = length(x);
time = [1:N].*(1/Fs);
fc = 2000;
fNorm = fc / ( Fs/2);
[b,a] = butter(10, fNorm, 'low');
x_Low = filtfilt(b, a, x);
sound(x_Low,Fs,bits);
wavwrite(x_Low,Fs,bits,'x_Low_.wav');

답변 (3개)

Youssef  Khmou
Youssef Khmou 2013년 3월 1일

0 개 추천

hi,
you can put your file in directory you choose by the filename ,lets say you want save it the Desktop then :
filename='C:\Users\user\Desktop\x_Low.wav';
wavwrite(data,Fs,bits,filename);

댓글 수: 4

Youssef  Khmou
Youssef Khmou 2013년 3월 1일
to rename the file , i do not know if you can rename it with a command , just go to the directory and select the file , press F2 and put your new name ,
Nadiah
Nadiah 2013년 3월 1일
편집: Nadiah 2013년 3월 1일
i tried your code. which my full code is
[y,Fs,bits] = wavread('C:\Users\user\seiska');
x = y(:,1);
clear y;
N = length(x);
time = [1:N].*(1/Fs);
fc = 2000;
fNorm = fc / ( Fs/2);
[b,a] = butter(10, fNorm, 'low');
x_Low = filtfilt(b, a, x);
sound(x_Low,Fs,bits);
filename='C:\Users\user\Desktop\FYP2\x_Low.wav';
wavwrite(data,Fs,bits,filename);
however it gives error below
??? Undefined function or variable 'data'.
Error in ==> SaveFileToFolder at 14
wavwrite(data,Fs,bits,filename);
why is that?
Youssef  Khmou
Youssef Khmou 2013년 3월 1일
편집: Youssef Khmou 2013년 3월 1일
hi Nadia, no i tried to explain generally saying that data is vector ,no it must work in your code try :
wavwrite(x_low,Fs,bits,filename); % data in general as vector
Nadiah
Nadiah 2013년 3월 1일
oh sorry. i forgot to rename it. thank you.

댓글을 달려면 로그인하십시오.

Image Analyst
Image Analyst 2013년 3월 1일

0 개 추천

You can use uigetdir() to get the folder, then use fullfile() to build up the full filename. You can use copyfile() to rename a file.
farikha laily
farikha laily 2021년 3월 23일

0 개 추천

%Judul Lagu: Si-Unyil
Fs=16000;
t=0:1/Fs:0.25; %panjang not ¼ detik
c=sin(2*pi*262*t);
d=sin(2*pi*294*t);
e=sin(2*pi*330*t);
f=sin(2*pi*249*t);
g=sin(2*pi*392*t);
a=sin(2*pi*440*t);
b=sin(2*pi*494*t);
c1=sin(2*pi*523*t);
nol = [zeros(size(t))];
unyil = [b,nol,a,nol,g,nol,a,nol,b,nol,a,nol,a,nol,nol,nol,b,nol,a,nol,g,nol,e,nol,g,nol,e,nol,e];
sound(unyil,Fs);
wavwrite(unyil,Fs,t,'unyil.wav');
Undefined function or variable 'wavwrite'.
why?

댓글 수: 1

Image Analyst
Image Analyst 2021년 3월 23일
wavwrite() is an obsolete function that has been removed. It's been replaced by audiowrite().
Use audiowrite() instead.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기

질문:

2013년 3월 1일

댓글:

2021년 3월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by