Class: Vizcore::Shape::AudioContext
- Inherits:
-
Object
- Object
- Vizcore::Shape::AudioContext
- Defined in:
- lib/vizcore/shape.rb
Overview
Hash-like audio accessor for custom shape contexts.
Instance Method Summary collapse
- #amplitude ⇒ Object
- #bass ⇒ Object
- #beat? ⇒ Boolean
- #beat_pulse ⇒ Object
- #bpm ⇒ Object
- #fft ⇒ Object
- #high ⇒ Object
- #hihat ⇒ Object
-
#initialize(payload) ⇒ AudioContext
constructor
A new instance of AudioContext.
- #kick ⇒ Object
- #mid ⇒ Object
- #snare ⇒ Object
Constructor Details
#initialize(payload) ⇒ AudioContext
Returns a new instance of AudioContext.
320 321 322 |
# File 'lib/vizcore/shape.rb', line 320 def initialize(payload) @payload = symbolize_hash(payload) end |
Instance Method Details
#amplitude ⇒ Object
324 325 326 |
# File 'lib/vizcore/shape.rb', line 324 def amplitude numeric(@payload[:amplitude]) end |
#bass ⇒ Object
328 329 330 |
# File 'lib/vizcore/shape.rb', line 328 def bass numeric(band(:low)) end |
#beat? ⇒ Boolean
344 345 346 |
# File 'lib/vizcore/shape.rb', line 344 def beat? !!@payload[:beat] end |
#beat_pulse ⇒ Object
348 349 350 |
# File 'lib/vizcore/shape.rb', line 348 def beat_pulse numeric(@payload[:beat_pulse]) end |
#bpm ⇒ Object
364 365 366 |
# File 'lib/vizcore/shape.rb', line 364 def bpm numeric(@payload[:bpm]) end |
#fft ⇒ Object
340 341 342 |
# File 'lib/vizcore/shape.rb', line 340 def fft Array(@payload[:fft]) end |
#high ⇒ Object
336 337 338 |
# File 'lib/vizcore/shape.rb', line 336 def high numeric(band(:high)) end |
#hihat ⇒ Object
360 361 362 |
# File 'lib/vizcore/shape.rb', line 360 def hihat numeric(drum(:hihat)) end |
#kick ⇒ Object
352 353 354 |
# File 'lib/vizcore/shape.rb', line 352 def kick numeric(drum(:kick)) end |
#mid ⇒ Object
332 333 334 |
# File 'lib/vizcore/shape.rb', line 332 def mid numeric(band(:mid)) end |
#snare ⇒ Object
356 357 358 |
# File 'lib/vizcore/shape.rb', line 356 def snare numeric(drum(:snare)) end |