Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panning ignored by Mixer? #182

Closed
jelling opened this issue May 18, 2020 · 7 comments
Closed

Panning ignored by Mixer? #182

jelling opened this issue May 18, 2020 · 7 comments

Comments

@jelling
Copy link

jelling commented May 18, 2020

I can pan audio fine when not using the mixer but when I add the panned audio into the Mixer the panning is lost. Is this supposed to work or do I misunderstand when/how to use the mixer?

from pyo import *

s = Server().boot()
s.start()

# Setup Mixer
mm = Mixer(outs=2, chnls=1)

# Load Files
path = "/Users/jelling/dev/performa/server/audio" 

# Play files - works
# speech = SfPlayer(path + "/gettysburg10.wav", loop=True, mul=.2).out(0)
# band = SfPlayer(path + "/CantinaBand60.wav", loop=True, mul=.2).out(1)

# Play files and pan without mixer - works
# speech = SfPlayer(path + "/gettysburg10.wav", loop=True, mul=.2)
# band = SfPlayer(path + "/CantinaBand60.wav", loop=True, mul=.2)

# speechPanned = Pan(speech,2,.5).out() # pan to center
# bandPanned = Pan(band,2,0,.5).out(1) # pan to center

# Play via mixer - works
# speech = SfPlayer(path + "/gettysburg10.wav", loop=True, mul=.2)
# band = SfPlayer(path + "/CantinaBand60.wav", loop=True, mul=.2)

# mm.addInput(0, speech.out())
# mm.addInput(1, band.out(1))

# Play panned files via mixer - panning to center has no effect
speech = SfPlayer(path + "/gettysburg10.wav", loop=True, mul=.2)
band = SfPlayer(path + "/CantinaBand60.wav", loop=True, mul=.2)

# Center pan does not take effect
speechPanned = Pan(speech, 1, 0.5)
bandPanned = Pan(band, 1, 0.5)

# Exposed pan controls in gui - moving controls still has no effect
speechPanned.ctrl()
bandPanned.ctrl()

mm.addInput(1, speechPanned.out(0))
mm.addInput(0, bandPanned.out(1))

s.gui(locals())
@stripwax
Copy link

stripwax commented May 18, 2020 via email

@jelling
Copy link
Author

jelling commented May 18, 2020

No it does not

@belangeo
Copy link
Owner

belangeo commented May 19, 2020 via email

@jelling
Copy link
Author

jelling commented May 19, 2020

@belangeo thank you for the detailed response. Two remaining questions:

  • center and close panning work in the code below but not hard panning. what am i missing?
  • is it necessary to set the volume for each channel individually or is there a convenience method for setting both at once?
# Play panned files via mixer

# Center both - works
# speechPanned = Pan(speech, 2,pan=0.5)
# bandPanned = Pan(band, 2, pan=0.5)

# tighter panning - works
# speechPanned = Pan(speech, 2,pan=0.2)
# bandPanned = Pan(band, 2, pan=0.8)

# hard panned -  only speech is heard
speechPanned = Pan(speech, 2,pan=0)
bandPanned = Pan(band, 2, pan=1)

mm.addInput(0, speechPanned)
mm.addInput(1, bandPanned)

# Had to set volume for each channel for each input
# is there a one-line way of doing this? not a big deal if not
mm.setAmp(0,0,3)
mm.setAmp(0,1,3)

mm.setAmp(1,0,3)
mm.setAmp(1,1,3)

mm.out() 

@jelling
Copy link
Author

jelling commented May 19, 2020

On further examination, the panning above may not be working for 0.2 or 0.5. I suspect the .setAmp command is overwriting the effect of the panning. Is that true? If so, could I trouble you for a simple example of how to properly pan with the mixer? I don't hear anything unless I use setAmp to set volume.

@belangeo
Copy link
Owner

Have you set the Mixer's number of channels per output to 2 (chnls argument) ? This is working as expected:

mm = Mixer(outs=2, chnls=2)

speech = Sine(2000, mul=Sine(4).range(0, 0.3))
band = Sine(1000, mul=Sine(8).range(0, 0.3))

# hard panned -  only speech is heard
speechPanned = Pan(speech, 2,pan=0)
bandPanned = Pan(band, 2, pan=1)

mm.addInput(0, speechPanned)
mm.addInput(1, bandPanned)

# Had to set volume for each channel for each input
# is there a one-line way of doing this? not a big deal if not
mm.setAmp(0,0,3)
mm.setAmp(0,1,3)

mm.setAmp(1,0,3)
mm.setAmp(1,1,3)

mm.out() 

@belangeo
Copy link
Owner

Closing as i don't think there is anything to fix here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants