domenica 27 settembre 2015

Batch conversion of audio files for the Akai MPC1000

I wanted to load on the Akai MPC1000 a set of drum machine samples which I found on the internet. The files looked like normal WAV files and played on the computer, but they didn't load correctly on the Akai. It turned out that the Akai MPC1000 does not accept any other format than exactly: WAV, 44100 Hz, 16 bit, mono or stereo. It's possible to convert files one by one by hand with programs like Audacity or VLC, but since I had a lot of samples to load on my memory card I decided to write a simple batch script to convert all these files at once. It was quite a trivial task but I decided to post it here for future reference, if somebody else ever needs it:
 #!/bin/sh                                                                            
 vlc="/usr/bin/vlc"                                 
 if [ ! -e "$vlc" ]; then 
   echo "Command '$vlc' does not exist" 
   exit 1 
 fi 

 for file in "$@"; do 
   echo "=> Transcoding '$file'... " 
   dst=`dirname "$file"` 
   temp=$dst/`basename "$file" | sed 's@\.[a-z][a-z][a-z]$@@'`.temp 
   $vlc -I dummy -q "$file" \ 
     --sout "#transcode{acodec=s16l,samplerate=44100}:standard{mux=wav,dst=\"$temp\",access=file}" \ 
     vlc://quit 
   mv "$temp" "$file" 
 done 


The scripts runs on GNU/Linux (Ubuntu in my case) and the package vlc (or vlc-nox) is a prerequisite for running it. You should create a script called "convert.sh" with the previous content, and make it executable with:
 chown u+x convert.sh

You can then run the batch convert with:
 ./convert.sh my_wav_folder/*.wav

All files in the target folder will be replaced by the script with files of the right format, so then you should be able to load them on the MPC1000.

Nessun commento:

Posta un commento