AudioConverter

class modusa.tools.audio_converter.AudioConverter[source]

Bases: ModusaTool

Converts audio to any given format using FFmpeg.

Note

  • Use convert() to perform the actual format conversion.

  • Requires FFMPEG to be installed on the system.

static convert(inp_audio_fp: str | Path, output_audio_fp: str | Path) Path[source]

Converts an audio file from one format to another using FFmpeg.

from modusa.engines import AudioConverter
converted_audio_fp = AudioConverter.convert(
        inp_audio_fp="path/to/input/audio.webm",
        output_audio_fp="path/to/output/audio.wav"
)
Parameters:
  • inp_audio_fp (str | Path) – Filepath of audio to be converted.

  • output_audio_fp (str | Path) – Filepath of the converted audio. (e.g. name.mp3)

Returns:

Filepath of the converted audio.

Return type:

Path

Note

  • The conversion takes place based on the extensions of the input and output audio filepath.