Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

SPC to WAV command-line

Writer Matthew Harrington

For example, these types of .SPC files:random SPC and WAV folder

I don't want it to bring a window in the foreground, just an invisible process that will convert an SPC to a WAV.

executable foo/bar/input.spc bar/foo/output.wav

I'm using this in a command-line Java application, so a Java solution would be appreciated if possible. (I can use ProcessBuilder to run the executable if not.)

1 Answer

How convenient! FFMPEG can read and convert SPC files!

ffmpeg -i night1.spc -acodec pcm_u8 -ar 44100 night1.wav

Now, this command will convert your file pretty cleanly, and will spit out a nice .wav file (be sure to replace night1.spc and night1.wav with whatever you want the filenames to be).

Unfortunately, this does not end the story in the slightest. After running the above command for a while, I got the following result:

-rw-rw-r-- 1 kazwolfe kazwolfe 297M Mar 28 02:05 night1.wav
-rw-rw-r-- 1 kazwolfe kazwolfe 65K Mar 28 02:01 night1.spc

This can't be right... let's pop open the file in Audacity and see what's going on:

In short, SPC files don't have a length defined in them. While there is a mention of length in the spec, it seems to be often ignored, and actually is ignored in the files uploaded to your Google Drive.

SPC files, as ripped from the SNES (in its original format) were meant to loop pretty much forever. As such, when they're played (or converted in this case), they're going to also loop forever.

So, we need to manually pass in the length (and possibly offset) to ffmpeg. Fortunately, the program comes with a cool little command line argument called -t <time>. Using this, we can specify how much audio we want to convert.

Similarly, if the file has an offset, we can use the -ss <time> argument to specify how far from the beginning we want to clip.

Therefore, assuming a 45 second file with an offset of 5 seconds, the command we need to run is:

ffmpeg -i night1.spc -t 00:00:45 -ss 00:00:05 -acodec pcm_u8 -ar 44100 night1.wav
7

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy