August 2024 Bits#
August 4 - Using K3b to rip CDs#
K3b can be used to rip CDs!
Make sure to sudo apt install flac so you can rip to FLAC!
Here’s “Ripped files pattern” I use:
%{albumartist}/%{albumtitle} (%{year})/%{number} - %{title}
MusicBrainz Picard can add metadata to the CD rip so it has album art. https://picard-docs.musicbrainz.org/en/workflows/workflow_cd.html
Note
If you install Picard through flatpak, make sure to give it access to external drives if necessary:
flatpak override --user --filesystem=/path/to/dir org.musicbrainz.Picard
August 4 - Audacity Setup#
I find that using Audacity in Flatpak is great, but takes a little bit for it to start up. When using the system installed Audacity, you might have to set up a few things.
Open MP3 files correctly:
https://forum.audacityteam.org/t/mp3-decoding-failed-lost-sychronization/57976
Go to Edit > Preferences > Import / Export > Extended Import
Create a new rule that targets the file extensions
*.mp3and moveFFmpeg-compatible filesto the top.
In the end, I ended up not using the system installed Audacity because I couldn’t easily drag to move audio clips like I could do in my Flatpak installed version. Maybe I have an older version. Oh well…
August 4 - Playing Audio CDs#
With mplayer#
mplayer (apt install -y mplayer) is a great way to play CDs via the command line.
It gets out of your way pretty nicely, but skipping to a certain point in a track isn’t easy.
mplayer -cdrom-device /dev/cdrom cdda:// -cache 5000
With VLC#
VLC is OK at playing CDs, as long as you open the media in Media > Open Media > Disc and manually enter the path to your CD (usually /dev/cdrom).
The main problem with VLC is that it doesn’t have gapless playback: https://code.videolan.org/videolan/vlc/-/merge_requests/94
With Rhythmbox#
Rhythmbox is better than VLC at playing CDs. To get truely gapless playback, you need to go into preferences and enable “Crossfade between tracks”, then set the duration to 0.0 seconds (which means there won’t actually be a crossfade). There is still a noticeable glitch between tracks, but it’s better than VLC.
With cmus#
Install cmus, launch it, then run :add cdda://. You’ll have to wait a while for it to load tracks.
With DeaDBeeF Player#
https://deadbeef.sourceforge.io/download.html
This option worked the best out of the box. It had gapless playback without any fiddling.
Don’t use#
https://apps.kde.org/dragonplayer/ - no gapless playback, although it has a simple interface.
https://flathub.org/apps/info.smplayer.SMPlayer - easiest way to install is Flatpak, and I couldn’t get it to easily see my CD and play it.
https://cmus.github.io While it’s a nice command line UI (with VI like bindings). It’s not intuitive, and does not load CDs quickly.
Conclusion#
I might eventually try mpd, which has many, many options. It’s stupid that so many players don’t support gapless playback.
August 8 - Playing Surround Sound#
Plexamp does not seem to support playing flac files encoded for a 5.1 system. However, you can configure VLC to play 5.1 files:
Tools > Preferences > Show settings = All > Audio > Output Modules > ALSA > Audio output channels = Surround 5.1
Sources on Plexamp being terrible at multi channel audio:
https://www.reddit.com/r/plexamp/comments/11ond6a/how_does_plexamp_handle_multichannel_flacs_and/
https://www.reddit.com/r/plexamp/comments/18ocros/does_plexamp_support_dts_51_wav_audio/
Finding Surround Sound Albums#
Playing surround sound is one thing, but finding albums that are released with surround sound are another. Some artists released SACDs long before Blu-rays were a thing. And now, it seems that for some albums, the only way to hear their 5.1 version is to subscribe to Apple Music, Tidal, or Amazon Music.
When an album gets a Blu-ray release, it’s usually done by
Albums to listen to in surround sound:
Additionally, you can use this to figure out what has released in surround: https://bendodson.com/projects/spatial-audio-finder/
Also, this is cool: https://immersiveaudioalbum.com/about/
Oh, and here’s someone’s channel who makes surround mixes: https://www.youtube.com/@5.1-surround-mixes-by-mg
And here’s a link talking about the lack of download for RAM’s dolby atmos mix: https://immersiveaudioalbum.com/daft-punk-random-access-memories-dolby-atmos/
Here’s a link from Dolby themselves: https://www.dolby.com/experience/home-entertainment/articles/how-to-listen-to-music-in-dolby-atmos/
August 9 - Thinking about a DSL for controlling LEDs#
My project, led-machine-plus has a janky, but powerful language you use to control the patterns of LEDs. Take this pattern:
(pixel #000 #512 #000 #936 #000 #512 #000 stop) 22 twinkle crawl
This is the multi-line version of this:
pixel #000 #512 #000 #936 #000 #512 #000
stop
22 twinkle
pattern crawl
(Although it’s worth noting that the one line version behaves differently if you were to try to set the global pattern, but that’s besides the point for the moment).
The current language is powerful, but also not as strict as a normal programming language or DSL. My SolarThing project has a DSL called NotationScript with an implementation called ActionScript. NotationScript itself is a DSL designed to be compiled to JSON in a very specific way. If we were to think of an “LEDLang” implementation, it could express things in ways such as this:
twinkle(speed=crawl) : pixel(speed=stop) {
#000
#512
#000
#936
#000
#512
#000
}
At the time of writing, I would guess that NotationScript currently would not like the use of #000,
but that can be fixed later.
Let’s define some gradients
blend(speed=slow) {
red
green
blue
}
The above notes are just that, notes. Nothing there is final and is mostly just early designs of a potential DSL.
August 19 - Compressing my music library (in a lossy way)#
I want to compress my music library. Not so that it can fit on my phone, but rather so it can fit on my 3DS (although now that I think about it, having it on my phone wouldn’t be a bad idea).
First, we look at the Nintendo 3DS Sound Overview.
.mp3, .m4a (AAC), .mp4, and .3gp are the supported formats.
If I had the option of a different format, I might go with something more modern such as OPUS, but I think M4A will be my goto here.
I have a little over 30 days worth of music, and I want to compress it down to something less than 30GB.
At a bitrate of 64 kbps, I should be able to compress it to about 20GB.
To convert, I could use something like ffmpeg, but I would have to create a script myself to convert the entire library. Here are some tools I could use:
ffmpeg
pydub (uses ffmpeg under the hood)
Here’s people talking about compressing their music libraries:
https://www.reddit.com/r/Music/comments/v1y1lx/is_there_a_good_way_to_convert_your_entire_music/
https://www.reddit.com/r/audio/comments/mzpx2t/is_compressing_a_music_file_a_good_or_terrible/
-
More love for OPUS here
One of the open source solutions brought up here is https://soundconverter.org/
Installing soundconverter is as easy as going here, and clicking install: https://xtradeb.net/apps/soundconverter/
To run it:
soundconverter
Testing out soundconverter works pretty well. It froze midway through the conversion process, but still converted every file correctly, even after it froze.
Alright, so soundconverter is cool, but I’m going to eventually need to make a tool that does this automatically. Before making that tool, I need to be able to convert a file to m4a at my desired bitrate.
Here’s how to do it: https://trac.ffmpeg.org/wiki/Encode/AAC#Examples
ffmpeg -i input.flac -c:a libfdk_aac -b:a 64k output.m4a
Problem is that ffmpeg needs to be compiled with a --enable-libfdk-aac flag.
So the command doesn’t work!
If we don’t care about the best of the best quality, then we can just replace that with aac.
Now we could do variable bit rate, but for the aac option,
that apparently gets worse results than just using a constant bit rate.
Now we need to use -vn to tell it to ignore any video data (I’m not sure why – maybe the album art?).
Final command is:
ffmpeg -vn -i input.flac -c:a aac -b:a 48k output.m4a
I’ve found that 48k is fairly compressed, but doesn’t sound as bad as 32k.
So I’ll stick with 48k which I think still sounds good enough.
This results in about 372307 bytes per minute.
Which comes out to about 16.084 GB per 30 days of music.
To keep the metadata, we need the -map_metadata 0 flag:
ffmpeg -vn -i input.flac -c:a aac -b:a 48k -map_metadata 0 output.m4a
I have about 60GB free on my 3DS’s SD card, so this should be perfect for my ever growing Music library. Let’s test this real quick. Ok, nope my 3DS doesn’t want to play that file. Maybe it doesn’t like the bitrate? Either way, let’s try a different format. mp3 it is!
With mp3, it’s about 480280 bytes per minute or 20.75 GB per 30 days of music.
And that’s at 64kbps!
August 21 - Making the program to compress files#
I made msic in about an hour: https://github.com/retrodaredevil/msic
Note
I used this to determine how long something is: https://superuser.com/a/945604
I added a few more flags outside of that initial hour. It’s a fairly simple program. After I tested it, my 3DS happily played the MP3 files. That’s pretty cool. Now I want to make some playlists. Before looking at playlists, here are some gems of history about the 3DS Sound application:
Using 3DS Sound as an MP3 Player - https://www.ign.com/wikis/ar-games/Nintendo_3DS_Sound_Guide
Unlocking features - https://www.nintendolife.com/forums/3ds/3ds_sound_usage_tips
Streetpass functionality - https://en-americas-support.nintendo.com/app/answers/detail/a_id/273/~/how-to-use-streetpass-with-nintendo-3ds-sound
Those links are just some cool stuff I came across. Wanted to leave them there. The useful link is this: https://www.3dbrew.org/wiki/Nintendo_3DS_Sound It tells us that playlists are stored here on the SD card:
/Nintendo 3DS/Private/00020500/playlist
That link also has the format of a playlist. But wait! Before we create a program to convert m3u playlists to this proprietary one, it is also mentioned that the application supports m3u playlists!
It would be cool to export all my Plex playlists as m3u playlists. Doing this would also be a nice backup option to make sure Plex isn’t doing anything funny with my playlists. It’s worth noting that if you remove an album from your library, then add it back, Plex usually won’t retain the playlists those songs were on, or the ratings of those songs.
I think I’ll come back to this eventually, so for now here are some links that will guide me in the future: