SHN2k -- the shorten compression assistant for Windows
Introduction
Today's tools for creating .shn files leave a lot to be desired the way content is organized -- noname.md5, anyone? -- and it occurred to me that a Better Way was within our grasp. Enter SHN2k, a batch file for Windows that creates a burn-ready folder of .shn files from your .wav source files. -- a .shn folder in complete compliance with the etree standard, available at your fingertips any time via the Start>Run panel.
SHN2k was born when I noticed there was no existing command-line tool for Windows 2000 in the etree archive. I began by duplicating the functionality of the existing 'compress.bat' code for Win98, but that only got my mind wandering about further things that could be done with the script! Around the same time, I had some sketchy content come my way in a few e-trades: files with inconsistent names, folders mixed with .shn and .mkw files (none of which matched the included 'noname.md5'), and the like. Why not create a tool that makes this sort of thing impossible?
Why not create a tool that does it all -- the right way?
What It Does
Best, I think, to say it with pictures!
These are your .wav files, ready for encoding... Start > Run > SHN2k project_name -- it's that easy! SHN2k creates .shn files, an .md5 file, encode notes, wrapped up in a .shnf (shorten folder) -- all named consistently.
[image missing] [image missing] [image missing]
SHN2k creates a folder completely ready to burn or to send to the FTP server of your choice. it also automatically creates a 'VERIFY' script for anyone who might be receiving these .shn files from you. Just double click on the included VERIFY script and it checks the validity of the .shn files and, if they pass the inspection, expands them.
If you'd like to see the
encode_notes file or
VERIFY_ script from the above example, click on their names. [these two links reproduced in full below]
How Do I Use It?
Before using SHN2k the first time, you've got to edit the script to reflect your specific PC system, namely where your .wav files are stored and where you'd like to resulting .shn content to go. To do this, simply open the script in Notepad and follow along -- the few lines that require your intervention are very clearly marked. You'll also see fields for your name and the equipment you regularly use to create your .shn files, which is used to create the 'encode_nodes' file. You only need to do this once -- and once you're ready, save the SHN2k script in your windows system directory:
windows 95/98/ME users save it to
c:\windows\command
windows 2000/XP users save it to
c:\winnt\system32
(In the SHN2k.zip file there are also handy shortcuts to these paths to make installation very simple.)
You also *must* have shortn32.exe and md5sum.exe installed in the same location. Please download them
here. if you don't have them already. (mkwACT users *will* need to install these two additional files.)
Now that you've done that, the fun can begin!
To use SHN2k, all you need is a folder of .wav files that you'd like to convert to .shn. It is probably the best idea to name your source files as in the example above, namely
t01.wav
t02.wav
etc.
( I've configured EAC on my system to output tracks named in this fashion when I extract, or when I'm mastering a new source, I use 'Extract Regions' in SoundForge 4.5. If you'd like more info on how I get my source .wav files named this way,
email me.)
Once you've got files ready to encode, it really is as easy as calling 'Start > Run > SHN2k' and providing it with the name of your .wav project, date and name of band, what have you.
At the end of the process, it will automatically open the resulting .shnf folder so you can further edit the 'encode notes' file -- add a setlist, venue details, etc., run the VERIFY script if you'd like to check the validity of the files you've just created, etc.
Downloads
SHN2k is completely free for non-commercial use. I cannot be held responsible for any damage or unpredictable results that befall your system as a result of using this script. But, having said that, it's just a formality. I've been using SHN2k exclusively to create my .shn material for the last three months. It works. :-)
SHN2k.zip download
Support Notes
As the name somewhat implies, SHN2k was developed originally and optimized for Windows 2000 since there was no existing command-line solution. Windows 9x functionality was an afterthought, and, while it works, certainly things aren't as silky as in Win2k.
Windows 98 users will have better results if, instead of calling SHN2k from Start > Run, they open a DOS session first. (Start > Run > command) Then, once the DOS box is open, run SHN2k.
If you've installed Windows in a non-standard location -- anything other than c:\windows or c:\winnt -- you're going to have to manually modify the code of SHN2k. If you need to do this, email me and I'll give you some pointers.
:: TODO for v1.00 --
:: chomp on one file at a time
:: resolve wav_md5 naming problem
:: menu driven
:: turbo mode !!!
:: investigate 'out of environment space' error in win98 w / start-run method LEADS TO VERSION # not working
:: works when memory is allocated to it explicitly, but not by default. wtf?!!?
:: accept argument after project_name to replace local .wav location (maybe)
:: if temp_dir already exists, make new path (in the event of multiple encode sessions)
:: *** if you direct output to a subfolder, at md5 creation there's a 'cannot find path specified'
:: 'starting compression' just as the thing is finishing???
:: *** if a file is in use -- output an error message when trying to move to temp directory
:: *** make everything read-write before processing
:: rename folder with .shnf extension depending on name???
:: PREP mode -- chops name of files in current folder up to t0x.wav (DARING!!!!!)
:: VERIFY script -- instead of 'confirming shn.md5' why not give specific name to the md5 being verified
:: VERIFY script doesn't work when content has lived on a CD-rom (read/write issues i suspect)
:: RECENTLY FINISHED:
:: VERIFY_.bat for win9x
:: remove .shn extension before extracting
:: extract mode
:: VERIFY script needs version number
:: 'processing PROJECT_NAME...'
:: VERIFY only extracts files starting with name same as its own - line 343
:: add only relevant files to the .md5 file
:: VERIFY pop open relevant window
:: win98 time/date stamping -- done, but why phantom character??
:: BLANK VARIABLE = usage notes
:: -edit mode brings up script into notepad??
:: create warning file in temp folder about premature ejections
encode_notes.txt
Code:
dbyrne_05-24-01_fm
encoded by pwking (sleepypedro_at_yahoo.com)
Wed 01/23/2002 @ 6:02pm
audio extraction: Plextor PX-W1610A ~ EAC (secure mode) ~ shn2k
i rip, therefore i am!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
created by shn2k (v.0.9 beta5)
the shorten compression assistant for windows 2000 + beyond
written by peter w. king (sleepypedro_at_yahoo.com)
(c)2002 crabcollective productions
VERIFY_ script
Code:
@echo off
cls
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo VERIFY_dbyrne_05-24-01_fm.bat
echo created by shn2k (v.0.9 beta5)
echo the shorten compression assistant for windows 2000 + beyond
echo written by peter w. king (sleepypedro_at_yahoo.com)
echo (c)2002 crabcollective productions
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo verifying shn.md5 checksum
echo.
md5sum -c dbyrne_05-24-01_fm_shn.md5
echo.
if errorlevel=1 goto NOT_ROCKING
if errorlevel=0 goto FULLY_ROCKING
:NOT_ROCKING
echo Please try re-downloading the track(s) in question. Your copy doesn't match.
goto end
:FULLY_ROCKING
if "C:\WINNT"=="C:\WINNT" goto NEXT_SECTION
echo.
lfnfor on
:NEXT_SECTION
echo shorten files validated --
echo i'll extract them for you now!
echo.
:FILE_RENAMER
mkdir temp_dir
FOR %%f in (dbyrne_05-24-01_fm*.shn) DO move "%%f" "temp_dir\%%f"
cd temp_dir
FOR %%f in (*.shn) DO rename *.* *.
FOR %%f in (*) DO shortn32 -x %%f ..\%%f.wav
FOR %%f in (*) DO rename * *.shn
FOR %%f in (*.shn) DO move "%%f" "..\%%f"
cd ..
if "C:\WINNT"=="C:\WINNT" rmdir /Q temp_dir
if "C:\WINNT"=="C:\WINDOWS" rmdir temp_dir
explorer .
:end