Benben v0.6.0 has been released

YunoSynth is a high-performance VGM playback library written entirely in Crystal. VGM files are sample-accurate music files ripped from video games. Rather than containing audio data like an MP3 or WAV file, they contain a log of the instructions that are sent to sound chips in these old game consoles and machines. This makes them much smaller (38 KB for the song below, versus what would be a 5.3 MB 192kbit MP3). YunoSynth is made up of a playback core that sends VGM instructions to various sound chip emulators that then produce PCM output.

The initial 0.1.0 release supports a large number of chips, but it’s still lacking a few chips supported by the VGM specification. My plan is to continue adding additional chips as time goes on until they are all supported. If you download any VGM files, just check the YunoSynth page to see if its chips are supported. Currently, you can play music from many arcade games, the PC Engine/TurboGrafx-16, NeoGeo, GameBoy, PC-88 and PC-98 computers, MSX2 computer, and Sharp X68000 computer.

Benben, meanwhile, is a command line player that uses YunoSynth. The program itself is written entirely in Crystal as well, though it does use bindings to PulseAudio and PortAudio to connect to your audio system. It can be used as a standalone player, and has optional effects that you can enable at will, such as a parametric EQ with unlimited bands, a configurable reverb effect, and stereo enhancement (these are also all pure Crystal lol).

Aside from playback, it’s also capable of rendering VGM files to both WAV and Au format. This is done in parallel, so the more cores you have, the faster it’ll work.

Here’s an example video where Benben is playing a song from a game called Rusty. This game is from an old Japanese computer system called the PC-98, and uses a Yamaha YM2608 for FM synthesis and ADPCM sample playback. There are more sample videos listed in the readme.

A pre-compiled x86-64 Linux binary in the form of an AppImage is available in the repo: Download v0.1.0

EDIT: v0.4.0 released: Benben v0.6.0 has been released - #4 by MistressRemilia

EDIT: v0.5.0 release candidates are now available: Benben v0.6.0 has been released - #5 by MistressRemilia

29 Likes

Holy F**king ***t !

This is abslutely incredible work.

And not only that:

  • clean code with comments
  • project split in reasonable parts, usable seperately
  • with documentation and example usage code
  • links and explanations to everything neccessary.
  • even a precompiled appimage is available.

Absolutely wowed. Thank you!

2 Likes

That is absolutely remarkable! Stunning work. I downloaded the AppImage build and it works flawlessly right out of the box (using Pipewire’s PulseAudio interface). Tested a couple of Atari ST and arcade soundtracks using a range of synth chips. Just… wow. What an incredible showcase for Crystal – this thing just works, is easy to use, looks great and doesn’t crash (like some of the old C-based Winamp plugins I used to use for playback of PSF/miniPSF files etc).

3 Likes

Guess I forgot to post some updates here ^_^;

I’ve released v0.4.0 of Benben and YunoSynth today! They have had a TON of new stuff added since v0.1.0, so I’ll just summarize some of the cooler stuff here:

  • A bunch of new chip emulators: YM2612 (aka, Sega Genesis), SN764xx (also used in the Sega Genesis), YM3812, YMF262 (IBM PC), RF5C164, VSU-VUE (aka, Virtual Boy), ES5503, Y8950 (MSX), YM3526, NES, Famicom Disk System, X1-010, SAA1099, Sega 32x PWM, Wonderswan.
  • A new snazzy interface that uses my S-Lang bindings. It also shows the CPU usage now.
  • Improved performance throughout.
  • Redesigned to be more multi-threaded internally.
  • Support for libao output in addition to PulseAudio and PortAudio.
  • Optional automatic peak normalization when rendering to WAV or Au.
  • Generation of CUE files when rendering to WAV/Au.
  • The emulator/sound/player code is still 100% Crystal. The only bindings here are S-Lang, ZStandard, and the audio outputs (e.g. PortAudio).

A Linux x86-64 AppImage is available for download like usual.

14 Likes

Benben v0.5.0 is almost ready for release! The code is in a freeze right now, with only bug fixes going in. I’ve been releasing Linux x86-64 AppImages of each release candidate on the Releases page, or you can just build from source. There’s also a FAQ page now.

This is a huge update that introduces a bunch of new features.

  • Benben is now a general-purpose music player
    • VGM support is still in-place and is 100% native Crystal
    • MPEG-1 support (so .mp3, .mp2, and .mp1 files)
    • Module/tracker support (.s3m, .mod, .xm, etc.)
    • FLAC support (100% native Crystal)
    • Opus support
    • Ogg Vorbis support (demuxer is native Crystal)
    • MIDI support (native Crystal)
    • Playback of WAV and Au (native Crystal)
    • High quality resampling for MPEG-1/FLAC/Opus/WAV/Au/Ogg files via a native port of libsamplerate to Crystal
  • Theme support
  • More startup animations added
  • Seeking support for MP3, MP2, MP1, RIFF WAV, module files, and Au files added. Support for seeking in other formats will come in the future.
  • ReplayGain support for MPEG-1, Vorbis, Opus, and FLAC files
  • Improved metadata display (things scroll now)
  • Full changelog

Example video where it’s playing a tracker/module file (S3M) that I really like.

The finalized v0.5.0 release will come at the end of July. Enjoy :D

15 Likes

Sick !! Good music too!!

1 Like

Now it is time to find music from my fav games back in 80ies on Yamaha MSX/MSX2.

I loved Arkanoid, Wiz, Kings Valley, and music on them.

2 Likes

Good news! https://vgmrips.net/packs/system/ascii/msx2

2 Likes

Does Lemmings count?

1 Like

Take your pick lemmings • VGMRips

1 Like

Just for mention, if built with -Dstrict_multi_assign -Dno_number_autocast, will failed with:

In lib/libremiliacr/src/remilib/compression/bzip/divsufsort.cr:2245:46

 2245 | bucketB[DivSufSort.bucketBStar(@t[i], @t[i + 1])] += 1
                                         ^
Error: expected argument #1 to 'RemiLib::Compression::BZip2::DivSufSort.bucketBStar' to be Int32, not UInt8

Overloads are:
 - RemiLib::Compression::BZip2::DivSufSort.bucketBStar(c0 : Int32, c1 : Int32)

And

In src/players/vgmplayer.cr:71:54

 71 | outputRateMul, outputRateDiv = Yuno::VgmPlayer.calcResampling(Benben.config.sampleRate, file.file)
                                                     ^-------------
Error: cannot assign Tuple(UInt32, UInt32, UInt32, UInt32) to 2 targets

Without set those option, built successful.

1 Like

Thanks for the report! I always forget about those flags ^_^; This has been fixed in the trunk code and the related libraries.

1 Like

Yesterday, I downloaded and ran the Benben binary. I found the BenBen logo flickering beautifully on the terminal.

1 Like

Benben v0.5.0 is now released! A Linux x86-64 AppImage is available, or you can just build from source . There’s also a FAQ page . Full release notes and downloads are here.

  • Updated YunoSynth to v0.4.4
  • Breaking change: The config file format has changed. You are encouraged to backup your current config, then let Benben create a fresh one that you then re-edit.
  • New: MP3, MP2, and MP1 support added.
  • New: Module file support added via RemiXMP. The interpolation mode can be changed at runtime with the i key.
  • New: FLAC file support added via RemiAudio.
  • New: Opus file support added.
  • New: Ogg Vorbis file support added.
  • New: MIDI file support added.
  • New: Playback of WAV and Au files added.
  • New: MPEG-1/FLAC/Opus/Ogg/PCM files are resampled using a high quality resampler based on libsamplerate when their sample rates do not match the player’s output rate.
  • New: Song-specific configs can be reloaded at run time with the C key.
  • New: theme support. If truecolor ANSI support isn’t working, and you know your terminal supports 24-bit colors, try setting the COLORTERM=truecolor environment variable before using Benben.
  • New: Added the --long-version argument.
  • New: More startup animations added.
  • New: Seeking support for MP3, MP2, MP1, RIFF WAV, module files, and Au files added. Support for seeking in other formats will come in the future.
  • New: ReplayGain support for MPEG-1, Vorbis, Opus, and FLAC files.
  • New: Added the --shuffle argument.
  • Change: The maximum sample rate is now 48KHz.
  • New: The code can now be compiled with -Dstrict_multi_assign and -Dno_number_autocast
  • New: A Texinfo manual is now available. You can view it online here as webpage or in PDF format.
9 Likes
  1. that is a massive update! very nice!
  2. thank you for providing a .appimage. I find them the best portable format for distro independence.
2 Likes

The first release candidate for v0.6.0 is now available! The new version is one again a very large update, with new features and a bunch of fixes. The big new additions are WavPack support, support for the QOA audio format (in native Crystal, no less), and support for Commodore 64 SID files. There’s also a new way to control Benben remotely.

Benben is now in a hard feature freeze for the upcoming release. Bug reports are very welcome ^_^

Summary
  • YunoSynth updated:
    • New: YM2413/VRC7 support added for VGM files (used in various Famicom and MSX2 games)
  • New: You can now play Commodore 64 SID files, including 2SID and 3SID formats. Support for the HVSC songlength’s database is also included.
  • New: Quite OK Audio (QOA) format support added.
  • New: WavPack format support added, including support for hybrid WavPack files.
  • New: Benben can now render to QOA format.
  • New: Benben can now render to WavPack format, including hybrid WavPack files.
  • New: Benben can now be controlled remotely (see --remote).
  • New: TCP audio output driver to send audio over a TCP connection.
  • New: The --scan-only argument has been added, which tells Benben to scan files at startup like normal, then exit before playing anything.
  • New: You can now type a capital P to toggle repeating the song queue during playback.
  • New: You can now type a capital I to display extended information about the state of the effects stack and resampler.
  • Enhancement: String allocations reduced throughout for lower memory usage.
  • Enhancement: You can now specify either a single theme, or an array of themes, in the config file. When it’s an array, a random one out of that array will be chosen.
  • Enhancement: If the terminal is larger than 80x24, the play queue will expand to fill the empty space (it previously expanded horizontally, but not vertically).
  • Enhancement: Normalization now happens in parallel as jobs are being rendered. This slightly improves performance.
  • Enhancement: The terminal title is now set to the title or filename of the currently playing song.
  • Enhancement: The colors of the bars above and below the banner can now be themed.
  • Enhancement: The current theme can now be reloaded while the program is running. This should aid in theme development.
  • Enhancement: The soft-clipping effect can now have optional oversampling applied, up to an absurd 65535x (default is just 1x, as before).
  • Enhancement: Support for FLACs that are encapsulated in Ogg containers added.
  • Enhancement: Seeking support for Ogg Vorbis and Opus files.
  • Enhancement: Faster Ogg demuxing.
  • Removed: HTTP/HTTPS support and Gemini support has been removed. These may be added back in the future, however. This was only supported by VGM files anyway.
  • Fixed (partially): The progress bar when rendering is now slightly more accurate. The inaccuracy would almost never, ever be noticed, however.
  • Fixed: The screen now consistently redraws properly when resizing the window, and when Ctrl-Z/SIGTTSP is used.
  • Fixed: Module files would not be resampled correctly if the output rate was not 44100.
  • Fixed: MPEG-1 files that are being resampled no longer cut off early.
  • Fixed: PCM files that are being resampled no longer cut off early.
  • Fixed: Progress bar positions are now reported correctly for FLAC files when resampling.
  • Fixed: Progress bar positions are now reported correctly for MPEG-1 files when resampling.
  • Fixed: Progress bar positions are now reported correctly for PCM files when resampling.
  • Fixed: Progress bar positions are now reported correctly for module files when resampling.
  • Fixed: A possible crash when resizing the terminal window.
  • Fixed: A possible crash/deadlock with the error “Logger not yet started”.

The source code is available here in the repository. There are also x86-64 AppImages for Linux available on the releases page. Just grab the RC1 AppImage near the bottom to try out the new release candidate.

8 Likes

each time entrying benben project folder, always forget this project use fossil

1 Like

haha yeah… so are most of its dependencies. Easiest way to get the trunk code:

$ fossil checkout trunk
$ fossil up

Or use one of the tags:

$ fossil tag list
# ... copious output ...
$ fossil checkout <desired tag>

Finally, v0.6.0 of Benben, my Crystal-based music player, is released! :tada: Major new features in include: support for the WavPack format (normal and “hybrid” files), QOA format support, Commodore 64 SID support, remote control via the new remote-benben program, sending audio over TCP, and exporting to both WavPack and QOA.

Linux x86-64 AppImages, links to the manual, instructions for building from source, and the full changelog are all here: https://chiselapp.com/user/MistressRemilia/repository/benben/technote?name=55d45abe77896645681dce2de2dee3aeac349c17

FAQ: https://chiselapp.com/user/MistressRemilia/repository/benben/wiki?name=fqa


5 Likes