this post was submitted on 26 Apr 2024
64 points (97.1% liked)

Linux

48186 readers
1171 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

I thought I'd take the opportunity to share a Bash script I made to automate ripping music off CUE/BIN files. It splits BINs into separate files, so it's 1 file per track, and strips pregap data, encodes audio tracks to FLAC or Ogg Vorbis, and it also generates new CUE sheets.

Link to the script:

https://github.com/linux4ever07/scripts/blob/main/cuebin_extract.sh

The idea came to me some years ago when I noticed that GOG packaged some of their games in a dumb way. It was specifically DOS games (bundled with DOSBox) that had CD audio. They would include the original BIN file, but with a modified CUE sheet that would not let you access the high quality CD audio. On top of that, they included Ogg Vorbis tracks, wasting HDD space for no reason by effectively storing the music twice, but only letting you access the lower quality Vorbis tracks. So, I thought, why not just split the BIN, encode the audio tracks to FLAC, and that way you both get better audio quality and also use less HDD space. DOSBox supports CUE sheets that list FLAC, Ogg Vorbis and even Opus tracks.

I took inspiration from 'bchunk', which is a program that does something similar. However, bchunk converts data tracks to ISO files, which is not what I wanted. I wanted to keep the original tracks completely untouched, so my script will copy data tracks as normal BIN files. bchunk also can't encode audio tracks to FLAC or Ogg Vorbis, but it will produce uncompressed WAV files. And bchunk doesn't produce new CUE sheets for the created files.

I also use the script to extract the OST from random games. I put together a playlist with some of my favorite retro video game music that I extracted using the script:

https://www.youtube.com/watch?v=nHI7ghR6XX4

There's other uses for the script, such as splitting BINs in general. For example, many BeOS / ZETA disc images contain boot floppies as the first track, and once you split the BIN you can access the boot floppy image. And you can create frankenstein disc images by exchanging tracks between different disc images.

The script is made for Linux, but should work on macOS / FreeBSD as well if you have a recent version of Bash installed, as well as ffmpeg, flac and oggenc.

you are viewing a single comment's thread
view the rest of the comments
[–] rjek@feddit.uk 2 points 6 months ago (11 children)

Why not just use cdparanoia with the original CD?

[–] linux4ever07@lemmy.ml 7 points 6 months ago (10 children)

If you have the original disc, then yeah. The script is more meant for when you get CUE/BINs online, such as Redump disc images for example.

load more comments (4 replies)
load more comments (4 replies)