summaryrefslogtreecommitdiff
path: root/sndobj.py
diff options
context:
space:
mode:
authorJohn Glover <john@john-glovers-macbook.local>2010-12-24 18:41:59 +0000
committerJohn Glover <john@john-glovers-macbook.local>2010-12-24 18:41:59 +0000
commit4063c8971278cdd19c0d3d3844b92082c18ce230 (patch)
tree47b9d8d3fcc549228a5233a1957187684f76a2d5 /sndobj.py
parentdc94bf68c2dc95d18025a61fb1afdd28f9a6c2b2 (diff)
downloadsimpl-4063c8971278cdd19c0d3d3844b92082c18ce230.tar.gz
simpl-4063c8971278cdd19c0d3d3844b92082c18ce230.tar.bz2
simpl-4063c8971278cdd19c0d3d3844b92082c18ce230.zip
Upgraded SndObjSynthesis to simpl 0.2
Diffstat (limited to 'sndobj.py')
-rw-r--r--sndobj.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/sndobj.py b/sndobj.py
index 2159028..b04060a 100644
--- a/sndobj.py
+++ b/sndobj.py
@@ -144,31 +144,31 @@ class SimplSndObjAnalysisWrapper(simplsndobj.SinAnal):
data to the SndObj synthesis objects."""
def __init__(self):
simplsndobj.SinAnal.__init__(self)
- self.peaks = []
+ self.partials = []
def GetTracks(self):
- return len(self.peaks)
+ return len(self.partials)
def GetTrackID(self, partial_number):
- if partial_number < len(self.peaks):
- return self.peaks[partial_number].partial_id
+ if partial_number < len(self.partials):
+ return partial_number
else:
# TODO: what should this return if no matching partial found?
return 0
def Output(self, position):
peak = int(position) / 3
- if peak > len(self.peaks):
+ if peak > len(self.partials):
# TODO: what should this return if no matching partial found?
return 0.0
data_field = int(position) % 3
if data_field is 0:
- return self.peaks[peak].amplitude
+ return self.partials[peak].amplitude
elif data_field is 1:
- return self.peaks[peak].frequency
+ return self.partials[peak].frequency
elif data_field is 2:
- return self.peaks[peak].phase
+ return self.partials[peak].phase
class SndObjSynthesis(simpl.Synthesis):
@@ -196,11 +196,11 @@ class SndObjSynthesis(simpl.Synthesis):
self._synth.Set('max tracks', num_partials)
self._max_partials = num_partials
- def synth_frame(self, peaks):
+ def synth_frame(self, frame):
"Synthesises a frame of audio, given a list of peaks from tracks"
- self._analysis.peaks = peaks
- if len(peaks) > self._max_partials:
- self.max_partials = len(peaks)
+ self._analysis.partials = frame.partials
+ if len(frame.partials) > self._max_partials:
+ self.max_partials = len(frame.partials)
self._synth.DoProcess()
self._synth.PopOut(self._current_frame)
return self._current_frame