v1.0.0
- Ruby 2.0 or greater is now required - the gem no longer works in Ruby 1.9.3.
- Backwards incompatible change: Calling
Reader.close
on aReader
instance that is already closed no longer raisesReaderClosedError
. Instead, it does nothing. Similarly, callingWriter.close
on aWriter
instance that is already closed no longer raisesWriterClosedError
. Thanks to @kylekyle for raising this as an issue. - Better compatibility when writing Wave files.
Writer
will now write files using a format calledWAVEFORMATEXTENSIBLE
where appropriate. This is a behind-the-scenes improvement - for most use cases it won't affect how you use the gem, but can result in better compatibility with other programs.- A file will automatically be written using
WAVEFORMATEXTENSIBLE
format if any of the following are true:- It has more than 2 channels
- It uses integer PCM sample format and the bits per sample is not 8 or 16 (in other words, if the sample format is
:pcm_24
or:pcm_32
). - A specific channel->speaker mapping is given (see below).
- A file will automatically be written using
- The channel->speaker mapping field can now be read from files that have it defined. For example, if a file indicates that the first sound channel should be mapped to the back right speaker, the second channel to the top center speaker, etc., this can be read using the
Reader.format.speaker_mapping
field.- Example:
-
reader = Reader.new("4_channel_file.wav") # [:front_left, :front_right, :front_center, :back_center] puts reader.format.speaker_mapping.inspect
-
- The channel->speaker mapping field isn't present in all Wave files. (Specifically, it's only present if the file uses
WAVEFORMATEXTENSIBLE
format). For a non-WAVEFORMATEXTENSIBLE
file,Reader.native_format.speaker_mapping
will benil
, to reflect that the channel->speaker mapping is undefined.Reader.format.speaker_mapping
will use a "sensible" default value for the given number of channels.
- Example:
- A channel->speaker mapping array can optionally be given when constructing a
Format
instance. If not given, a default value will be set for the given number of channels.- Example:
Format.new(4, :pcm_16, 44100, speaker_mapping: [:front_left, :front_right, :front_center, :low_frequency])
- Example:
- Errors raised by
Format.new
are improved to provide more detail.