Audio
Audio data is managed internally with the SoundFile library. Supported audio formats include MP3, AIFF, FLAC, and WAV. The audio object also provides various attributes and methods for manipulation.
|
Property |
Type |
Description |
|---|---|---|
|
filename |
str |
File name or path of the audio (if loaded from a file). |
|
format |
str |
Audio format (e.g., WAV, MP3). |
|
data |
bytes |
Audio data. |
|
sound_file |
sf.SoundFile |
Dynamic property: Returns the soundfile library's audio object (auto-decoded from data). |
|
Method |
Parameter |
Return Value |
Description |
|---|---|---|---|
|
__init__ |
filename: Union[str, os.PathLike] = None data: Union[str, bytes, sf.SoundFile] = None |
None |
Constructor: Loads audio from a file (filename) or data (data), supporting binary data or soundfile objects. |
|
truncate |
start_time: float = 0 end_time: Optional[float] = None |
Audio |
Extracts a segment of the audio (in seconds) and returns a new audio object. |
|
convert_format |
format: str subtype: Optional[str] = None |
Audio |
Converts the audio to a specified format (e.g., WAV to MP3) and returns a new audio object. |
|
write |
filename: str |
None |
Saves the audio to the specified file (format is automatically inferred). |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot