Class: Phash::Audio
Overview
Class to store audio file hash and compare to other
Instance Attribute Summary collapse
-
#length ⇒ Object
readonly
Returns the value of attribute length.
Attributes inherited from FileHash
Instance Method Summary collapse
- #compute_phash ⇒ Object
-
#initialize(path, length = nil, sample_rate = nil) ⇒ Audio
constructor
Audio path and optional length in seconds to read.
Methods inherited from FileHash
for_paths, hash_type, #phash, #similarity
Constructor Details
#initialize(path, length = nil, sample_rate = nil) ⇒ Audio
Audio path and optional length in seconds to read
121 122 123 |
# File 'lib/phash/audio.rb', line 121 def initialize(path, length = nil, sample_rate = nil) @path, @length, @sample_rate = path, length, sample_rate end |
Instance Attribute Details
#length ⇒ Object (readonly)
Returns the value of attribute length.
118 119 120 |
# File 'lib/phash/audio.rb', line 118 def length @length end |
Instance Method Details
#compute_phash ⇒ Object
125 126 127 |
# File 'lib/phash/audio.rb', line 125 def compute_phash Phash.audio_hash(@path, @length, @sample_rate) end |