├── .gitignore ├── LICENSE ├── README.md ├── offset_property.py └── offset_property_commands.json /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode/launch.json 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2017 Bernard Rodrigue 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Wwise Offset Property 2 | 3 | This script offsets a property value for a list of Wwise objects using WAAPI. By default, it increases the volume of the specified objects. the script takes a list of object IDs. 4 | 5 | Learn more about [WAAPI](https://www.audiokinetic.com/library/edge/?source=SDK&id=waapi.html). 6 | 7 | ## Requirements 8 | 9 | * Python 3.6+ (see https://pypi.org/project/waapi-client/) 10 | 11 | ## Usage 12 | 13 | ``` 14 | usage: offset_property.py [-h] [-p PROPERTY] [-o OFFSET] id [id ...] 15 | 16 | Offset a property value for a list of objects. By default, it increases the 17 | volume of the specified objects. 18 | 19 | positional arguments: 20 | id An object ID (GUID) 21 | 22 | optional arguments: 23 | -h, --help show this help message and exit 24 | -p PROPERTY, --property PROPERTY 25 | specify the property name to modify (default=Volume) 26 | -o OFFSET, --offset OFFSET 27 | specify the offset value to apply (default=1) 28 | ``` 29 | 30 | Refer to the [Wwise Objects Reference](https://www.audiokinetic.com/library/edge/?source=SDK&id=wobjects__index.html) for the list of properties available per object type. 31 | 32 | ## Example 33 | 34 | ### Increase the make-up gain by 2 35 | ``` 36 | py offset_property.py "{7BE98EBA-AF1C-4D1B-99B8-D6E8AED51929}" "{2892D2CD-05B8-46F5-A65E-5BBA435554EF}" -p MakeUpGain -o 2 37 | ``` 38 | 39 | ## Wwise Command Add-on Setup 40 | 41 | Using Wwise 2018.1.2 or higher 42 | 1. Copy the file `offset_property_commands.json` to: 43 | * **Windows**: %appdata%\Audiokinetic\Wwise\Add-ons\Commands 44 | * **Mac**: ~/Library/Application Support/Wwise2018/Bottles/wwise/drive_c/users/crossover/Application Data/Audiokinetic/Wwise/Add-ons/Commands 45 | 1. Fix the path to `offset_property.py` 46 | 1. Restart Wwise 47 | 1. Select objects, and use the keys `-` or `=` to increase or decrease volume. 48 | -------------------------------------------------------------------------------- /offset_property.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | import argparse 3 | from waapi import WaapiClient 4 | 5 | parser = argparse.ArgumentParser( 6 | description='Offset a property value for a list of objects. ' 7 | 'By default, it increases the volume of the specified objects.') 8 | parser.add_argument('id', nargs='+', help='An object ID (GUID)') 9 | parser.add_argument("-p", "--property", default='Volume', 10 | help="specify the property name to modify (default=Volume)") 11 | parser.add_argument("-o", "--offset", type=float, default=1, 12 | help="specify the offset value to apply (default=1)") 13 | args = parser.parse_args() 14 | 15 | accessor = '@'+args.property 16 | 17 | # Connect (default URL) 18 | with WaapiClient() as client: 19 | 20 | # Retrieve the volumes for the selected objects 21 | query = {'from': {'id': args.id}} 22 | options = {'return': ['id', accessor]} 23 | result = client.call("ak.wwise.core.object.get", query, options=options) 24 | 25 | # Make sure all of our set property calls are regrouped undo a single undo 26 | client.call("ak.wwise.core.undo.beginGroup") 27 | 28 | # Set new volumes 29 | for object in result['return']: 30 | if accessor in object: 31 | setPropertyArgs = { 32 | 'object': object['id'], 33 | 'property': args.property, 34 | 'value': object[accessor] + args.offset 35 | } 36 | client.call("ak.wwise.core.object.setProperty", setPropertyArgs) 37 | 38 | client.call("ak.wwise.core.undo.endGroup", 39 | displayName='Offset '+args.property) 40 | -------------------------------------------------------------------------------- /offset_property_commands.json: -------------------------------------------------------------------------------- 1 | { 2 | "commands": [ 3 | { 4 | "id": "ak.increase_volume", 5 | "displayName": "Increase Volume", 6 | "defaultShortcut": "=", 7 | "program": "pyw", 8 | "startMode": "MultipleSelectionSingleProcessSpaceSeparated", 9 | "args": "C:\\dev\\python-waapi\\offset_property.py ${id}", 10 | "contextMenu": {} 11 | }, 12 | { 13 | "id": "ak.decrease_volume", 14 | "displayName": "Decrease Volume", 15 | "defaultShortcut": "-", 16 | "program": "pyw", 17 | "startMode": "MultipleSelectionSingleProcessSpaceSeparated", 18 | "args": "C:\\dev\\python-waapi\\offset_property.py ${id} -o \"-1\"", 19 | "contextMenu": {} 20 | } 21 | ] 22 | } --------------------------------------------------------------------------------