Module: Shazamio::SampleRate
- Defined in:
- lib/shazamio/enums.rb
Overview
Enum keys are sample rates in Hz. Used by the signature format/algorithm.
Constant Summary collapse
- NAME_BY_VALUE =
{ 1 => "8000", 2 => "11025", 3 => "16000", 4 => "32000", 5 => "44100", 6 => "48000" }.freeze
- VALUE_BY_HZ =
{ 8000 => 1, 11_025 => 2, 16_000 => 3, 32_000 => 4, 44_100 => 5, 48_000 => 6 }.freeze
Class Method Summary collapse
Class Method Details
.hz_for(value) ⇒ Object
24 25 26 |
# File 'lib/shazamio/enums.rb', line 24 def self.hz_for(value) NAME_BY_VALUE.fetch(value).to_i end |
.value_for_hz(hz) ⇒ Object
28 29 30 |
# File 'lib/shazamio/enums.rb', line 28 def self.value_for_hz(hz) VALUE_BY_HZ.fetch(hz) end |