m4 | ||
src | ||
.gitignore | ||
configure.ac | ||
env.sh | ||
example-song.js | ||
LICENSE | ||
Makefile.am | ||
meson.build | ||
parse.js | ||
parse.sh | ||
README.md |
libbytebeat
A bytebeat playback library (no
affiliation with the linked site). Can be embedded in a C
application via the C API or in a JavaScript one by vendoring
src/bblib.js
. Features:
- seems to work
- custom metadata format
- automatically fixes DC offset with a high-pass filter
- two-phase multithreaded playback (does not work with some songs, but they can be adapted to the two-phase system). First phase generates samples and possibly a numbers array of auxiliary data and is multithreaded, second phase is single-threaded, linear, processes generated samples further. First-phase is expected to be a pure function and should not depend on side effects from previous samples (except the 0th one), second phase may do this however and is thus useful for reverbs and other filters.
Try it out
Build it (dependencies: webkitgtk, glib, GNU Autotools):
autoreconf --install &&
mkdir -p build && cd build &&
../configure && make
If building from the dist tarball, autoreconf --install
and
GNU Autotools are not needed to build. You can also build in current
directory rather than creating a separate one, but i prefer the latter.
Run it:
build/bytebeat-gen < example-song.js | ./parse.sh
Or (no build required):
node parse.js example-song.js
The "parse" scripts use mpv, so you should have it installed for them to work.
C API
see src/bytebeat.h
, also src/bytebeat-gen.c
for an example usage
Exotic ByteBeat APIs
p2f(function(t, sampleRate, p1Sample, p2s_numbers) { ... })
: Register
a function for the second phase.
p2s(type: "u8"|"u16"|...|"i8"|...|"f32"|"f64", ...numbers)
: Pass data
to the function registered with p2f
.