basic-pitch-wasm / src /Makefile
SegerEnd's picture
Basic Pitch without TensorFlow: C/WebAssembly runtime and demo
de6631a verified
Raw History Blame Contribute Delete
814 Bytes
# make the command-line tool (basicpitch) and a static library (libbp.a)
# make wasm ../basicpitch/bp.wasm and bp-plain.wasm, the model for the browser (notes.js does the rest)
CC ?= cc
CFLAGS ?= -O3
EXPORTS = _bp_load,_bp_unload,_bp_run,_bp_frame_count,_bp_transcribe,_bp_window_count,_bp_window,_malloc,_free
EMFLAGS = -O3 --no-entry -s STANDALONE_WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s EXPORTED_FUNCTIONS=$(EXPORTS)
all: basicpitch libbp.a
basicpitch: cli.c bp.c notes.c bp.h
$(CC) $(CFLAGS) cli.c bp.c notes.c -o $@ -lm
libbp.a: bp.c notes.c bp.h
$(CC) $(CFLAGS) -c bp.c notes.c
ar rcs $@ bp.o notes.o
wasm: bp.c bp.h
emcc $(EMFLAGS) -msimd128 bp.c -o ../basicpitch/bp.wasm
emcc $(EMFLAGS) bp.c -o ../basicpitch/bp-plain.wasm
clean:
rm -f basicpitch libbp.a *.o
.PHONY: all wasm clean