- #1
mushiman
- 10
- 0
I am a MATLAB newbie, and apparently I am having a terrible day because everything that I do in MATLAB has been resulting in an error and/or undesired behavior.
I am trying to write out a 'wav' file using a number of MATLAB created audio samples (simply by generating them using a sin function, and outputting them using sound();). The problem is that I need to create several sequentially, and create a single file that will have each in order.
As it stands, I am creating each tone individually, and therefore I cannot write them into a single 'wav' file with my low knowledge of MATLAB.
Right now, I am doing something like this:
Of course, I have to create a new batch of code like this for every new value of f0 that I need (and there are quite a few), but for my purposes, I suppose that this can work.
I need to know how to write the value(s) of 'x' into a matrix or something to that effect so that I can have the final result of all of my audio clips combined into a single 'wav' file that plays them sequentially. Any help would be greatly appreciated -- I can provide more detail on this issue if necessary.
I am trying to write out a 'wav' file using a number of MATLAB created audio samples (simply by generating them using a sin function, and outputting them using sound();). The problem is that I need to create several sequentially, and create a single file that will have each in order.
As it stands, I am creating each tone individually, and therefore I cannot write them into a single 'wav' file with my low knowledge of MATLAB.
Right now, I am doing something like this:
Code:
f0 = 220;
fs = 16000;
x = (insert my function here);
sound(x,fs);
wavwrite(x,fs,bits,'audio.wav');
Of course, I have to create a new batch of code like this for every new value of f0 that I need (and there are quite a few), but for my purposes, I suppose that this can work.
I need to know how to write the value(s) of 'x' into a matrix or something to that effect so that I can have the final result of all of my audio clips combined into a single 'wav' file that plays them sequentially. Any help would be greatly appreciated -- I can provide more detail on this issue if necessary.