
Octave Read Wav File
Reading and Writing Wav Files Using GNU Octave GNU Octave is a free and open source version of Matlab. The Audio package provides some handy functions for dealing with wav files. Function File: wavwrite (y, filename) Function File: wavwrite (y, fs, filename) Function File: wavwrite (y, fs, nbits, filename) Write the audio signal y to the RIFF/WAVE sound file filename. If y is a matrix, the columns represent multiple audio channels. The optional argument fs specifies the sample rate of the audio signal in Hz.
filename — Name of file to write
character vectorstring scalar
Name of file to write, or the full path to the file, specified as a character vector or string scalar that includes the file extension. If a path is specified, it can be absolute or relative. If you do not specify the path, then the destination directory is the current working directory.
audiowrite supports the following file formats.
| Platform Support | File Format | 
|---|---|
| All platforms | WAVE (.wav) | 
OGG (.ogg) | |
FLAC (.flac) | |
| Windows® and Mac | MPEG-4 AAC (.m4a, .mp4) | 
Example: 'myFile.m4a'
Example: './myFile.m4a'
Example: 'C:tempmyFile.m4a'
When writing AAC files on Windows, audiowrite padsthe front and back of the output signal with extra samples of silence.The Windows AAC encoder also places a very sharp fade-in andfade-out on the audio. This results in audio with an increased numberof samples after being written to disk.
Data Types: charstring
Audio data to write, specified as an m-by-n real matrix, where m is the number of audio samples to write and n is the number of audio channels to write.
If either m or n is 1,then audiowrite assumes that this dimension specifiesthe number of audio channels, and the other dimension specifies thenumber of audio samples.
The maximum number of channels depends on the file format.
| File Format | MaximumNumber of Channels | 
|---|---|
WAVE (.wav) | 1024 | 
OGG (.ogg) | 255 | 
FLAC (.flac) | 8 | 
MPEG-4 AAC (.m4a, .mp4) | 2 | 
The valid range for the data in y dependson the data type of y. 
| Data Type of y | ValidRange for y | 
|---|---|
uint8 | 0 ≤ y ≤ 255 | 
int16 | -32768 ≤ y ≤ +32767 | 
int32 | -2^31 ≤ y ≤ 2^31–1 | 
single | -1.0 ≤ y ≤ +1.0 | 
double | -1.0 ≤ y ≤ +1.0 | 
Data beyond the valid range is clipped.
If y is single or double,then audio data in y should be normalized to valuesin the range −1.0 and 1.0, inclusive. 
Data Types: singledoubleint16int32uint8
Sample rate, in hertz, of audio data y, specified as a positive integer scalar greater than 0. When writing to .m4a or .mp4 files on Windows platforms, audiowrite supports only samples rates of 44100 and 48000.
Example: 44100
Data Types: double
Name-Value Pair Arguments
Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,..,NameN,ValueN.
'Title','Symphony No. 9','Artist','My Orchestra' instructs audiowrite towrite an audio file with the title “Symphony No. 9”and the artist information “My Orchestra.”'BitsPerSample' — Number of output bits per sample
16 (default)   8243264
Number of output bits per sample, specified as the comma-separated pair consisting of 'BitsPerSample' and an integer.
Only available for WAVE (.wav) and FLAC (.flac)files. For FLAC files, only 8, 16, or 24 bits per sample are supported.
Example: 'BitsPerSample',32
'BitRate' — Kilobits per second (kbit/s)
128 (default)   6496160192256320
Number of kilobits per second (kbit/s) used for compressed audio files, specified as the comma-separated pair consisting of 'BitRate' and an integer. On Windows 7 or later, the only valid values are 96, 128, 160, and 192.
The decal will overpaint the “split colour” places, change the metallicity and smoothness of the surface. Let’s open the ukcamoverydarkdrab.tga file and draw black bars there (in the understanding of PBR 'black' - it's not darker than 30; 30; 30 in RGB).Important:. This texture should have alpha channel, the smoothness of the coloured areas depends on it. The torture game 2 skins. The texture should be shaded.
In general, a larger BitRate value resultsin higher compression quality.
Only available for MPEG-4 (.m4a, .mp4)files.
Example: 'BitRate',96
'Quality' — Quality setting for the Ogg Vorbis Compressor
75  (default)   value in the range [0 100]
Quality setting for the Ogg Vorbis Compressor, specified asthe comma-separated pair consisting of 'Quality' anda number in the range [0 100], where 0 is lower quality and highercompression, and 100 is higher quality and lower compression.
Only available for OGG (.ogg) files.
Example: 'Quality',25
'Title' — Title information
[] (default)   character vectorstring scalar
Title information, specified as the comma-separated pair consisting of 'Title' and a character vector or string scalar.
Data Types: charstring
'Artist' — Artist information
[] (default)   character vectorstring scalar
Artist information, specified as the comma-separated pair consisting of 'Artist' and a character vector or string scalar.
Data Types: charstring
'Comment' — Additional information
[] (default)   character vectorstring scalar
Additional information, specified as the comma-separated pair consisting of 'Comment' and a character vector or string scalar.

Data Types: charstring
Note
On Mac platforms, audiowrite writesmetadata to WAVE, OGG, and FLAC files only, and will not write the 'Title', 'Author',or 'Comment' fields to MPEG-4 AAC files.