Audio Convertor

modusa.convert(inp_audio_fp, output_audio_fp, sr=None, mono=False) Path[source]

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

import modusa as ms
converted_audio_fp = ms.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)

  • sr (int | float) –

    • Resample it to any target sampling rate.

    • Default: None => Keep the original sample rate.

  • mono (bool) –

    • Do you want to convert the audio into mono?

    • Default: False

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.