Hi all, thanks for having me on this group. I am pretty new to pyo, and
to Python as well, so my question might have a very simple answer that I
cannot get on my own. In short, is it possible to dynamically apply
multiple filters to one playing sound file? A non-working example follows:
I would like to
load a source from an audio file,
apply the tone filter,
apply the pan filter,
start playing the file,
dynamically change parameters for both tone and pan, and hear them being
applyed to the audio file.
Qhat I guess is: every time I apply a filter I obtain a new object,
which has properties and methods according to its constructor. That's
why I can't modify both filters at the same time.
Here is my code:
from pyo import *
s = Server().boot()
s.start()
sound = SfPlayer("f:/sample.ogg", loop=True)
#Apply filters
sound = Tone(sound, freq=1000)
sound = Pan(sound, pan=0.1)
#start playing
sound.out()
#dynamically update filters function
def update_filters(tone_freq, pan_pos):
sound.setFreq(tone_freq) #this is the line where I get the
exception: 'Pan' object has no attribute 'setFreq'
sound.setPan(pan_pos)
#initialize filter parameters
initial_tone_freq = 1000
initial_pan_pos = 0.0
#Start updating cycle
while True:
initial_tone_freq += 100 #increase tone frequency
initial_pan_pos += 0.1 # modify pan position
if initial_pan_pos > 1.0:
initial_pan_pos = -1.0 # reset pan position
update_filters(initial_tone_freq, initial_pan_pos)
time.sleep(1)
Thanks for any help.
Luca
--
Questa email è stata esaminata alla ricerca di virus dal software antivirus Avast.
www.avast.com