I tried making a simple m-file which does all kinds of standard stuff for audio processing. Load a file, play a file, view the plot and spectrogram.
Some points of attention:
- subplot(numberOfRows, numberOfColumns, indexOfPlot)
after that, comma-separated, you specify the plot (plot(), stem(),...)
and then several things you like, like: title(''), ...
indexOfPlot counts from left-to-right and top-to-bottom. - wavread:
[soundFile,sampleFrequency] = wavread('La.wav');
soundFile is a vector with all the samples (values between -1 and 1). If you want to see only the first n bits, you add n after the filename at the RHS of the equation. To see the vector you omit the point comma.
sampleFrequency in Hertz
You also can specify the number of bits used to encode every sample (Quantisation), therefore you add 'NBits' after 'sampleFrequency' - Supports multi-channel data, with up to 32 bits per sample.
- This file reader only supports Microsoft PCM data format.
- Also auread is possible
- To control the axes of the plot a website previously specified uses: axis('tight')
This sets the limit of the axes to the range of data. I think that the y-axis is too tight then, so I put it on auto (still quite tight though). What I search for is a command to set only the y-axis (to -1, 1) - I think it's best to always add 'clear all;' in the beginning of an m-file.
- The website still used specgram, but matlab prefers spectrogram now.
I will study this soon.
We really should start implementing some effects in matlab. When encountering problems we don't have to bother disturbing toon.
We talked a bit about simulink/matlab/... According to toon best is to implement in matlab. He thinks there's no way to implement realtime functions in matlab (although he heard that in a newer version of matlab there'd be a possibility to do exactly so). The normal procedure would be to translate the matlab code to C or JAVA.
More wasn't really said I think. Before the exams we must really try to implement some effects and get used to the matlab environment.
We also can start searching for articles on audio feature extraction.
That's all.
2 comments:
arbitrary plot zooming can be obtained by using the Matlab command axis([xmin xmax ymin ymax]), e.g., in your case (suppose that range of the x-axis is 0 to 1000), you should use axis([0 1000 -1 1]).
When using wavplay and wavread pay attention to also include the sampling frequency:
[soundVector,sampleFrequency]=wavread('La.wav')
wavplay(soundVector,sampleFrequency)
Post a Comment