Class: TagLib::RIFF::WAV::File

Inherits:
File
  • Object
show all
Defined in:
docs/taglib/wav.rb

Overview

The file class for .wav files.

Examples:

Reading the title

title = TagLib::RIFF::WAV::File.open("sample.wav") do |file|
  file.tag.title
end

Reading WAV-specific audio properties

TagLib::RIFF::WAV::File.open("sample.wav") do |file|
  file.audio_properties.sample_width  #=>  16
end

Saving ID3v2 cover-art to disk

TagLib::RIFF::WAV::File.open("sample.wav") do |file|
  id3v2_tag = file.tag
  cover = id3v2_tag.frame_list('APIC').first
  ext = cover.mime_type.rpartition('/')[2]
  File.open("cover-art.#{ext}", "wb") { |f| f.write cover.picture }
end

See Also:

Since:

  • 0.7.0

Constant Summary collapse

NoTags =

Since:

  • 0.7.0

0x0000
ID3v1 =

Since:

  • 0.7.0

0x0001
ID3v2 =

Since:

  • 0.7.0

0x0002
APE =

Since:

  • 0.7.0

0x0004
AllTags =

Since:

  • 0.7.0

0xffff

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from File

#close, #save

Constructor Details

#initialize(filename, read_properties = true) ⇒ File

Load a WAV file.

Parameters:

  • filename (String)
  • read_properties (Boolean) (defaults to: true)

    if audio properties should be read

Since:

  • 0.7.0



49
50
# File 'docs/taglib/wav.rb', line 49

def initialize(filename, read_properties=true)
end

Class Method Details

.open(filename, read_properties = true) {|file| ... } ⇒ Object

Creates a new file and passes it to the provided block, closing the file automatically at the end of the block.

Note that after the block is done, the file is closed and all memory is released for objects read from the file (basically everything from the TagLib namespace).

Using open is preferable to using new and then manually close.

Parameters:

  • filename (String)
  • read_properties (Boolean) (defaults to: true)

    if audio properties should be read

Yields:

Returns:

  • the return value of the block

Since:

  • 0.7.0



41
42
# File 'docs/taglib/wav.rb', line 41

def self.open(filename, read_properties=true)
end

Instance Method Details

#audio_propertiesTagLib::RIFF::WAV::Properties

Returns audio properties.

Returns:

Since:

  • 0.7.0



69
70
# File 'docs/taglib/wav.rb', line 69

def audio_properties
end

#id3v2_tagTagLib::ID3v2::Tag

Returns the ID3v2 tag.

Returns:

Since:

  • 1.0.0



63
64
# File 'docs/taglib/wav.rb', line 63

def id3v2_tag
end

#strip(tags = TagLib::RIFF::WAV::File::AllTags) ⇒ void

This method returns an undefined value.

Remove the tags matching the specified OR-ed types.

Parameters:

  • tags (int) (defaults to: TagLib::RIFF::WAV::File::AllTags)

    The types of tags to remove.

Since:

  • 1.0.0



78
79
# File 'docs/taglib/wav.rb', line 78

def strip(tags=TagLib::RIFF::WAV::File::AllTags)
end

#tagTagLib::ID3v2::Tag

Returns the ID3v2 tag.

Returns:

Since:

  • 0.7.0



55
56
# File 'docs/taglib/wav.rb', line 55

def tag
end