Class: Mext::Sound::Info
- Inherits:
-
Object
- Object
- Mext::Sound::Info
- Defined in:
- lib/mext/sound/info.rb
Overview
Mext::Sound::Info
Mext::Sound::Info
is a class that holds all the information about a given sound sample.
PLEASE NOTE: current implementation only supports wav files. You are welcome to contribute a more encompassing one.
Instance Attribute Summary collapse
-
#channels ⇒ Object
readonly
Returns the value of attribute channels.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#num_frames ⇒ Object
readonly
Returns the value of attribute num_frames.
-
#sample_rate ⇒ Object
readonly
Returns the value of attribute sample_rate.
-
#sound_dir ⇒ Object
readonly
Returns the value of attribute sound_dir.
Instance Method Summary collapse
-
#dur ⇒ Object
dur
. -
#initialize(f, dir) ⇒ Info
constructor
A new instance of Info.
Constructor Details
#initialize(f, dir) ⇒ Info
Returns a new instance of Info.
19 20 21 22 23 |
# File 'lib/mext/sound/info.rb', line 19 def initialize(f, dir) @filename = f @sound_dir = dir setup end |
Instance Attribute Details
#channels ⇒ Object (readonly)
Returns the value of attribute channels.
17 18 19 |
# File 'lib/mext/sound/info.rb', line 17 def channels @channels end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
16 17 18 |
# File 'lib/mext/sound/info.rb', line 16 def filename @filename end |
#num_frames ⇒ Object (readonly)
Returns the value of attribute num_frames.
17 18 19 |
# File 'lib/mext/sound/info.rb', line 17 def num_frames @num_frames end |
#sample_rate ⇒ Object (readonly)
Returns the value of attribute sample_rate.
17 18 19 |
# File 'lib/mext/sound/info.rb', line 17 def sample_rate @sample_rate end |
#sound_dir ⇒ Object (readonly)
Returns the value of attribute sound_dir.
16 17 18 |
# File 'lib/mext/sound/info.rb', line 16 def sound_dir @sound_dir end |
Instance Method Details
#dur ⇒ Object
dur
returns the total duration in seconds, calculating it with sample precision
31 32 33 |
# File 'lib/mext/sound/info.rb', line 31 def dur self.num_frames.to_f / self.sample_rate.to_f end |