Audio
Audio data is processed internally with the PyAV library. Supported audio formats include MP3, AIFF, FLAC, WAV, WMA, M4A, and AAC. The audio object also provides various properties 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 (for example, WAV or MP3). |
| subtype | str | Audio encoding. |
| data | bytes | Audio 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 (for example, from WAV to MP3) and returns a new audio object. |
| write | filename: str | None | Saves the audio to the specified file (format is automatically inferred). |
| split | interval: int | list[Audio] | Splits the audio into a list of segments based on a specified interval (in seconds). |
What is your overall rating for this page?
Thank 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