Digital Sound & Music: Concepts, Applications, & Science, Chapter 5, last updated 6/25/2013
Figure 5.33 Saving a RAW audio file in Adobe Audition
When you save a file in this manner, you need to remember the sampling rate and bit depth. A
raw audio file is read in MATLAB as follows:
fid = fopen('HornsE04Mono.raw', 'r');
xRaw16 = fread(fid, 'int16');
fid is the file handle, and the r in single quotes means that the file is being opened to be read.
The type specifier int16 is used in fread so that MATLAB knows to interpret the input as 16-bit
signed integers. MATLAB's workspace window should show you that the values are in the
maximum range of 32768 to 32767 ( ) (Figure 5.34). The values don't span
the maximum range possible because they were at low amplitude to begin with.
For HornsE04Mono_8bits.raw, an 8-bit file, you can use
fid2 = fopen('HornsE04Mono_8bits.raw', 'r');
xRaw8 = fread(fid2, 'int8');
The values of xRaw8 range from 128 to 127, as shown in Figure 5.34.
Previous Page Next Page