1
0
mirror of https://github.com/ScrelliCopter/VGM-Tools synced 2025-02-21 04:09:25 +11:00

Compare commits

11 Commits

Author SHA1 Message Date
6d60ea91c0 update README.md 2019-09-27 16:16:50 +10:00
6164533c1a port autoextract to shell 2019-09-27 15:58:08 +10:00
7c5a577fba makefile for crappy vgm pcm scanner util 2019-09-26 22:54:08 +10:00
7e0740d03a adpcm decoders compiling on loonix 2019-09-26 22:06:51 +10:00
c1a5003a82 batch should be crlf I guess 2019-09-26 14:53:40 +10:00
1969f7ae9a add spc2it manpage from upstream 2019-09-26 14:43:11 +10:00
33851696b1 move relevant gitignore 2019-09-26 14:24:37 +10:00
7aff052810 fix spelling mistake 2019-09-26 14:22:28 +10:00
85a3e5089b update spc2it README 2019-09-26 14:19:39 +10:00
508f464aa7 housekeeping 2019-09-26 14:06:37 +10:00
86317f57ec create plain makefile for spc2it 2019-09-26 14:01:18 +10:00
17 changed files with 236 additions and 153 deletions

7
.gitignore vendored
View File

@@ -1,6 +1 @@
*.exe .idea/
*.vgm
*.vgz
*.log
*.pcm
*.wav

11
neotools/.gitignore vendored Normal file
View File

@@ -0,0 +1,11 @@
*.exe
*.vgm
*.vgz
*.log
*.pcm
*.wav
*.o
adpcm
adpcmb
neoadpcmextract

View File

@@ -1,32 +1,46 @@
Neo-Geo VGM tools Neo-Geo VGM tools
----------------- =================
A hodge-podge of tools for working on NG VGM files, A hodge-podge of tools for working on NG VGM files,
these files are provided in the hope that they may be useful to someone. these files are provided in the hope that they may be useful to someone.
Makefiles have currently not been tested but shouldn't be hard to get working.
Windows binaries are available under the Releases tab.
Included tools (sources included). Included tools (sources included).
- **adpcm.exe**: - **adpcm**:
ADPCM Type-A to WAV converter. ADPCM Type-A to WAV converter.
- **adpcmb.exe**: - **adpcmb**:
ADPCM Type-B encoding tool that also does decoding to WAV. ADPCM Type-B encoding tool that also does decoding to WAV.
- **neoadpcmextract.exe**: - **neoadpcmextract**:
Scans a .vgm and dumps all ADPCM type A&B data to raw .pcm files. Scans a .vgm and dumps all ADPCM type A&B data to raw .pcm files.
- **autoextract.bat**: - **autoextract**:
Convenience batch script that uses the above tools to dump all samples to WAVs. Convenience shell/batch script that uses the above tools to dump all samples to WAVs.
Building
--------
Linux:
```shell script
make -f adpcm.Makefile
make -f adpcmb.Makefile
make -f neoadpcmextract.Makefile
```
Windows:
- The updated Makefiles haven't been tested on Windows yet.
- Working Windows binaries are available from the [Releases](https://github.com/ScrelliCopter/VGM-Tools/releases) tab.
How to use How to use
---------- ----------
Copy your .vgz into this directory, drag it onto autoextract.bat, Linux:
the script will create a directory of the same name and dump all the converted samples there. - Run `./autoextract.sh` from this directory with a path to your .vgm or .vgz,
a directory for the song will be created containing wav samples.
Windows:
- You will need gzip.exe (provided with the aforementioned release).
- Copy your .vgm or .vgz into this directory, drag it onto autoextract.bat,
the script will create a directory of the same name and dump all the converted samples there.
That's all there is to it. That's all there is to it.
TODO TODO
---- ----
- Replace the batch script with something less shite (and actually cross-platform). - Unify all tools into one & obsolete the crappy glue scripts.
- Write a makefile for neoadpcmextract.
- Make this stuff build on Linux.

View File

@@ -1,70 +1,34 @@
# Standard makefile to use as a base for DJGPP projects # Standard makefile to use as a base for DJGPP projects (not anymore lol)
# By MARTINEZ Fabrice aka SNK of SUPREMACY # By MARTINEZ Fabrice aka SNK of SUPREMACY
# Programs to use during make # Programs to use during make
AR = ar LD := $(CC)
CC = gcc
LD = gcc
ASM = nasm
PACKER = upx
# Flags for debugging TARGET := adpcm
#DEBUG=1 SOURCE := adpcm.c
#SYMBOLS=1
# Flags for compilation # Flags for compilation
ASMFLAGS = -f coff CFLAGS := -fomit-frame-pointer -O3 -Werror -Wall \
ifdef SYMBOLS
CFLAGS = -o -mpentium -Wall -Werror -g
LDFLAGS = -s
else
CFLAGS = -fomit-frame-pointer -O3 -mpentium -Werror -Wall \
-W -Wno-sign-compare -Wno-unused \ -W -Wno-sign-compare -Wno-unused \
-Wpointer-arith -Wbad-function-cast -Wcast-align -Waggregate-return \ -Wpointer-arith -Wbad-function-cast -Wcast-align -Waggregate-return \
-pedantic \ -pedantic \
-Wshadow \ -Wshadow \
-Wstrict-prototypes -Wstrict-prototypes
LDFLAGS = LDFLAGS := -lm
endif
CDEFS =
ASMDEFS =
# Object files # Object files
MAINOBJS = OBJECT := $(SOURCE:%.c=%.o)
# Library files
MAINLIBS = obj/adpcm.a
# Make rules # Make rules
all: adpcm.exe all: $(TARGET)
adpcm.exe: $(MAINOBJS) $(MAINLIBS) $(TARGET): $(OBJECT)
$(LD) $(LDFLAGS) $(MAINOBJS) $(MAINLIBS) -o $@ $(LD) $(CFLAGS) $(LDFLAGS) $^ -o $@
src/%.asm: %.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
obj/%.o: src/%.c
$(CC) $(CDEFS) $(CFLAGS) -c $< -o $@
obj/%.oa: src/%.asm
$(ASM) -o $@ $(ASMFLAGS) $(ASMDEFS) $<
obj/%.a:
$(AR) cr $@ $^
# Rules to manage files # Rules to manage files
pack: adpcm.exe .PHONY: clean
$(PACKER) adpcm.exe
mkdir:
md obj
clean: clean:
del obj\*.o rm -f $(TARGET) $(OBJECT)
del obj\*.a
del obj\*.oa
del *.exe
# Rules to make libraries
obj/adpcm.a: obj/adpcm.o
# obj/decode.oa \

View File

@@ -1,8 +1,6 @@
#include <process.h>
#include <stdio.h> #include <stdio.h>
#include <mem.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include <io.h>
#define BUFFER_SIZE 1024*256 #define BUFFER_SIZE 1024*256
#define ADPCMA_VOLUME_RATE 1 #define ADPCMA_VOLUME_RATE 1
@@ -70,8 +68,11 @@ int main(int argc, char *argv[])
} }
adpcm_init(); adpcm_init();
Filelen = filelength(fileno(Fp1)); fseek(Fp1, 0, SEEK_END);
Filelen = ftell(Fp1);
fseek(Fp1, 0, SEEK_SET);
*((unsigned int*)(&RiffWave[4])) = Filelen*4 + 0x2C; *((unsigned int*)(&RiffWave[4])) = Filelen*4 + 0x2C;
*((unsigned int*)(&RiffWave[0x28])) = Filelen*4; *((unsigned int*)(&RiffWave[0x28])) = Filelen*4;

View File

@@ -4,7 +4,7 @@ CFLAGS = -O3
SRC = . SRC = .
OBJ = . OBJ = .
OUT_OBJ = $(OBJ)/adpcmb.exe OUT_OBJ = $(OBJ)/adpcmb
all: $(OUT_OBJ) all: $(OUT_OBJ)

View File

@@ -1,19 +1,19 @@
if ["%~x1"]==[".vgz"] goto vgztopcm else goto vgmtopcm if ["%~x1"]==[".vgz"] goto vgztopcm else goto vgmtopcm
:vgmtopcm :vgmtopcm
neoadpcmextract.exe %1 neoadpcmextract.exe %1
goto pcmtowav goto pcmtowav
:vgztopcm :vgztopcm
copy /y %1 temp.vgm.gz copy /y %1 temp.vgm.gz
gzip.exe -d temp.vgm.gz gzip.exe -d temp.vgm.gz
neoadpcmextract.exe temp.vgm neoadpcmextract.exe temp.vgm
del temp.vgm del temp.vgm
goto pcmtowav goto pcmtowav
:pcmtowav :pcmtowav
for /r %%v in (smpa_*.pcm) do adpcm.exe "%%v" "%%v.wav" for /r %%v in (smpa_*.pcm) do adpcm.exe "%%v" "%%v.wav"
for /r %%v in (smpb_*.pcm) do adpcmb.exe -d "%%v" "%%v.wav" for /r %%v in (smpb_*.pcm) do adpcmb.exe -d "%%v" "%%v.wav"
del "*.pcm" del "*.pcm"
mkdir "%~n1" mkdir "%~n1"
move "*.wav" "%~n1" move "*.wav" "%~n1"

19
neotools/autoextract.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/sh
FILE="$1"
NAME="$(basename "$FILE")"
WAVDIR="${NAME%%.*}"
if [ "${NAME##*.}" = "vgz" ]; then
cp "$FILE" "temp.vgm.gz"
gzip -d "temp.vgm.gz"
FILE="temp.vgm"
fi
./neoadpcmextract "$FILE"
mkdir -p "$WAVDIR"
for I in smpa_*.pcm; do ./adpcm "$I" "$WAVDIR/${I%%.*}.wav"; done
for I in smpb_*.pcm; do ./adpcmb -d "$I" "$WAVDIR/${I%%.*}.wav"; done
find . -type f -name "*.pcm" -exec rm -f {} \;
[ "$FILE" = "temp.vgm" ] && rm -f "temp.vgm"

View File

@@ -0,0 +1,12 @@
TARGET := neoadpcmextract
SOURCE := neoadpcmextract.cpp
CXXFLAGS := -O2 -pipe -Wall -Wextra
all: $(TARGET)
$(TARGET): $(SOURCE)
$(CXX) $(CXXFLAGS) $< -o $@
.PHONY: clean
clean:
rm -f $(TARGET)

View File

@@ -162,7 +162,7 @@ def readit(path, outpath):
smpNum = int.from_bytes(f.read(2), byteorder="little", signed=False) smpNum = int.from_bytes(f.read(2), byteorder="little", signed=False)
patNum = int.from_bytes(f.read(2), byteorder="little", signed=False) patNum = int.from_bytes(f.read(2), byteorder="little", signed=False)
# Cus spc2it has a tendancy to produce corrupted files... # Cus spc2it has a tendency to produce corrupted files...
if ordNum > 1024: return if ordNum > 1024: return
if smpNum > 4000: return if smpNum > 4000: return
if insNum > 256: return if insNum > 256: return

View File

@@ -1,7 +1,8 @@
_obj obj/
build/
spc2it spc2it
.DS_Store *.exe
Thumbs.db
*.spc *.spc
*.it *.it
lol .DS_Store
Thumbs.db

View File

@@ -1,22 +0,0 @@
language: c
compiler:
- gcc
- clang
before_install:
- sudo apt-get update -qq
- sudo apt-get install cmake
script: mkdir build && cd build && cmake .. && make
env:
global:
# The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
# via the "travis encrypt" command using the project repo's public key
- secure: "NuRR5ZZ/PC58JrBv+n2fzsLWORMFk1VDcn7KsixV0X8+4kQ/k5hsHZ2guafzNl6ASGeaslmTO3Qe6UOJNMpd9kyDlsVGLAA6fsu25Q/R7BReOhSpn1hVQIptgspYh8gagMETldOLl/w0udwRqKVROgcooWa+ltp1R8UGds2R1nM="
addons:
coverity_scan:
project:
name: "uyjulian/spc2it"
description: "spc to it"
build_command_prepend: "mkdir build && cd build && cmake .."
build_command: "make"
branch_pattern: coverity_scan

View File

@@ -10,8 +10,7 @@ set(spc2it_sources
it.h it.h
sneese_spc.h sneese_spc.h
sound.h sound.h
spc2ittypes.h spc2ittypes.h)
)
add_executable(spc2it ${spc2it_sources}) add_executable(spc2it ${spc2it_sources})
target_link_libraries(spc2it m) target_link_libraries(spc2it m)

42
spctools/spc2it/Makefile Normal file
View File

@@ -0,0 +1,42 @@
TARGET := spc2it
SOURCE := emu.c it.c main.c sound.c spc700.c
CFLAGS ?= -O2 -pipe
BUILD_CFLAGS := $(CFLAGS)
BUILD_LDFLAGS := $(CFLAGS) $(LDFLAGS) -lm
PREFIX := /usr/local
OBJDIR := obj
OBJECTS := $(patsubst %.c,$(OBJDIR)/%.o,$(SOURCE))
DEPENDS := $(OBJECTS:%.o=%.d)
default: all $(TARGET)
$(OBJDIR)/%.o: %.c | $(OBJDIR)
$(CC) $(BUILD_CFLAGS) -MMD -c $< -o $@
$(OBJDIR):
mkdir -p $@
$(TARGET): $(OBJECTS)
$(CC) $(BUILD_LDFLAGS) $^ -o $@
-include $(DEPENDS)
all: $(TARGET)
.PHONY: install
install: $(TARGET)
mkdir -p $(DESTDIR)$(PREFIX)/bin
cp $< $(DESTDIR)$(PREFIX)/bin/$(TARGET)
mkdir -p $(DESTDIR)$(PREFIX)/share/man/man1/
cp spc2it.1 $(DESTDIR)$(PREFIX)/share/man/man1/
.PHONY: uninstall
uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/$(TARGET)
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/spc2it.1
.PHONY: clean
clean:
rm -f $(TARGET) $(OBJECTS) $(DEPENDS)

49
spctools/spc2it/README.md Executable file
View File

@@ -0,0 +1,49 @@
SPC2IT
======
Convert SPC files to IT (Impulse Tracker) files.
## Compiling
With GNU make:
```bash
make -j$(nproc)
```
With CMake:
```bash
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)
```
## Installing
```bash
# Install to /usr/local by default
sudo make install
# Install to /usr instead
sudo make install PREFIX=/usr
```
## Running
Run `spc2it` (or `./sp2it` locally) with no arguments to see the syntax.
```
SPC2IT - converts SPC700 sound files to the Impulse Tracker format
Usage: spc2it [options] <filename>
Where <filename> is any .spc or .sp# file
Options: -t x Specify a time limit in seconds [60 default]
-d xxxxxxxx Voices to disable (1-8) [none default]
-r xxx Specify IT rows per pattern [200 default]
```
## More information
Cloned from: https://github.com/uyjulian/spc2it
For more information, read the documentation in `doc/`.
Also, see https://www.romhacking.net/forum/index.php?topic=10164.0

View File

@@ -1,29 +0,0 @@
Cloned from: https://github.com/uyjulian/spc2it
SPC2IT
======
Convert SPC files to IT (Impulse Tracker) files.
Compiling
=========
You need cmake.
> mkdir b && cd b && cmake .. && make
Running
=======
Enter the executable's path in the command line, then press enter to see the syntax.
Bugs
====
• None...
More information
================
For more information, read the documentation in ./doc/
Also, see http://www.romhacking.net/forum/index.php?topic=10164.0

27
spctools/spc2it/spc2it.1 Normal file
View File

@@ -0,0 +1,27 @@
.TH spc2it "1" "September 10 2018" "User Commands"
.SH NAME
spc2it \- converts SPC700 sound files to the Impulse Tracker format
.SH SYNOPSIS
.B spc2it
.RI [ options ] " filename"
.TP
Where <filename> is any .spc or .sp# file
.SH DESCRIPTION
This manual describes the
.B spc2it
command. It converts SPC files to IT (Impulse Tracker) files.
.TP
Options:
.TP
\fB\-t\fR x
Specify a time limit in seconds [60 default]
.TP
\fB\-d\fR xxxxxxxx Voices to disable (1\-8) [none default]
.TP
\fB\-r\fR xxx
Specify IT rows per pattern [200 default]
.IP
.SH "SEE ALSO"
.BR adplay (1),
.BR schismtracker (1).
.br