From 174c906aaf9da20a5f1757a498855ed1fc15aca5 Mon Sep 17 00:00:00 2001 From: Santiago Jaramillo Date: Tue, 3 Feb 2015 14:21:31 -0800 Subject: [PATCH] Attempt to fix the bug when resetting sound waveforms. --- plugins/soundclient.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/soundclient.py b/plugins/soundclient.py index 4bf461c..612e04a 100644 --- a/plugins/soundclient.py +++ b/plugins/soundclient.py @@ -174,7 +174,7 @@ def create_sound(self,soundParams): freqEachComp = np.logspace(np.log10(centerFreq/factor),np.log10(centerFreq*factor),nTones) soundObj = pyo.Fader(fadein=self.risetime, fadeout=self.falltime, dur=soundParams['duration'], mul=soundAmp) - soundwaveObjs = nTones*[None] + soundwaveObjs = [] for indcomp in range(nTones): soundwaveObjs.append(pyo.Sine(freq=freqEachComp[indcomp], mul=soundObj).mix(2).out()) @@ -210,7 +210,11 @@ def create_sound(self,soundParams): def play_sound(self,soundID): # FIXME: check that this sound has been defined if USEJACK: - #self.soundwaves[soundID].reset() # Reset phase to 0 + if isinstance(self.soundwaves[soundID],list): + for sw in self.soundwaves[soundID]: + sw.reset() # Reset phase to 0 + else: + self.soundwaves[soundID].reset() self.sounds[soundID].play() else: soundfile = '/tmp/tempsound.wav'