Class: TagLib::AudioProperties

Inherits:
Data
  • Object
show all
Defined in:
lib/taglib_simple/audio_properties.rb

Overview

Represents the audio properties of a media file

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#audio_lengthInteger (readonly)

Returns The length of the audio in milliseconds.

Returns:

  • (Integer)

    The length of the audio in milliseconds



# File 'lib/taglib_simple/audio_properties.rb', line 9

#bitrateInteger (readonly)

Returns The bitrate of the audio in kb/s.

Returns:

  • (Integer)

    The bitrate of the audio in kb/s



# File 'lib/taglib_simple/audio_properties.rb', line 12

#sample_rateInteger (readonly)

Returns The sample rate in Hz.

Returns:

  • (Integer)

    The sample rate in Hz



# File 'lib/taglib_simple/audio_properties.rb', line 15

Class Method Details

.read(filename, audio_properties: true) ⇒ AudioProperties

Parameters:

  • filename (String|:to_path|IO)
  • audio_properties (Symbol<:average, :fast, :accurate>) (defaults to: true)

    read style

Returns:

Raises:

  • (ArgumentError)


25
26
27
28
29
# File 'lib/taglib_simple/audio_properties.rb', line 25

def read(filename, audio_properties: true)
  raise ArgumentError, 'audio_properties must be one of :average, :fast, :accurate' unless audio_properties

  Taglib::MediaFile.open(filename, audio_properties:, &:audio_properties)
end