Can't change mixer values after initialisation

31 views
Skip to first unread message

kashik

unread,
May 29, 2022, 11:13:36 AM5/29/22
to pyo-discuss

Hello all.

I am trying to control mixer volumes through custom callbacks but that doesn't seem to work. I think the only thing that works is when I setup the server (which is Flask) and declare the values, when I try to change an amp value with a socket after the server starts, it takes no effect. I have a setup like this:

audio_server = pyo.Server(sr=44100, nchnls=2, buffersize=512) 
audio_server.boot() 
audio_server.start() 

background_audio_table = pyo.SndTable("background.wav") 
background_freq = background_audio_table.getRate() 
background_sound = pyo.Osc(table=background_audio_table, freq=background_freq, mul=1) 

audio_mixer = pyo.Mixer(outs=2, chnls=2) # this is the end of the chain audio_mixer.addInput(0, background_sound) # i will then add 0->n based on the nr of sounds I'll add and set the amp nr respectively audio_mixer.setAmp(0,0,1) 
audio_mixer.setAmp(0,1,1) audio_mixer.out()

I then have some callbacks on the keyboard that will call functions in the server file, with methods like:

@socketio.on('loremipsum') 
def _loremipsum(data): 
        audio_mixer.setAmp(0, 0, 0) 
        audio_mixer.setAmp(0, 1, 0)

This should put the volume of the background track to 0 right? Anyhow the audio doesn't stop, and to be honest doesn't seem to change at all (qualitative opinion). Any idea how to solve this?

Thanks

kashik

unread,
May 29, 2022, 11:16:32 AM5/29/22
to pyo-discuss
* missing some new lines on the audio_mixer declaration but you get the point!

kashik

unread,
Jun 2, 2022, 12:37:59 PM6/2/22
to pyo-discuss
Does anyone know how to solve this?

kashik

unread,
Jun 2, 2022, 1:23:06 PM6/2/22
to pyo-discuss
How do you recommend I change amp values on these objects programmatically with custom functions? This just doesn't work using setAmp(x, y, z).
Reply all
Reply to author
Forward
0 new messages