The excellent browser based space game Star Supremacy features some Imphenzia Soundtrack music. Check out this game trailer with Nostalgia [Retreat Edit]:
I was also happy to see in the forums that the music is enjoyed by some of the players =)
The blog is being migrated and merged with multiple Imphenzia blogs so the format and content will be inconsistent for a while.
(Watch in HD at YouTube for better readability)
Click HERE TO DOWNLOAD the zip file containing the scripts.
' #############################################################################
' IMPHENZIA SOUNDTRACK WATERMARKING SCRIPT http://soundtrack.imphenzia.com
' #############################################################################
' ## DESCRIPTION ##############################################################
' This VB script uses Sound eXchange (SoX) (http://sox.sourceforge.net) to
' create watermarked WAV files.
' Based on the duration of the WAV files you wish to watermark, the script
' will select a suitable frequency of the watermark. By default the following
' logic is applied:
' 0-5 second music file: watermark occurs every 2.5 seconds
' 5-15 second music file: watermark occurs every 5 seconds
' 15-30 second music file: watermark occurs every 10 seconds
' 30-1200 second music file: watermark occurs every 30 seconds
' > 20 minutes files are not supported - change the script if necessary.
' ## INSTRUCTIONS #############################################################
' 1. Put your original WAV files that you wish to watermarked in the
' subfolder "input-wav-originals"
' 2. Execute this script and it will create watermarked WAV files in the
' subfolder "output-wav-watermarked"
' ## CHANGING THE WATERMARK ###################################################
' The default watermark says the word "preview" at different intervals
' depending on the duration of the WAV file. You can change the watermark
' audio files but I recommend that you keep the name and ogg format of the
' watermark files so you don't have to modify the script.
' To change the watermark, replace the audio in the watermark files. Use
' trial and error to find a suitable volume (I recommend peaks at around
' -8 dB) and frequency of the watermark.
' ## LICENSE ##################################################################
' You're free to use this script and the watermark OGG files free of charge.
' If this script saves you a lot of time, a donation to [email protected]
' is very welcome =)
' SoX is a free application available at the URL in the description. This
' script is very dependent on the exact output SoX generates to read
' information so a version of SoX is included in the archive.
' (You may not sell the script or any of the files)
Dim source_folder, destination_folder
Dim watermark_folder, watermark_file, log_filename
' ## CUSTOMIZABLE VARIABLES ###################################################
source_folder = "input-wav-originals"
destination_folder = "output-wav-watermarked"
watermark_folder = "input-watermarks"
log_filename = "watermark-log.txt" ' Filename for log file (overwritten)
use_volume = true ' Watermark volume based on original
' You shouldn't need to edit any of the below script
' -----------------------------------------------------------------------------
Dim wshshell, filesys, folder, files_collection, filecount, filename
Dim outputfile, logoutput, duration, volume, volumedecimal, n
' ## Create Filesystem Objects
Set wshshell = WScript.CreateObject("WScript.Shell")
Set filesys = CreateObject("Scripting.FileSystemObject")
Set folder = filesys.GetFolder(source_folder & "\.")
Set files_collection = folder.Files
Set logoutput = filesys.OpenTextFile(log_filename, 2, True)
' ## Ensure that the output directory exists, if not then create it
if not filesys.FolderExists( destination_folder ) then _
filesys.CreateFolder destination_folder
' ## Create header in log file
logoutput.WriteLine("Source File, Source Duration, Watermark, " & _
"Source Amplitude, Watermark Amplitude")
' ## Loop through all original wav files
filecount = files_collection.Count
for each file in files_collection
filename = file.name
if lcase(right(filename,4))=".wav" then
' ## If a watermarked version does not exists, create one
if not filesys.FileExists( destination_folder & "\" & filename ) then
' ## Select appropriate watermarked file based on duration of source file
duration = CLng(runCMD("sox --info -s """ & _
source_folder & "\" & filename & """"))
if duration <= 220500 then _
watermark_file = watermark_folder & "\preview-0-5sec.ogg"
if duration > 220500 and duration <= 661500 then _
watermark_file = watermark_folder & "\preview-5-15sec.ogg"
if duration > 661500 and duration <= 1323000 then _
watermark_file = watermark_folder & "\preview-15-30sec.ogg"
if duration > 1323000 then _
watermark_file = watermark_folder & "\preview-30-1200sec.ogg"
' ## If volume is used, set volume based on amplitude of source wav file
if use_volume then
volume = runCMDAlt("sox """ & source_folder & "\" & filename & _
""" -n stat")
volume = mid(volume,123,8)
volumedecimal = CDbl(replace(volume, ".", ","))
else
volumedecimal = 1.0
end if
' ## Mix source wav file and watermark file to create a watermarked file
wshshell.Run "sox -m -v 1 """ & source_folder & "\" & filename & _
""" -v " & replace((volumedecimal*volumedecimal),",",".") & _
" """ & watermark_file & """ """ & destination_folder & _
"\" & filename & """ trim 0s " & duration & "s",0,true
' ## Write the action to log file
logoutput.WriteLine(source_folder & "\" & filename & "," & _
watermark_file & "," & replace((CDbl(duration)/44100),",",".") & "," & _
volume & "," & replace((volumedecimal*volumedecimal),",","."))
n=n+1
end if
end if
next
if n=0 then
wscript.echo "No Files Created " & vbCrLf & _
"If watermarked files already exist they are not recreated"
else
wscript.echo "Done! " & vbCrLf & n & " Watermarked File(s) Created "
end if
' Supporting function to capture the output of command line
function runCMD(strRunCmd)
Set objExec = wshshell.Exec(strRunCmd)
strOut = ""
Do While Not objExec.StdOut.AtEndOfStream
strOut = strOut & objExec.StdOut.ReadLine()
Loop
runCMD = strOut
End Function
' Supporting function to capture error output (workaround)
Function runCMDAlt(strRunCmd)
Set objExec = wshshell.Exec(strRunCmd)
strOut = ""
strOut = objExec.StdErr.ReadAll()
runCMDAlt = strOut
End Function
' #############################################################################
' IMPHENZIA SOUNDTRACK ENCODING SCRIPT http://soundtrack.imphenzia.com
' #############################################################################
' Version: 1.0
' ## DESCRIPTION ##############################################################
' This scripts encodes the wav files in the folder "input-wav-originals" and
' "output-wav-watermarked" into MP3 and OGG files.
' The script also creates meta tags for the MP3 and OGG files based on the
' source file name and additional customizable in this script.
' You can set the bitrate of the MP3 and OGG files in this script as well.
' ## INSTRUCTIONS #############################################################
' 1. Ensure that the WAV files in the "input-wav-originals" folder and the
' "output-wav-watermarked" folders contain files named according to the
' following naming standard:
' Arist Name_Song Name_Music Genre_Year
' Example:
' Imphenzia Soundtrack_Fog of War (Main Part Loop)_Orchestral_2011.wav
' 2. Customize the encoding bitrates for the original and watermarked MP3
' and OGG files (see CUSTOMIZABLE ENCODING BITRATES)
' 3. Customize the MP3 and OGG meta tags (see CUSTOMIZABLE MP3 and OGG TAGS)
' 4. Double click on the script to begin the encoding process. The script
' will create MP3 and OGG files in the appropriately named output folders.
' ## LICENSE ##################################################################
' You're free to use this script and the watermark OGG files free of charge.
' If this script saves you a lot of time, a donation to [email protected]
' is very welcome =)
' This script uses the following freeware and/or open source applications:
' lame.exe - http://www.mp3dev.org
' metamp3.exe - http://www.hydrogenaudio.org/forums/index.php?showtopic=49751
' oggenc.exe - http://www.rarewares.org/ogg-oggenc.php
' tag.exe - http://wiki.hydrogenaudio.org/index.php?title=Tag_(tagger)
' (You may not sell the script or any of the files)
Dim source_folder, source_watermarked_folder
Dim destination_mp3_original, destination_mp3_watermarked
Dim destination_ogg_original, destination_ogg_watermarked
Dim mp3_original_bitrate, mp3_watermarked_bitrate
Dim ogg_original_bitrate, ogg_watermarked_bitrate
Dim tag_encoder_name, tag_publisher_name, tag_copyright_name, tag_url
Dim tag_composer_name, tag_comment, tag_album, tag_watermarked_prefix
' ## CUSTOMIZABLE FOLDERS #####################################################
source_folder = "input-wav-originals"
source_watermarked_folder = "output-wav-watermarked"
destination_mp3_original = "output-mp3-original"
destination_mp3_watermarked = "output-mp3-watermarked"
destination_ogg_original = "output-ogg-original"
destination_ogg_watermarked = "output-ogg-watermarked"
' ## CUSTOMIZABLE ENCODING BITRATES ###########################################
mp3_original_bitrate = "160" ' Bitrate in kbps
mp3_watermarked_bitrate = "96" ' Bitrate in kbps
ogg_original_bitrate = "128" ' Bitrate in kbps
ogg_watermarked_bitrate = "64" ' Bitrate in kbps
' ## CUSTOMIZABLE MP3 and OGG TAGS#############################################
tag_encoder_name = "ENCODER NAME HERE"
tag_publisher_name = "PUBLISHER NAME HERE"
tag_copyright_name = "COPYRIGHT HOLDER NAME HERE"
tag_url = "http://YOUR URL HERE"
tag_composer_name = "COMPOSER NAME HERE"
tag_comment = "Encoded using script by http://soundtrack.imphenzia.com"
tag_album = "TEXT FOR ALBUM FIELD HERE"
tag_watermarked_prefix = "Preview: "
' You shouldn't need to edit any of the below script
' -----------------------------------------------------------------------------
' Ensure that cscript is executed instead of wscript - otherwise status
' messages will appear in popups instead of console window.
If LCase(Right(Wscript.FullName, 11)) = "wscript.exe" Then
strPath = Wscript.ScriptFullName
strCommand = "%comspec% /k cscript """ & strPath & """"
Set objShell = CreateObject("Wscript.Shell")
objShell.Run(strCommand), 1, True
Wscript.Quit
End If
Dim wshshell, filesys, folder, files_collection, filecount, filename
Dim mp3counter, oggcounter, outputfile
Dim tag_artist, tag_title, tag_genre, tag_year
oggcounter = 0
mp3counter = 0
wscript.echo "Begin encoding process."
Set wshshell = WScript.CreateObject("WScript.Shell")
Set filesys = CreateObject("Scripting.FileSystemObject")
' ## Ensure that the output directories exists, if not then create them
if not filesys.FolderExists( destination_mp3_original ) then _
filesys.CreateFolder destination_mp3_original
if not filesys.FolderExists( destination_ogg_original ) then _
filesys.CreateFolder destination_ogg_original
if not filesys.FolderExists( destination_mp3_watermarked ) then _
filesys.CreateFolder destination_mp3_watermarked
if not filesys.FolderExists( destination_ogg_watermarked ) then _
filesys.CreateFolder destination_ogg_watermarked
' ## Encode Original (non-watermarked) files ##################################
Set folder = filesys.GetFolder(source_folder & "\.")
Set files_collection = folder.Files
filecount = files_collection.Count
for each file in files_collection
' ## Only process WAV files
filename = file.name
if lcase(right(filename,4))=".wav" then
' ## Set tags based on the filename
' ## Source File Name Format: Artist Name_Song Name_Music Genre_Year
tag_artist = GetParam(filename,0)
tag_title = GetParam(filename,1)
tag_genre = GetParam(filename,2)
tag_year = GetParam(filename,3)
' ## Create web friendly name for output file (artist-name-song-name)
outputfile = WebFriendlyName(GetParam(filename,0) & " - " & _
GetParam(filename,1) ,0,0)
' ## MP3 Encoding ---------------------------------------------------------
' ## Create option string for MP3 meta tags
optstr = ""
optstr = optstr & " --title " & """" & tag_title & """"
optstr = optstr & " --artist " & """" & tag_artist & """"
optstr = optstr & " --comment " & """" & tag_comment & """"
optstr = optstr & " --genre " & """" & tag_genre & """"
optstr = optstr & " --year " & """" & tag_year & """"
optstr = optstr & " --album " & """" & tag_album & """"
optstr = optstr & " --user-url " & """" & tag_url & """"
optstr = optstr & " --frame TCOM:" & """" & tag_composer_name & """"
optstr = optstr & " --frame TENC:" & """" & tag_encoder_name & """"
optstr = optstr & " --frame TPUB:" & """" & tag_publisher_name & """"
optstr = optstr & " --frame TCOP:" & """" & tag_copyright_name & """"
' ## Only encode the MP3 file if it doesn't already exist
if not filesys.FileExists( destination_mp3_original & "\" & _
outputfile & ".mp3" ) then
wscript.echo "Encoding Original mp3 with a bitrate of " & _
mp3_original_bitrate & "kbps: " & vbCrLf & _
" " & outputfile & ".mp3" & vbCrLf
' ## Use Lame to encode the mp3 file
wshshell.Run "lame.exe -b " & mp3_original_bitrate & _
" -c """ & source_folder & "\" & filename & """ " & _
"""" & destination_mp3_original & "\" & outputfile & _
".mp3""",0,true
' ## Use Metamp3 to create the mp3 tag
wshshell.Run "metamp3.exe " & optstr & " """ & _
destination_mp3_original & "\" & outputfile & _
".mp3""",0,true
mp3counter = mp3counter + 1
end if
' ## OGG Encoding ---------------------------------------------------------
' ## Create option string for OGG meta tags
optstr = ""
optstr = optstr & " --title " & """" & tag_title & """"
optstr = optstr & " --artist " & """" & tag_artist & """"
optstr = optstr & " --comment " & """" & tag_comment & """"
optstr = optstr & " --genre " & """" & tag_genre & """"
optstr = optstr & " --year " & """" & tag_year & """"
optstr = optstr & " --album " & """" & tag_album & """"
optstr = optstr & " -t URL=" & """" & tag_url & """"
optstr = optstr & " -t COMPOSER=" & """" & tag_composer_name & """"
optstr = optstr & " -t PUBLISHER=" & """" & tag_publisher_name & """"
optstr = optstr & " -t COPYRIGHT=" & """" & tag_copyright_name & """"
' ## Only encode the OGG file if it doesn't already exist
if not filesys.FileExists( destination_ogg_original & "\" &_
outputfile & ".ogg" ) then
wscript.echo "Encoding Original ogg with a bitrate of " & _
ogg_original_bitrate & "kbps: " & vbCrLf & _
" " & outputfile & ".ogg" & vbCrLf
' ## Use Oggenc to encode the ogg file
wshshell.Run "oggenc.exe -b " & ogg_original_bitrate & _
" --output=""" & destination_ogg_original & "\" & _
outputfile & ".ogg"" """ & source_folder & "\" & _
filename & """",0,true
' ## Use Tag to create the ogg tag
wshshell.Run "Tag.exe " & optstr & " """ & destination_ogg_original & _
"\" & outputfile & ".ogg""",0,true
oggcounter = oggcounter + 1
end if
end if
next
' ## Encode Watermarked files #################################################
Set folder = filesys.GetFolder(source_watermarked_folder & "\.")
Set files_collection = folder.Files
filecount = files_collection.Count
for each file in files_collection
' ## Only process WAV files
filename = file.name
if lcase(right(filename,4))=".wav" then
' ## Set tags based on the filename
' ## Source File Name Format: Artist Name_Song Name_Music Genre_Year
tag_artist = GetParam(filename,0)
tag_title = tag_watermarked_prefix & GetParam(filename,1)
tag_genre = GetParam(filename,2)
tag_year = GetParam(filename,3)
' ## Create web friendly name for output file (artist-name-song-name)
outputfile = WebFriendlyName(GetParam(filename,0) & " - " & _
GetParam(filename,1) ,0,0)
' ## MP3 Encoding ---------------------------------------------------------
' ## Create option string for MP3 meta tags
optstr = ""
optstr = optstr & " --title " & """" & tag_title & """"
optstr = optstr & " --artist " & """" & tag_artist & """"
optstr = optstr & " --comment " & """" & tag_comment & """"
optstr = optstr & " --genre " & """" & tag_genre & """"
optstr = optstr & " --year " & """" & tag_year & """"
optstr = optstr & " --album " & """" & tag_album & """"
optstr = optstr & " --user-url " & """" & tag_url & """"
optstr = optstr & " --frame TCOM:" & """" & tag_composer_name & """"
optstr = optstr & " --frame TENC:" & """" & tag_encoder_name & """"
optstr = optstr & " --frame TPUB:" & """" & tag_publisher_name & """"
optstr = optstr & " --frame TCOP:" & """" & tag_copyright_name & """"
' ## Only encode the MP3 file if it doesn't already exist
if not filesys.FileExists( destination_mp3_watermarked & "\" & _
outputfile & ".mp3" ) then
wscript.echo "Encoding Watermarked mp3 with a bitrate of " & _
mp3_watermarked_bitrate & "kbps: " & vbCrLf & _
" " & outputfile & ".mp3" & vbCrLf
' ## Use Lame to encode the mp3 file
wshshell.Run "lame.exe -b " & mp3_watermarked_bitrate & _
" -c """ & source_watermarked_folder & "\" & filename & """ " & _
"""" & destination_mp3_watermarked & "\" & outputfile & _
".mp3""",0,true
' ## Use Metamp3 to create the mp3 tag
wshshell.Run "metamp3.exe " & optstr & " """ & _
destination_mp3_watermarked & "\" & outputfile & _
".mp3""",0,true
mp3counter = mp3counter + 1
end if
' ## OGG Encoding ---------------------------------------------------------
' ## Create option string for OGG meta tags
optstr = ""
optstr = optstr & " --title " & """" & tag_title & """"
optstr = optstr & " --artist " & """" & tag_artist & """"
optstr = optstr & " --comment " & """" & tag_comment & """"
optstr = optstr & " --genre " & """" & tag_genre & """"
optstr = optstr & " --year " & """" & tag_year & """"
optstr = optstr & " --album " & """" & tag_album & """"
optstr = optstr & " -t URL=" & """" & tag_url & """"
optstr = optstr & " -t COMPOSER=" & """" & tag_composer_name & """"
optstr = optstr & " -t PUBLISHER=" & """" & tag_publisher_name & """"
optstr = optstr & " -t COPYRIGHT=" & """" & tag_copyright_name & """"
' ## Only encode the OGG file if it doesn't already exist
if not filesys.FileExists( destination_ogg_watermarked & "\" &_
outputfile & ".ogg" ) then
wscript.echo "Encoding Watermarked ogg with a bitrate of " & _
ogg_watermarked_bitrate & "kbps: " & vbCrLf & _
" " & outputfile & ".ogg" & vbCrLf
' ## Use Oggenc to encode the ogg file
wshshell.Run "oggenc.exe -b " & ogg_watermarked_bitrate & _
" --output=""" & destination_ogg_watermarked & "\" & _
outputfile & ".ogg"" """ & source_watermarked_folder & _
"\" & filename & """",0,true
' ## Use Tag to create the ogg tag
wshshell.Run "Tag.exe " & optstr & " """ & _
destination_ogg_watermarked & _
"\" & outputfile & ".ogg""",0,true
oggcounter = oggcounter + 1
end if
end if
next
' ## Finished - echo how many files were encoded
if mp3counter + oggcounter = 0 then
wscript.echo "No files were encoded."
wscript.echo "If the output files already exist they are not overwritten."
wscript.echo "Delete them first if you wish re-encode them."
else
wscript.echo "Encoding script reporting that all is done!"
wscript.echo mp3counter & " mp3 files and " & oggcounter & " ogg files encoded"
end if
' Supporting function that gets a parameter from a file name using the
' character _ as a delimiter
Function GetParam(thestring, theparam)
dim returnstring, currentparam
for i=1 to len(thestring)
if mid(thestring,i,1) = "_" then
currentparam=currentparam+1
else
if theparam = currentparam then
returnstring=returnstring + mid(thestring,i,1)
end if
end if
next
if lcase(right(returnstring,4)) = ".wav" then _
returnstring=left(returnstring,len(returnstring)-4)
GetParam = trim(returnstring)
end function
' Ugly supporting function that washes the file name to a "web friendly" file
' name... I would use regexp for this but VBScript is quite limited by default.
Function WebFriendlyName(filename, prefixlength, extlength)
WebFriendlyName = lcase(filename)
WebFriendlyName = right(WebFriendlyName , len(WebFriendlyName )-prefixlength)
WebFriendlyName = left(WebFriendlyName , len(WebFriendlyName )-extlength)
WebFriendlyName = replace(WebFriendlyName , " - ", "-")
WebFriendlyName = replace(WebFriendlyName , "[", "")
WebFriendlyName = replace(WebFriendlyName , "]", "")
WebFriendlyName = replace(WebFriendlyName , "(", "")
WebFriendlyName = replace(WebFriendlyName , ")", "")
WebFriendlyName = replace(WebFriendlyName , ".", "")
WebFriendlyName = replace(WebFriendlyName , " ", " ")
WebFriendlyName = replace(WebFriendlyName , " ", " ")
WebFriendlyName = replace(WebFriendlyName , " ", " ")
WebFriendlyName = replace(WebFriendlyName , " ", "-")
End Function