Skip to content

Latest commit

 

History

History
44 lines (31 loc) · 1.24 KB

README.md

File metadata and controls

44 lines (31 loc) · 1.24 KB

Asterisk Extensibles

Important

Basic terminal and PBX management skills are assumed.

Extensible apps for asterisk: Talk BotMusic Player

Conversion Script

This script will convert any MP3, WAV or FLAC files to Mono 8kHz PCM WAV files suitable for Asterisk. Converted files will be placed in a subdirectory named converted.

  1. Ensure FFmpeg is installed on your system.
  2. Open your terminal, then navigate to the directory containing the audio files to be converted.
  3. Copy and paste the appropriate script for your OS into your terminal.

Windows (PowerShell)

$output = "converted"
New-Item -Path $output -ItemType Directory -Force
Get-ChildItem | where {$_.extension -in ".mp3",".wav",".flac"} | ForEach-Object {
   $name = "$output/$($_.BaseName).wav"
   & ffmpeg -i $_.Name -ar 8000 -ac 1 -acodec pcm_s16le -f wav $name
}

Linux (Bash)

output="converted"
mkdir -p $output
for file in *.mp3 *.wav *.flac; do
  name="$output/${file%.${file##*.}}.wav"
  ffmpeg -i "$file" -ar 8000 -ac 1 -acodec pcm_s16le -f wav "$name";
done