/spc2wav

Converts SPC to WAV using Blargg's snes_spc library

Primary LanguageCMIT LicenseMIT

spc2wav

This is just a small CLI program for decoding an SPC file into a WAV file, using Blargg's snes_spc library.

It uses a higher amplification level compared to most SPC decoders, this can be controlled via CLI with the --amp flag.

The default amplification level is 384, most players/decoders based on snes_spc default to 256

You can also opt to use the amplification tag found in some SPC files. This is exceedingly rare, and I'll be honest, I'm not sure if it should be honored.

You can also enable ID3 tags with the --id3 switch.

Building

snes_spc and id666 should be available as shared or static libraries.

I have a fork of snes_spc available that incorporates some fixes from the game-music-emu library, and includes a Makefile suitable for building a library and installing headers.

Alternatively, here's a small Makefile that can be used with snes_spc version 0.9.0. Unzip snes_spc-0.9.0.zip and place this into a Makefile in the snes_spc-0.9.0 folder, then run make and make install.

.PHONY: all clean install

CFLAGS = -I. -O2 -fPIC -Wall -Wextra -Wno-implicit-fallthrough -DNDEBUG -DBLARGG_BUILD_DLL
CXXFLAGS = -I. -O2 -fPIC -fno-exceptions -Wno-implicit-fallthrough -fno-rtti -Wall -Wextra -std=c++98 -DNDEBUG -DBLARGG_BUILD_DLL

STATIC_PREFIX=lib
DYNLIB_PREFIX=lib
STATIC_EXT=.a
DYNLIB_EXT=.so

SPC_A = $(STATIC_PREFIX)spc$(STATIC_EXT)
SPC_SO = $(DYNLIB_PREFIX)spc$(DYNLIB_EXT)

DESTDIR=
PREFIX=/usr/local
LIBDIR=$(DESTDIR)$(PREFIX)/lib
INCDIR=$(DESTDIR)$(PREFIX)/include/snes_spc

all: $(SPC_A) $(SPC_SO)

SPC_CPP_SRCS = \
  snes_spc/SPC_Filter.cpp \
  snes_spc/SNES_SPC.cpp \
  snes_spc/SNES_SPC_misc.cpp \
  snes_spc/SNES_SPC_state.cpp \
  snes_spc/SPC_DSP.cpp \
  snes_spc/spc.cpp \
  snes_spc/dsp.cpp

SPC_CPP_OBJS = $(SPC_CPP_SRCS:.cpp=.o)

SPC_HEADERS = snes_spc/spc.h

$(SPC_A): $(SPC_CPP_OBJS)
	$(AR) rcs $@ $^

$(SPC_SO): $(SPC_CPP_OBJS)
	$(CXX) -shared -o $@ $^

clean:
	rm -f $(SPC_CPP_OBJS) $(SPC_A) $(SPC_SO)

install: $(SPC_A) $(SPC_SO)
	install -d $(LIBDIR)/
	install -m 644 $(SPC_A) $(LIBDIR)/$(SPC_A)
	install -m 755 $(SPC_SO) $(LIBDIR)/$(SPC_SO)
	install -d $(INCDIR)/
	install -m 644 $(SPC_HEADERS) $(INCDIR)/

LICENSE

MIT