-
Notifications
You must be signed in to change notification settings - Fork 20
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
Unable to use audiomixer API #6
Comments
Please add the following lines before your `switcher.connect()' , rerun the test and post its output: switcher.setLogLevel(logging.DEBUG)
switcher.setSocketLogLevel(logging.DEBUG) I'll try to see what's happening thru the logs. Thank you! |
Here's the output:
|
Hi ethan-ou, I'm sorry I have to guess my answer, because I don't have any switcher at hand to test my answers. But anyway, I'll try. First of all, the source code looks good at first sight. Looking at the program log you sent, these lines worried me:
Taking a look at the code, I see that neither class ATEMKeyFrames(ATEMConstantList):
"""KeyFrame list"""
a = ATEMConstant('a', 1)
b = ATEMConstant('b', 2)
full = ATEMConstant('full', 3)
runToInfinite = ATEMConstant('runToInfinite', 4)
class ATEMMediaPlayerSourceTypes(ATEMConstantList):
"""MediaPlayerSourceType list"""
still = ATEMConstant('still', 1)
clip = ATEMConstant('clip', 2) This makes me think your hardware may have a firmware version greater than 7.5.0 and that may be a problem with this library (see https://clvlabs.github.io/PyATEMMax/about/atem-version/) Besides, there's a lot of
which again makes me think of the firmware version issue. After all these
... but I was expecting to find switcher.setLogLevel(logging.DEBUG)
switcher.setSocketLogLevel(logging.DEBUG) The resulting log will be veeeery long, but it will include every transaction between your PC and the switcher, and that can give us some clues. |
Hi there! Just borrowed a switcher a few days ago, I'm doing some testing. I've tried the code you sent on your first post and it yielded different results in my case:
This is strange at first sight anyway, seems that it's been inverted. #!/usr/bin/python3
import PyATEMMax
import time
switcher = PyATEMMax.ATEMMax()
switcher.connect("192.168.1.111")
switcher.waitForConnection(infinite=False)
switcher.setAudioMixerInputMixOption(switcher.atem.audioSources.mic1, switcher.atem.audioMixerInputMixOptions.on) # Fails to turn on microphone
switcher.setAudioMixerInputVolume(switcher.atem.audioSources.mic1, 3.0)
time.sleep(0.05) # NEW sleep() !!
print("Mic 1 Volume 1:", switcher.audioMixer.input["mic1"].volume) # Prints 0, when should be 3
time.sleep(1)
switcher.setAudioMixerInputMixOption(switcher.atem.audioSources.mic1, switcher.atem.audioMixerInputMixOptions.off) # Fails to turn off microphone
switcher.setAudioMixerInputVolume(switcher.atem.audioSources.mic1, 0.0)
time.sleep(0.05) # NEW sleep() !!
print("Mic 1 Volume 2:", switcher.audioMixer.input["mic1"].volume) # Prints 0
switcher.disconnect() Now the result looks as expected:
While checking the response time I wrote a little script that changes the volume and the #!/usr/bin/python3
import PyATEMMax
import time
SWITCHER_IP = "192.168.1.111"
MIC_NAME = "mic1"
WAIT_FOR_CHANGE = True
switcher = PyATEMMax.ATEMMax()
switcher.connect(SWITCHER_IP)
switcher.waitForConnection()
microphone = switcher.audioMixer.input[MIC_NAME]
audio_source = switcher.atem.audioSources.mic1
def change_volume_and_wait(volume, mic_on):
mix_option = switcher.atem.audioMixerInputMixOptions.on if mic_on else switcher.atem.audioMixerInputMixOptions.off
print(f"---[ Turning {MIC_NAME} {mix_option}, volume: {volume} ]----------------------")
print(f"BEFORE: mixOption: {microphone.mixOption}, volume: {microphone.volume}")
print(f"Setting mix_option to: {mix_option}")
switcher.setAudioMixerInputMixOption(audio_source, mix_option)
print(f"Changing volume to: {volume}")
switcher.setAudioMixerInputVolume(switcher.atem.audioSources.mic1, volume)
# Wait for volume change to take effect
wait_start = time.time()
if WAIT_FOR_CHANGE:
while abs(microphone.volume - volume) > 0.001:
time.sleep(0.001)
elapsed = time.time() - wait_start
print(f"AFTER : mixOption: {microphone.mixOption}, volume: {microphone.volume}, took {elapsed:4.3f}s")
print()
for volume in range(3):
change_volume_and_wait(volume, True)
for volume in range(3, 0, -1):
change_volume_and_wait(volume, False)
switcher.disconnect() The output:
You can see the value update takes an average of 0.041s in my case, and also it seems that microphone is swiched Can you try this script in your setup and send me the output please ? |
Same problem here. #!/usr/bin/python3
import PyATEMMax
import logging
import time
switcher = PyATEMMax.ATEMMax()
switcher.setLogLevel(logging.DEBUG)
switcher.setSocketLogLevel(logging.DEBUG)
switcher.connect("192.168.xxx.xxx")
switcher.waitForConnection(infinite=False)
switcher.setAudioMixerInputMixOption(switcher.atem.audioSources.mic1, switcher.atem.audioMixerInputMixOptions.on) # Fails to turn on microphone
switcher.setAudioMixerInputVolume(switcher.atem.audioSources.mic1, 3.0)
time.sleep(0.05) # NEW sleep() !!
print("Mic 1 Volume 1:", switcher.audioMixer.input["mic1"].volume) # Prints 0, when should be 3
time.sleep(1)
switcher.setAudioMixerInputMixOption(switcher.atem.audioSources.mic1, switcher.atem.audioMixerInputMixOptions.off) # Fails to turn off microphone
switcher.setAudioMixerInputVolume(switcher.atem.audioSources.mic1, 0.0)
time.sleep(0.05) # NEW sleep() !!
print("Mic 1 Volume 2:", switcher.audioMixer.input["mic1"].volume) # Prints 0
switcher.disconnect() The result incl. DEBUG logging is:
|
This testing code #!/usr/bin/python3
import PyATEMMax
import time
SWITCHER_IP = "192.168.xxx.xxx"
MIC_NAME = "mic1"
WAIT_FOR_CHANGE = True
switcher = PyATEMMax.ATEMMax()
switcher.connect(SWITCHER_IP)
switcher.waitForConnection()
microphone = switcher.audioMixer.input[MIC_NAME]
audio_source = switcher.atem.audioSources.mic1
def change_volume_and_wait(volume, mic_on):
mix_option = switcher.atem.audioMixerInputMixOptions.on if mic_on else switcher.atem.audioMixerInputMixOptions.off
print(f"---[ Turning {MIC_NAME} {mix_option}, volume: {volume} ]----------------------")
print(f"BEFORE: mixOption: {microphone.mixOption}, volume: {microphone.volume}")
print(f"Setting mix_option to: {mix_option}")
switcher.setAudioMixerInputMixOption(audio_source, mix_option)
print(f"Changing volume to: {volume}")
switcher.setAudioMixerInputVolume(switcher.atem.audioSources.mic1, volume)
# Wait for volume change to take effect
wait_start = time.time()
if WAIT_FOR_CHANGE:
while abs(microphone.volume - volume) > 0.001:
time.sleep(0.001)
elapsed = time.time() - wait_start
print(f"AFTER : mixOption: {microphone.mixOption}, volume: {microphone.volume}, took {elapsed:4.3f}s")
print()
for volume in range(3):
change_volume_and_wait(volume, True)
for volume in range(3, 0, -1):
change_volume_and_wait(volume, False)
switcher.disconnect() Doesn't stop:
|
Hi @NoodleBB , thanks for the feedback. I'm feeling even more suspicious about a protocol/firmware version issue. I just ran this code: import PyATEMMax
import logging
SWITCHER_IP = "192.168.1.111"
switcher = PyATEMMax.ATEMMax()
switcher.setLogLevel(logging.DEBUG)
print(f"Connecting to {SWITCHER_IP}")
switcher.connect(SWITCHER_IP)
switcher.waitForConnection()
print("Connected")
version_str = f"{switcher.protocolVersion.major}.{switcher.protocolVersion.minor}"
print(f"Switcher protocol version: {version_str}")
switcher.disconnect() and got this result:
Seems I'm working with a Thanks in advance! |
Hello @clvLabs My results with 3 different ATEM Models. ATEM Mini: 2.30 ATEM Mini Pro ISO:
|
ATEM Mini:
|
ATEM Mini Extreme ISO + Pocket Cinema Camera 4K
I stopped the execution after some minutes. Rem.: I always had to break it twice. |
Unfortunately it seems to be a protocol/product version issue. |
After a conversation with one of the users of the library I think I should reopen this issue. The fact that I don't have the hardware to test and I cannot dedicate the time for the reverse engineering required to close this issue should not mean the issue gets closed with a I will remove the |
I've opened PR #36 which contains basic functionality for the new Fairlight Mixer. |
chocbic172 |
@someag admittedly it's been a while since I wrote this so it's likely something might have broken. Could you let me know a) the firmware of the ATEM Mini Pro you're using, and b) the specific function calls that aren't working for you? Can you still interact with the switcher in other ways (i.e. changing video)? |
After connecting to an ATEM and successfully switching video sources, I'm finding I'm unable to control any audio sources, including volume, enable and disable etc.
Some example code I'm using for the audio mixer:
When viewing the ATEM software control, I can also verify none of the values are changing as expected.
Let me know if I've written the code incorrectly or whether this is an internal bug.
The text was updated successfully, but these errors were encountered: