Audio - SHN to MP3

 

I recently got a Pink Floyd audio set called Have You Got It Yet? (HYGIY), all the files were in SHN format. SHN is another lossless audio format, called Shorten. I prefer saving all of my files in high variable bit rate MP3, because my ears aren't good enough to hear the difference.

I primarily use OS X, so these instructions are geared towards that, but this should work on most *nix systems and Windows if you can find the binaries.

Step 0: Open Terminal

Step 1: Get and install ports, just follow the install instructions, it is easy.

Step 2: Get LAME.

  1. sudo port install lame

Step 3: Install shntool

  1. sudo port install shntool

Now, I like to make a bin directory off of my home folder and add it to the path, so I have a place to keep all of my custom bash script files. If you don't know how to use vi, you can use TextEdit to modify your .profile

  1. mkdir ~/bin
  2. /Applications/TextEdit.app/Contents/MacOS/TextEdit .profile &

Find where it says PATH= and add your bin path, like ~/bin:, then save and quit out of TextEdit.

Now source the modified profile.

  1. source ~/.profile

Now, let's create the script and edit it.

  1. cd ~/bin
  2. touch shn2mp3.sh
  3. /Applications/TextEdit.app/Contents/MacOS/TextEdit shn2mp3.sh &

This will open a blank file in TextEdit, now just paste the following in, then save and close it.

  1. #!/bin/bash
  2.  
  3. lame_opts="-V 0 -b 320"
  4.  
  5. for x in "${@}"
  6. do
  7. SHN=${x}
  8. MP3=`basename "${SHN%.shn}.mp3"`
  9. WAV=`basename "${SHN%.shn}.wav"`
  10.  
  11. shntool conv "${SHN}"
  12. lame ${lame_opts} "${WAV}" "${MP3}"
  13.  
  14. `rm "${WAV}"`
  15.  
  16. done

Finally go into the directory with the shn files and do:

  1. shn2mp3.sh *.mp3