.txt to .wav file conversion

14 ビュー (過去 30 日間)
Janam
Janam 2012 年 3 月 7 日
Hello i am carrying out a project which will require conversion of a .txt file to a .wav file . Can anyone help me out with this ?

採用された回答

Grzegorz Knor
Grzegorz Knor 2012 年 3 月 7 日
First load data from file using e.g. importdata:
And then save it using wavwrite function:
  1 件のコメント
Janam
Janam 2012 年 3 月 13 日
i tried the foll lines it worked but i still dont understand the y in the syntax
load handel.mat
hfile='handel1.wav';
wavwrite(y, Fs, hfile);
where i handel.mat was an existing file.

サインインしてコメントする。

その他の回答 (1 件)

Karl
Karl 2012 年 3 月 7 日
That depends totally on the format of the TXT file. Step 1 is to read it into MATLAB and step 2 to maybe bring it into a format that is easy to export into WAV, which maybe fairly easy, see the doc for WAVWRITE:
Write WAVE (.wav) sound file
Syntax
wavwrite(y,filename)
wavwrite(y,Fs,filename)
wavwrite(y,Fs,N,filename)
For reading the TXT file, I ssuggest starting it interactively:
File -> Import Data
Make sure you click on "Genererate MATLAB Code" in the Import Wizard. That will create reusable code and you don't have to think a lot about learning syntax of the many import commands.
  2 件のコメント
Janam
Janam 2012 年 3 月 13 日
hello ,
I tried using the import wizard to import the data into the workspace which worked. But in the syntax of wavwrite -
Write WAVE (.wav) sound file
Syntax
wavwrite(y,filename)
wavwrite(y,Fs,filename)
wavwrite(y,Fs,N,filename)
y is supposed to be a variable who's value is stored into the file 'filename'. I could'nt make out the connection between the variable 'y' and the data which is imported into the workspace . I'd be glad if you could help me out wit this .
Janam
Janam 2012 年 3 月 13 日
i tried the foll lines it worked but i still dont understand the y in the syntax
load handel.mat
hfile='handel1.wav';
wavwrite(y, Fs, hfile);
where i handel.mat was an existing file.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by