User Tools

Site Tools


voip:create_moh_files

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
voip:create_moh_files [2013/11/28 13:00] biggivoip:create_moh_files [2014/02/12 15:10] biggi
Line 1: Line 1:
-Quick script to convert .mp3 files to .wav+Quick script I wrote to convert .mp3 files to .wav 
 + 
 +Example: "ArtistGuy - SongTitle.mp3" will be converted to:\\ 
 +8000_ArtistGuy_-_SongTitle.wav\\ 
 +16000_ArtistGuy_-_SongTitle.wav\\ 
 +32000_ArtistGuy_-_SongTitle.wav\\ 
 +48000_ArtistGuy_-_SongTitle.wav\\ 
 + 
 +So, HZ is added and space is converted to underscore.
  
 <code - convertsongs.sh> <code - convertsongs.sh>
 #!/bin/bash #!/bin/bash
 IFSORG=$IFS IFSORG=$IFS
 +BITRATES="8000 16000 32000 48000"
 IFS=$'\n'; IFS=$'\n';
 for x in `ls *.mp3`; do for x in `ls *.mp3`; do
Line 9: Line 18:
  SONGNAME=`echo $x | tr " " _ | sed 's/\.mp3/\.wav/'`  SONGNAME=`echo $x | tr " " _ | sed 's/\.mp3/\.wav/'`
  
-# Now convert 'em songs son!+# Now convert 'em songs!
  echo "Converting $x:";  echo "Converting $x:";
- echo "8000 HZ.."+ IFS=$IFSORG
- mpg123 -q -s -f 8192 --mono -r 8000 -w "8000_$SONGNAME" $x + for y in $BITRATES; do 
- echo "16000 HZ.."; + echo -"$y Hz.. "; 
- mpg123 -q -s -f 8192 --mono -r 16000 -w "16000_$SONGNAME" $x + mpg123 -q -s -f 8192 --mono -r $y -w "${y}_$SONGNAME"$x
- echo "32000 HZ.."; + done 
- mpg123 -q -s -f 8192 --mono -r 32000 -w "32000_$SONGNAME" $x + echo ""; 
- echo "48000 HZ.."; + IFS=$'\n';
- mpg123 -q -s -f 8192 --mono -r 48000 -w "48000_$SONGNAME" $x+
 done done
 IFS=$IFSORG IFS=$IFSORG
voip/create_moh_files.txt · Last modified: 2015/08/15 22:56 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki