Octave Read Wav File

Aug 02, 2010  wavread problem with Octave 3.2.3. Hi, I'm having a problem reading a wav file and getting 'error: memory exhausted or requested size too large for range of Octave's index type. Audiowrite (filename,y,Fs) writes a matrix of audio data, y, with sample rate Fs to a file called filename. The filename input also specifies the output file format. The output data type depends on the output file format and the data type of the audio data, y. Audiowrite (filename,y,Fs,Name,Value) uses additional options specified by one.

filenameName 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 SupportFile Format
All platformsWAVE (.wav)
OGG (.ogg)
FLAC (.flac)
Windows® and MacMPEG-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 FormatMaximumNumber 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 yValidRange for y
uint80 ≤ 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.

Example: '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.

Albums Album titleYearTracksBitratePriceOrder201815320€2.12 €2.€0.57 €0.0€2.12 €2.0€2.12 €2.0€1.55 €1.0€2.12 €2.0€1.98 €1.0€1.98 €1.0€1.84 €1.0€1.70 €1.0€1.84 €1.0€2.12 €2.0€1.70 €1.0€1.55 €1.0€1.98 €1.8€1.98 €1.0€1.70 €1.0€1.84 €1.9€1.84 €1.6€1.70 €1.70. Page: 1 of 2. Now i'm free planetshakers mp3 download.

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.

filenameName of file to read
character vectorstring scalar

Name of file to read, specified as a character vector or string scalar that includes the file extension. If a path is specified, it can be absolute, relative or partial.

Example: 'myFile.mp3'

Example: './myFile.mp3'

Example: 'C:tempmyFile.mp3'

audioread supports the following file formats.

Platform SupportFile Format
All platformsWAVE (.wav)
OGG (.ogg)
FLAC (.flac)
AU (.au)
AIFF (.aiff, .aif)
AIFC (.aifc)
Windows® 7 (or later), Macintosh, and Linux®MP3 (.mp3)
MPEG-4 AAC (.m4a, .mp4)

On Windows platforms prior to Windows 7, audioread does not read WAVE files with MP3 encoded data.

On Windows 7 (or later) platforms, audioread might also read any files supported by Windows Media® Foundation.

On Linux platforms, audioread might also read any files supported by GStreamer.

audioread can extract audio from MPEG-4 (.mp4, .m4v) video files on Windows 7 or later, Macintosh, and Linux, and from Windows Media Video (.wmv) and AVI (.avi) files on Windows 7 (or later) and Linux platforms.

Data Types: charstring

samplesAudio samples to read
[1,inf] (default) two-element vector of positive scalar integers

Audio samples to read, specified as a two-element vector ofthe form [start,finish], where start and finish arethe first and last samples to read, and are positive scalar integers.

  • start must be less than or equalto finish.

  • start and finish mustbe less than the number of audio samples in the file,

  • You can use inf to indicate thelast sample in the file.

Note

When reading a portion of some MP3 files on Windows 7 platforms, audioread mightread a shifted range of samples. This is due to a limitation in theunderlying Windows Media Foundation framework.

When reading a portion of MP3 and M4A files on Linux platforms, audioread mightread a shifted range of samples. This is due to a limitation in theunderlying GStreamer framework.

Example: [1,100]

Data Types: double

dataTypeData format of audio data, y
'double' (default) 'native'

Data format of audio data,y, specified asone of the following:

'double'Double-precision normalized samples.
'native'Samples in the native format found in the file.

For compressed audio formats, such as MP3 and MPEG-4 AAC thatdo not store data in integer form, 'native' defaultsto 'single'.

Data Types: charstring