Class: Snd

Inherits:
Api show all
Defined in:
lib/api/snd.rb

Overview

a consecutave sequence of morphable tones (TonePart) of varying lengths, and rate of morphs, played without gaps.

Instance Method Summary collapse

Methods inherited from Api

#<<, #>>, #parent

Constructor Details

#initializeSnd

Returns a new instance of Snd.



4
5
6
7
# File 'lib/api/snd.rb', line 4

def initialize
  @snd=ToneSeq.new
  super
end

Instance Method Details

#countObject

number of tones



30
31
32
# File 'lib/api/snd.rb', line 30

def count
  toneseq.toneparts.count
end

#fadeObject

ensure all tones fade out to 0 as the final volume. note: re-run after changing amp.



35
36
37
# File 'lib/api/snd.rb', line 35

def fade
  toneseq.fade
end

#lengthObject

get length



27
28
# File 'lib/api/snd.rb', line 27

def length
@snd.frames end

#length=(val) ⇒ Object

set length



22
23
24
25
# File 'lib/api/snd.rb', line 22

def length= val
  @snd.frames=val
  self
end

#tone(i = 0, j = 0) ⇒ Object

return its TonePart at j and thats Tone at i.



18
19
20
# File 'lib/api/snd.rb', line 18

def tone i=0, j=0
  @snd.tonepart(j).tone(i)
end

#tonepart(i = 0) ⇒ Object

return its TonePart.



10
11
12
13
14
15
# File 'lib/api/snd.rb', line 10

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

#toneseqObject

return my ToneSeq



39
40
41
# File 'lib/api/snd.rb', line 39

def toneseq
  @snd
end