Not Understanding Command Line & Scripting Use...
I'm trying to create an advanced encoding script to process multiple files at once, but I am unable to get even one file to convert successfully this way. I'm not understanding some of the documentation and have some questions:
From the wiki, the heading on creating WAV files seems straightforward enough:
# Create a wav file
spcplay.exe -wav [[-s <channels: 1-8>]/[-m <channels: 1-8>]] [-v <volume %>]
[-o <.wav file path>] [-f] <.spc file path>
If I understand correctly, -wav is the command instructing SPC Play to encode as WAV, -s is for stereo and -m is for mono and both are represented by an integer (1-8), and -v is represented by an integer (1-100). Assuming I am understanding correctly, then an example should look like this:
spcplay -wav -s 8 -v 100 -o output.wav -f input.spc
If this is correct, the example script from the wiki is a bit confusing, and trying to implement it as well as making my own adjustments yields no success:
start spcplay.exe
timeout 1
FOR %%I IN (1 2 3 4 5 6 7 8) DO spcplay.exe -wav -s %%I -o output-%%I.wav input.spc
- I don't understand why the first two lines are used here if the third line already executes spcplay.exe...
- In a
forloop in Batch, the first parenthesis is used for the argument, and is usually whatever the input would be, so I don't understand what1 2 3 4 5 6 7 8is doing here... - I suppose this is more subjective, but typically in similar uses, the input file is provided before the output file in a command, so
-ocoming before-fis also confusing... I did try swapping the order, but it made no difference.
From my experience in writing scripts, how this would look in any other instance would be more like the following:
for %%i in (
input.spc
) do (
spcplay -wav -s 8 -v 100 -f %%i -o output.wav
)
Trying it this way also does not work. Worth noting, irrespective of how I write or rearrange my code, a consistent problem is that the script returns the following error:
Windows cannot find '-wav'. Make sure you typed the name correctly, and then try again.
This may be due to my use of double quote-wrapping things, but this is also necessary in Windows with scripting or commands if a path or file name contains spaces at any point.
I have even tried the following code, with all files specified in the working directory with no luck:
spcplay -wav -s 8 -v 100 -o title.wav -f title.spc
SPC Play runs but returns error 201.
Hi, @MrMendelli
-sis for stereo and-mis for mono
That is incorrect.
-s switch means 'solo channel part', and -m switch means 'mute channel part'.
SNES music is made up of 8 instruments, and these specify which part numbers to output.
I don't understand why the first two lines are used here if the third line already executes spcplay.exe...
This is because 'spcplay.exe' is GUI application (not a full console), so calling method is a little different from usual. The 1st line starts spcplay.exe with GUI mode, and the 3rd line commands it to create a wav file. Well, I know it would be easier to use if implemented better, but it is completely my own laziness.
the input file is provided before the output file in a command, so -o coming before -f is also confusing...
The specifications enclosed in [ ] mean that they are 'optional'.
So if you just want to convert spc to wav, the following command will suffice:
spcplay -wav title.spc
There is not enough explanation for each switch, I will add it to the wiki later.
I have even tried the following code, with all files specified in the working directory with no luck: SPC Play runs but returns error 201.
Try run a command after spcplay.exe running (not close window).
Thank you for taking the time to take a look at this issue and explaining. I did try your more simplified suggestion (including the prerequisite lines of code), but there still seems to be no encoding being done here. I even used simple names and had everything involved all within the working directory to factor out as many externalities that may have been adversely affecting my original code. SPCPlay did run, but had no indication of loading the file I specified.
As for why your program works this way, I can understand, though at the same time full CLI functionality would be greatly appreciated should you ever find the desire or time to implement it. I'd offer but I am still learning...
Hi, @MrMendelli
Thank you for trying it.
I found the cause, it works if include the extension, like spcplay.exe instead of spcplay.
start /wait spcplay.exe -wav title.spc
I think this is a bug, I am sorry to bother you. I will fix this later, including CLI-like behavior.
Very appreciated, thank you.
Hi, @MrMendelli
Since v2.21.3 (build 8916), SPCPLAY allows you to create a WAVE file using the CUI mode without having to start the GUI mode first.
Note, you still need to use start /wait at the beginning after updated new version, because SPCPLAY is a GUI application.
I have also fixed a bug that WAVE file creation not working when omitting the extension of SPCPLAY.EXE.
https://github.com/dgrfactory/spcplay/releases
Hi, @MrMendelli
Since v2.21.3 (build 8916), SPCPLAY allows you to create a WAVE file using the CUI mode without having to start the GUI mode first. Note, you still need to use
start /waitat the beginning after updated new version, because SPCPLAY is a GUI application. I have also fixed a bug that WAVE file creation not working when omitting the extension of SPCPLAY.EXE.https://github.com/dgrfactory/spcplay/releases
Thank you @dgrfactory , I'll give the new release a try as soon as I have the time.