Applied Speech and Audio Processing: With matlab examples
Download 2.66 Mb. Pdf ko'rish
|
Applied Speech and Audio Processing With MATLAB Examples ( PDFDrive )
- Bu sahifa navigatsiya:
- Infobox 2.2
2.1. Handling audio in M
ATLAB 11 To read raw PCM sound into Matlab, we can use the general purpose fread() function, which has arguments that specify the data precision of the values to read in from a binary file, and also the endianess (see Infobox: The endian problem on page 14). First open the file to be read by name: fid=fopen(’recording.pcm’, ’r’); Next, read in the entire file, in one go, into a vector: speech=fread(fid , inf , ’int16’ , 0, ’ieee-le’); This would now have read in an entire file (‘inf’ or infinite values) of 16-bit integers. The format is IEEE little endian, which is what a PC tends to use. Alternatively (but rarely these days) we could have done: speech=fread(fid , inf , ’uint16’ , 0, ’ieee-be’); which would read in an entire file of unsigned 16-bit integers, in big endian format (such as a large UNIX mainframe might use). Finally it is good practice to close the file we had opened once we have finished reading from it: fclose(fid); It is also useful to know how to save and load arrays within Matlab. Using a built- in Matlab binary format, an array of speech, can be saved to disc using the save command, and loaded using the load command. The normal filename extension for the stored file is ‘.mat’. Infobox 2.2 Music file formats MP3, represented by the file extension .mp3, is a standard compressed file format invented by the Fraunhofer Institute in Germany. It has taken the world by storm: there is probably more audio in this format than in any other. The success of MP3, actually MPEG (Motion Pictures Expert Group) version 1 layer 3, has spawned numerous look-alikes and copies. These range from traditional technology leaders such as Apple, to traditional technology followers such as Microsoft. Ogg Vorbis, one notable effort is this strangely named format which is comparable in func- tionality to MP3, but not compatible with it: it is solely designed to be an open replacement for MP3, presumably for anyone who does not wish to pay licence fees or royalties to the Fraunhofer Institute. As such it has seen widespread adoption worldwide. However one thing is certain, and that is the world is currently locked into a battle between these formats, with a large and growing economic reason for ensuring format dominance. Luckily for the audio researcher, compressed file formats tend to destroy audio features, and thus are not really suitable for storage of speech and audio for many research purposes, thus we can stay out of the controversy and confine ourselves to PCM, RAW and Wave file formats. |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling