Find a file
2025-08-15 05:18:17 +05:00
m4 v1.0.1: The GNU Autotools devolution 2025-07-26 00:17:55 +05:00
src improve performance on extreme throw frequencies 2025-08-15 04:48:11 +05:00
.gitignore beginning of a garbage software 2025-07-17 12:52:56 +05:00
configure.ac Update for 1.1.1 2025-08-15 05:18:17 +05:00
env.sh v1.0.6: fix NaN handling etc 2025-08-01 11:14:48 +05:00
example-song.js subtitle 2025-08-10 08:45:02 +05:00
LICENSE add license read me 2025-07-19 20:08:11 +05:00
Makefile.am Smh my head 2025-07-26 05:50:34 +05:00
meson.build Update for 1.1.1 2025-08-15 05:18:17 +05:00
parse.js i forgot what this commit includes 2025-07-23 02:35:00 +05:00
parse.sh fancy pants ahead of time processing 2025-07-18 23:48:48 +05:00
README.md erm... 2025-07-26 05:38:30 +05:00

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.