Version

menu_open
Wwise SDK 2024.1.0
Python (Waapi-Client) - Subscription

Initializing the project

Note: The Python Waapi-Client is intended for use with Python 3.7+.

Run the following command from any directory to install dependencies:

# Windows
py -3 -m pip install waapi-client
# macOS, Linux
python3 -m pip install waapi-client

Project Code

This file contains the following code, which allows you to connect to the Wwise Authoring API.

#!/usr/bin/env python3
from waapi import WaapiClient, CannotConnectToWaapiException
from pprint import pprint
try:
# Connecting to Waapi using default URL
client = WaapiClient()
# NOTE: the client must be manually disconnected when instantiated in the global scope
except CannotConnectToWaapiException:
print("Could not connect to Waapi: Is Wwise running and Wwise Authoring API enabled?")
else:
# Callback function with a matching signature.
# Signature (*args, **kwargs) matches anything, with results being in kwargs.
def on_name_changed(*args, **kwargs):
obj_type = kwargs.get("object", {}).get("type")
old_name = kwargs.get("oldName")
new_name = kwargs.get("newName")
print("Object '{}' (of type '{}') was renamed to '{}'\n".format(old_name, obj_type, new_name))
client.disconnect()
handler = client.subscribe("ak.wwise.core.object.nameChanged", on_name_changed, {"return": ["type"]})
print("Subscribed 'ak.wwise.core.object.nameChanged', rename an object in Wwise")

Running the project

With a project open in Wwise, run the script in a terminal with the following command:

# Windows
py subscribe.py
# macOS, Linux
python3 subscribe.py

You should observe in the output something like:

Getting Wwise instance information:
Subscribed 'ak.wwise.core.object.nameChanged', rename an object in Wwise

Proceed to rename an object in Wwise. You should then observe something like:

Object 'MySound' (of type 'Sound') was renamed to 'MyOtherSound'

Was this page helpful?

Need Support?

Questions? Problems? Need more info? Contact us, and we can help!

Visit our Support page

Tell us about your project. We're here to help.

Register your project and we'll help you get started with no strings attached!

Get started with Wwise