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.closeon aReaderinstance that is already closed no longer raisesReaderClosedError. Instead, it does nothing. Similarly, callingWriter.closeon aWriterinstance that is already closed no longer raisesWriterClosedError. Thanks to @kylekyle for raising this as an issue. - Better compatibility when writing Wave files.
Writerwill now write files using a format calledWAVEFORMATEXTENSIBLEwhere 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
WAVEFORMATEXTENSIBLEformat 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_24or: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_mappingfield.- 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
WAVEFORMATEXTENSIBLEformat). For a non-WAVEFORMATEXTENSIBLEfile,Reader.native_format.speaker_mappingwill benil, to reflect that the channel->speaker mapping is undefined.Reader.format.speaker_mappingwill use a "sensible" default value for the given number of channels.
- Example:
- A channel->speaker mapping array can optionally be given when constructing a
Formatinstance. 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.neware improved to provide more detail.