soundwave
index
/home/zelle/Dropbox/classes/cs220/projects/audio/songplayer/soundwave.py

# soundwave.py
#    An object for representing and combining sounds.
# by: John Zelle

 
Modules
       
tonelib

 
Classes
       
builtins.object
SoundWave

 
class SoundWave(builtins.object)
    SoundWave(samples=[])
 
SoundWave is represented as a sequence of samples (floats in
the range -1 to 1) sampled at 44100 hz.
 
  Methods defined here:
__add__(self, other)
component-wise sum of self and other 
post: returns a new SoundWave that is the sum of self and other
__init__(self, samples=[])
Initialize self.  See help(type(self)) for accurate signature.
__len__(self)
return the number of samples in this SoundWave
__mul__(self, factor)
return SoundWave like self with each sample multiplied by factor
__rmul__(self, factor)
return SoundWave like self with each sample multiplied by factor
clamp(self)
truncate all samples to the range -1.0 to 1.0
duration(self)
return the length (playing time) in seconds
extend(self, other)
add samples at the end
pre: other is a SoundWave with same samplerate as self
post: self has been extended with the samples from other
maxamp(self)
return max deviation from 0.0
normalize(self)
scale samples (via multiplication) to the range -1.0 to 1.0
play(self)
play this soundwave
tofile(self, filename)
write this SoundWave to a wave (.wav) file.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
samplerate = 44100