# Copyright 2011 Autodesk, Inc. All rights reserved. # Use of this software is subject to the terms of the Autodesk license agreement # provided at the time of installation or download, or which otherwise accompanies # this software in either electronic or hard copy form. # # Script description: # Demonstrate audio render to export a wav file from MotionBuilder, and various options to set. # # Topic: FBAudioRenderOptions, FBApplication().AudioRender # from pyfbsdk import * # Instance a FBAudioRenderOptions, the default value is 2 channels, 16 bits, 44100 hz, # The local TimeSpan of current take, Default file name is "Output.wav" in the last # audio export output path, or the default document path if the last path doesn't exist. lAudioRenderOptions = FBAudioRenderOptions() # Set the TimeSpan for the audio render to begin and end. lSystem = FBSystem() lAudioRenderOptions.TimeSpan = lSystem.CurrentTake.LocalTimeSpan # Set Channel mode, Mono or Stereo. Stereo default. lAudioRenderOptions.ChannelMode = FBAudioChannelMode.kFBAudioChannelModeStereo # Set Bit Depth mode, 8 bits and 16 bits available, 16 bits default. lAudioRenderOptions.BitDepthMode = FBAudioBitDepthMode.kFBAudioBitDepthMode_16 #Set Rate mode, 44100 hz default,8000, 11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000 available. lAudioRenderOptions.RateMode = FBAudioRateMode.kFBAudioRateMode_44100 # Set Output file name, change to you own path before run the script. # If the file exists, it will be overwritten, IF the file is currently being opened by other application, export may not success. lAudioRenderOptions.OutputFileName = 'C:/_MB/Output/Output.wav' lApp = FBApplication() # Render the wave file with the options specified. lResult = lApp.AudioRender(lAudioRenderOptions) print lResult