Class: Snd
Overview
a consecutave sequence of morphable tones (TonePart) of varying lengths, and rate of morphs, played without gaps.
Instance Method Summary collapse
- #amp=(val) ⇒ Object
-
#count ⇒ Object
number of tones.
-
#fade ⇒ Object
ensure all tones fade out to 0 as the final volume.
-
#freq ⇒ Object
freq of first tone only.
-
#freq=(val) ⇒ Object
assumes one tone only.
-
#initialize ⇒ Snd
constructor
A new instance of Snd.
-
#length ⇒ Object
get length.
-
#length=(val) ⇒ Object
set length.
-
#tone(i = 0, j = 0) ⇒ Object
return its TonePart at j and thats Tone at i.
-
#tonepart(i = 0) ⇒ Object
return its TonePart.
-
#toneseq ⇒ Object
return my ToneSeq.
Methods inherited from Api
Constructor Details
Instance Method Details
#amp=(val) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/api/snd.rb', line 19 def amp= val toneseq.do_all {|tp| tp.do_all {|tone| tone.amp.start = val tone.amp.final = 0.0 } } end |
#count ⇒ Object
number of tones
49 50 51 |
# File 'lib/api/snd.rb', line 49 def count toneseq.toneparts.count end |
#fade ⇒ Object
ensure all tones fade out to 0 as the final volume. note: re-run after changing amp.
54 55 56 |
# File 'lib/api/snd.rb', line 54 def fade toneseq.fade end |
#freq ⇒ Object
freq of first tone only
15 16 17 |
# File 'lib/api/snd.rb', line 15 def freq tone.freq.start end |
#freq=(val) ⇒ Object
assumes one tone only
10 11 12 |
# File 'lib/api/snd.rb', line 10 def freq= val tone.set_freq val end |
#length=(val) ⇒ Object
set length
41 42 43 44 |
# File 'lib/api/snd.rb', line 41 def length= val @snd.frames=val self end |
#tone(i = 0, j = 0) ⇒ Object
return its TonePart at j and thats Tone at i.
37 38 39 |
# File 'lib/api/snd.rb', line 37 def tone i=0, j=0 @snd.tonepart(j).tone(i) end |
#tonepart(i = 0) ⇒ Object
return its TonePart.
29 30 31 32 33 34 |
# File 'lib/api/snd.rb', line 29 def tonepart i=0 child = @snd.tonepart i raise "This Snd has no tone at index #{i}. " + "It has #{count} tones." if child.nil? child end |