IC Python API:RLPy RlAudioObject

From Reallusion Wiki!
Jump to: navigation, search
Main article: Modules.
Last modified: 04/23/2020

Description

This class provides functionalities for audio objects in the scene to read and save sound files. Currently, only PCM format wav files are supported with the following channel, frequency, and bit rate configurations:

mono 16 bits stereo 16 bits
8 KHz
11 KHz
22 KHz
44 KHz
48 KHz

See Also: RAudio, RAudioRecorder

Member Functions

HasData ( self )

Check whether or not this audio object contains sound data.

Returns

True if this audio object contains sound data, else False - boolean
1 wav_path = "C:\\sample.wav"
2 self.audio_object = RLPy.RAudio.CreateAudioObject()
3 self.audio_object.Load(wav_path)
4 print(self.audio_object.HasData())  # True

Load ( self, strPath )

Load a sound file onto this audio object.

See Also RLPy.RIAudioObject.Save()

Parameters

strPath [IN] Audio file location - string

Return

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
1 wav_path = "C:\\sample.wav"
2 self.audio_object = RLPy.RAudio.CreateAudioObject()
3 self.audio_object.Load(wav_path)

Save ( self, strPath )

Save the sound data on this audio object to a wav file.

See Also RLPy.RIAudioObject.Load()

Parameters

strPath [IN] Location for saving the sound file - string

Return

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
1 wav_path = "E:\\sample.wav"
2 self.audio_object = RLPy.RAudio.CreateAudioObject()
3 self.audio_object.Load(wav_path)
4 self.audio_object.Save("E:\\sample2.wav")