Difference between revisions of "File format:Wav"

From sigrok
Jump to navigation Jump to search
 
(3 intermediate revisions by the same user not shown)
Line 17: Line 17:
== Format ==
== Format ==


See [http://en.wikipedia.org/wiki/WAV Wikipedia], [http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html www-mmsp.ece.mcgill.ca] or one of many other resources for a file format overview.
See [http://en.wikipedia.org/wiki/WAV Wikipedia], or one of many other [[#Resources|resources]] for a file format overview.


== Properties ==
== Properties ==
Line 26: Line 26:


== Implementation ==
== Implementation ==
Both input and output of WAV files is supported in sigrok. The input module can take sample values in PCM (8, 16 and 32 bits) and 32-bit IEEE754 BINARY32 floating point. Output to WAV files is always in 32-bit IEEE754 BINARY32 floating point.
WAV files are always assumed to be little-endian, and conversion to/from the files is done on that assumption.
The output module has an option <code>scale</code>. When specified, this divides the sample values by the given factor. This can be used when the resulting WAV file is intended for processing by an audio tool, which generally expects samples to be in the range -1 to +1.
The WAV format has the length of the file and of the 'data' chunk embedded in it, before the actual data. This clashes with sigrok's streaming nature; an output module cannot necessarily know how many samples are to follow. Therefore the module stores the maximum value in each of those fields. Audio tools reading those files seem to have no problem with that so far.


== Examples ==
== Examples ==
Line 31: Line 38:
== Resources ==
== Resources ==


* [https://ccrma.stanford.edu/courses/422/projects/WaveFormat/ stanford.edu: WAVE PCM soundfile format]
* [https://ccrma.stanford.edu/courses/422/projects/WaveFormat/ WAVE PCM soundfile format]
* [http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html Another specification]


__NOTOC__
__NOTOC__


[[Category:File format]]
[[Category:File format]]

Latest revision as of 14:35, 2 August 2014

wav
Name Waveform audio
Status supported
Source code (in) wav.c
Source code (out) wav.c
Common extension(s) .wav
MIME type audio/vnd.wave
ASCII format no
Compression none
Website wikipedia.org

wav is a binary file format generally used for storing audio data.

Format

See Wikipedia, or one of many other resources for a file format overview.

Properties

  • The maximum file size is limited to 4GB (uint32_t used for the file size header field). However, many applications routinely ignore this field, and just load however many samples are in the file.
  • While sigrok stores the analog values in a WAV file as they are, many audio applications that process WAV files cannot deal with sample values outside the range -1 to +1. Thus when generating a WAV file with sigrok with a view to using an audio application on that file, it is recommended to scale down the values to within the audio range.

Implementation

Both input and output of WAV files is supported in sigrok. The input module can take sample values in PCM (8, 16 and 32 bits) and 32-bit IEEE754 BINARY32 floating point. Output to WAV files is always in 32-bit IEEE754 BINARY32 floating point.

WAV files are always assumed to be little-endian, and conversion to/from the files is done on that assumption.

The output module has an option scale. When specified, this divides the sample values by the given factor. This can be used when the resulting WAV file is intended for processing by an audio tool, which generally expects samples to be in the range -1 to +1.

The WAV format has the length of the file and of the 'data' chunk embedded in it, before the actual data. This clashes with sigrok's streaming nature; an output module cannot necessarily know how many samples are to follow. Therefore the module stores the maximum value in each of those fields. Audio tools reading those files seem to have no problem with that so far.

Examples

Resources