-
Notifications
You must be signed in to change notification settings - Fork 12
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
Houdini flipbook audio #192
Comments
The audio in Houdini can be managed in Python using the The I wonder why it's this hard to find anything about Houdini's audio settings from Python. :) |
Here's an example to query the currently set values - apparently the import hou
def get_audio_settings() -> dict:
"""Return current audio settings.
Uses the hscript `audiopanel` command to
query the currently configured settings
and convert them into a dictionary.
"""
settings, _ = hou.hscript("audiopanel")
mapping = {
"-s r": "scrubRepeat",
"-s s": "scrubSustain",
"-s f": "scrubRate",
"-s p": "chop",
"-t p": "testPlayDirection",
"-t l": "testPlayLoop",
"-t r": "testPlayRewind",
"-o m": "mono",
"-o t": "volumeTied",
"-o u": "volumeMeter",
"-o l": "volumeLeft",
"-o r": "volumeRight",
# 0 off, 1 timeline, 2 timeslice, 3 test
"-o d": "audioMode",
"-r d": "audioOutputDelay",
# 0 for CHOPs, 1 for Audio Files
"-m": "source",
"-a": "file",
"-f": "audioFrame",
"-O": "audioOffset"
}
def _convert_value(value):
# Convert to int or float or strip quote of string
if value.isdigit():
return int(value)
else:
try:
return float(value)
except ValueError:
# strip quotes around filename
return arg_value.strip("'")
result = {}
for line in settings.split("\n"):
line = line.strip()
if not line:
continue
args = line[len("audiopanel "):]
for key, value in mapping.items():
if args.startswith(key):
# strip off the argument and the space
arg_value = args[len(key) + 1:]
arg_value = _convert_value(arg_value)
result[value] = arg_value
break
else:
print(f"Unsupported argument line: {line}")
return result
# Example
settings = get_audio_settings()
if settings["source"] == 0:
# Using chops
print("Using CHOPs: ", settings["chop"])
elif settings["source"] == 1:
# Using file
print("Using file: ", settings["file"])
# Let's print the returned values
import json
print(json.dumps(settings, indent=4)) Example output then is: {
"chop": "",
"scrubRepeat": "off",
"scrubSustain": 24,
"scrubRate": 24,
"testPlayDirection": "stop",
"testPlayLoop": "off",
"testPlayRewind": "on",
"mono": "off",
"volumeTied": "on",
"volumeMeter": "on",
"volumeLeft": 1,
"volumeRight": 1,
"audioMode": 2,
"audioOutputDelay": 0.171,
"source": 1,
"file": "C:/projects/ayontest/asset/char_beast/work/lighting/sample3.aiff",
"audioFrame": 1001,
"audioOffset": 0
} I asked about whether there are alternative solutions to this on SideFX forum here: https://www.sidefx.com/forum/topic/99147/?page=1#post-434788 |
Is there an existing issue for this?
Please describe the feature you have in mind and explain what the current shortcomings are?
Hi Hi!
As per @BigRoy 's request,
It would be great to be able to include audio with flipbook publishes in Houdini. As of 0.4.0 this doesn't seem possible.
This is currently possible when creating a flipbook in houdini if you have audio enabled through the audio panel. It will play the flipbook in MPlay with the timeline audio.
Suggested implementation?
I'm not sure if it would work with CHOPS as it sounds like it would have to be done in post,
Describe alternatives you've considered:
No response
The text was updated successfully, but these errors were encountered: