Difference between revisions of "IC Python API:RLPy RlAudioObject"
From Reallusion Wiki!
Chuck (RL) (Talk | contribs) (Created page with "{{TOC}} {{Parent|IC_Python_API:RL_Python_Modules|Modules}} ==Detailed Description== This class represents the sound object in the scene. The developer can load or save audio f...") |
Chuck (RL) (Talk | contribs) m |
||
Line 1: | Line 1: | ||
{{TOC}} | {{TOC}} | ||
{{Parent|IC_Python_API:RL_Python_Modules|Modules}} | {{Parent|IC_Python_API:RL_Python_Modules|Modules}} | ||
− | == | + | {{last_modified}} |
− | This class | + | |
− | + | == 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: | |
− | + | ||
− | stereo | + | {| class="wikitable" |
− | + | |- | |
− | + | | | |
+ | |mono 16 bits | ||
+ | |stereo 16 bits | ||
+ | |- | ||
+ | |8 KHz | ||
+ | | style="text-align: center;" data-mce-style="text-align: center;"|✔ | ||
+ | | style="text-align: center;" data-mce-style="text-align: center;"|✔ | ||
+ | |- | ||
+ | |11 KHz | ||
+ | | style="text-align: center;" data-mce-style="text-align: center;"|✔ | ||
+ | | style="text-align: center;" data-mce-style="text-align: center;"|✔ | ||
+ | |- | ||
+ | |22 KHz | ||
+ | | style="text-align: center;" data-mce-style="text-align: center;"|✔ | ||
+ | | style="text-align: center;" data-mce-style="text-align: center;"|✔ | ||
+ | |- | ||
+ | |44 KHz | ||
+ | | style="text-align: center;" data-mce-style="text-align: center;"|✔ | ||
+ | | style="text-align: center;" data-mce-style="text-align: center;"|✔ | ||
+ | |- | ||
+ | |48 KHz | ||
+ | | style="text-align: center;" data-mce-style="text-align: center;"|✔ | ||
+ | | style="text-align: center;" data-mce-style="text-align: center;"|✔ | ||
+ | |} | ||
+ | |||
+ | See Also: [[IC_Python_API:RLPy_RAudio|RAudio]], [[IC_Python_API:RLPy_RAudioRecorder|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 | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
wav_path = "C:\\sample.wav" | wav_path = "C:\\sample.wav" | ||
self.audio_object = RLPy.RAudio.CreateAudioObject() | self.audio_object = RLPy.RAudio.CreateAudioObject() | ||
self.audio_object.Load(wav_path) | self.audio_object.Load(wav_path) | ||
− | print(self.audio_object.HasData()) # True | + | print(self.audio_object.HasData()) # True |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | === Load ( self, strPath ) === | |
− | + | ||
− | === | + | |
− | + | ||
− | + | Load a sound file onto this audio object. | |
− | + | See Also [[IC_Python_API:RLPy_RIAudioObject#Save|RLPy.RIAudioObject.Save()]] | |
− | + | ||
− | + | ==== Parameters ==== | |
− | === | + | :'''strPath''' [IN] Audio file location - string |
− | <syntaxhighlight lang=" | + | |
− | RLPy. | + | ==== Return ==== |
+ | :Success - RLPy.RStatus.Success | ||
+ | :Failure - RLPy.RStatus.Failure | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | wav_path = "C:\\sample.wav" | ||
+ | self.audio_object = RLPy.RAudio.CreateAudioObject() | ||
+ | self.audio_object.Load(wav_path) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | + | === Save ( self, strPath ) === | |
− | + | ||
− | === | + | |
− | + | ||
− | ''' | + | Save the sound data on this audio object to a '''wav''' file. |
− | '''RLPy.RStatus.Failure'' | + | See Also [[IC_Python_API:RLPy_RIAudioObject#Load|RLPy.RIAudioObject.Load()]] |
− | </ | + | |
+ | ==== Parameters ==== | ||
+ | :'''strPath''' [IN] Location for saving the sound file - string | ||
+ | |||
+ | ==== Return ==== | ||
+ | :Success - RLPy.RStatus.Success | ||
+ | :Failure - RLPy.RStatus.Failure | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | wav_path = "E:\\sample.wav" | ||
+ | self.audio_object = RLPy.RAudio.CreateAudioObject() | ||
+ | self.audio_object.Load(wav_path) | ||
+ | self.audio_object.Save("E:\\sample2.wav") | ||
+ | </syntaxhighlight> |
Latest revision as of 22:07, 23 April 2020
- 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")