Class: FormatParser::Audio

Inherits:
Object
  • Object
show all
Includes:
AttributesJSON
Defined in:
lib/audio.rb

Constant Summary collapse

NATURE =
:audio

Constants included from AttributesJSON

FormatParser::AttributesJSON::MAXIMUM_JSON_NESTING_WHEN_SANITIZING

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from AttributesJSON

_sanitize_json_value, #as_json, #to_json

Constructor Details

#initialize(**attributes) ⇒ Audio

Only permits assignments via defined accessors



42
43
44
# File 'lib/audio.rb', line 42

def initialize(**attributes)
  attributes.map { |(k, v)| public_send("#{k}=", v) }
end

Instance Attribute Details

#albumObject

Album of the audio



11
12
13
# File 'lib/audio.rb', line 11

def album
  @album
end

#artistObject

Artist of the audio



14
15
16
# File 'lib/audio.rb', line 14

def artist
  @artist
end

#audio_sample_rate_hzObject

The sample rate of the audio file in hertz, as an Integer



24
25
26
# File 'lib/audio.rb', line 24

def audio_sample_rate_hz
  @audio_sample_rate_hz
end

#content_typeObject

The MIME type of the sound file



39
40
41
# File 'lib/audio.rb', line 39

def content_type
  @content_type
end

#formatObject

Type of the file (e.g :mp3)



17
18
19
# File 'lib/audio.rb', line 17

def format
  @format
end

#intrinsicsObject

If a parser wants to provide any extra information to the caller it can be placed here



36
37
38
# File 'lib/audio.rb', line 36

def intrinsics
  @intrinsics
end

#media_duration_framesObject

Duration of the media object in addressable frames or samples, as an Integer



32
33
34
# File 'lib/audio.rb', line 32

def media_duration_frames
  @media_duration_frames
end

#media_duration_secondsObject

Duration of the media object (be it audio or video) in seconds, as a Float



28
29
30
# File 'lib/audio.rb', line 28

def media_duration_seconds
  @media_duration_seconds
end

#num_audio_channelsObject

The number of audio channels for sound files that are muxed and for video files with embedded sound



21
22
23
# File 'lib/audio.rb', line 21

def num_audio_channels
  @num_audio_channels
end

#titleObject

Title of the audio



8
9
10
# File 'lib/audio.rb', line 8

def title
  @title
end

Instance Method Details

#natureObject



46
47
48
# File 'lib/audio.rb', line 46

def nature
  NATURE
end