<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jesse Pinkman</title>
    <description>The latest articles on DEV Community by Jesse Pinkman (@jphfa).</description>
    <link>https://dev.to/jphfa</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3909215%2F3c174be7-9d57-4771-a884-3f08ae721835.png</url>
      <title>DEV Community: Jesse Pinkman</title>
      <link>https://dev.to/jphfa</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jphfa"/>
    <language>en</language>
    <item>
      <title>rekordbox sorts by key or by BPM, never both, and the sort never reaches the CDJ</title>
      <dc:creator>Jesse Pinkman</dc:creator>
      <pubDate>Fri, 18 Sep 2026 17:51:27 +0000</pubDate>
      <link>https://dev.to/jphfa/rekordbox-sorts-by-key-or-by-bpm-never-both-and-the-sort-never-reaches-the-cdj-bm7</link>
      <guid>https://dev.to/jphfa/rekordbox-sorts-by-key-or-by-bpm-never-both-and-the-sort-never-reaches-the-cdj-bm7</guid>
      <description>&lt;p&gt;A warm-up set usually wants two things at once: keys that sit next to each other on the Camelot wheel, and BPM rising inside each key. rekordbox cannot express that, and neither can the players.&lt;/p&gt;

&lt;p&gt;Press &lt;em&gt;Sort by Key&lt;/em&gt; on a CDJ and the tracks group by key, but inside &lt;code&gt;1A&lt;/code&gt; the BPMs come out in whatever order you dragged them into the playlist. Press &lt;em&gt;Sort by BPM&lt;/em&gt; and the BPM lines up while the keys scatter. There is no compound sort in the UI, on the desktop or on the deck.&lt;/p&gt;

&lt;p&gt;That is the visible half of the problem. The half that costs you a set is this: &lt;strong&gt;sorting on a player is a view.&lt;/strong&gt; It never changes the order stored in the playlist, and the order stored in the playlist is what a CDJ reads off the USB stick. Toggle &lt;em&gt;Sort by Key&lt;/em&gt; on the laptop, export, and the deck plays the original order back at you.&lt;/p&gt;

&lt;h2&gt;
  
  
  Six tracks, three sorts
&lt;/h2&gt;

&lt;p&gt;Registration order, which is also the stored order:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;#&lt;/th&gt;
&lt;th&gt;Track&lt;/th&gt;
&lt;th&gt;Key&lt;/th&gt;
&lt;th&gt;BPM&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;A&lt;/td&gt;
&lt;td&gt;1A&lt;/td&gt;
&lt;td&gt;130&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;B&lt;/td&gt;
&lt;td&gt;2A&lt;/td&gt;
&lt;td&gt;124&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;C&lt;/td&gt;
&lt;td&gt;1A&lt;/td&gt;
&lt;td&gt;124&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;D&lt;/td&gt;
&lt;td&gt;2B&lt;/td&gt;
&lt;td&gt;130&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;E&lt;/td&gt;
&lt;td&gt;2A&lt;/td&gt;
&lt;td&gt;128&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;F&lt;/td&gt;
&lt;td&gt;2B&lt;/td&gt;
&lt;td&gt;124&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The same six tracks under each sort:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;#&lt;/th&gt;
&lt;th&gt;Sort by Key&lt;/th&gt;
&lt;th&gt;Sort by BPM&lt;/th&gt;
&lt;th&gt;Compound (key → BPM)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;A · 1A · 130&lt;/td&gt;
&lt;td&gt;C · 1A · 124&lt;/td&gt;
&lt;td&gt;C · 1A · 124&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;C · 1A · 124&lt;/td&gt;
&lt;td&gt;B · 2A · 124&lt;/td&gt;
&lt;td&gt;A · 1A · 130&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;B · 2A · 124&lt;/td&gt;
&lt;td&gt;F · 2B · 124&lt;/td&gt;
&lt;td&gt;B · 2A · 124&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;E · 2A · 128&lt;/td&gt;
&lt;td&gt;E · 2A · 128&lt;/td&gt;
&lt;td&gt;E · 2A · 128&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;D · 2B · 130&lt;/td&gt;
&lt;td&gt;A · 1A · 130&lt;/td&gt;
&lt;td&gt;F · 2B · 124&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;F · 2B · 124&lt;/td&gt;
&lt;td&gt;D · 2B · 130&lt;/td&gt;
&lt;td&gt;D · 2B · 130&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Sort by key and the BPM inside &lt;code&gt;1A&lt;/code&gt; and &lt;code&gt;2B&lt;/code&gt; runs 130 → 124, the opposite direction of a warm-up. Sort by BPM and the key walks &lt;code&gt;1A → 2A → 2B → 2A → 1A → 2B&lt;/code&gt;, a tour of the wheel that ignores harmonic adjacency. Only the third column keeps the keys ascending and the BPM rising inside each one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where you can write the order
&lt;/h2&gt;

&lt;p&gt;rekordbox exports its library as an XML file, and it will read that file back in as a second tree in the sidebar, the &lt;code&gt;rekordbox xml&lt;/code&gt; tree, alongside your real library. The playlists in that file are lists of &lt;code&gt;&amp;lt;TRACK Key="…"/&amp;gt;&lt;/code&gt; references, and their order is the stored order.&lt;/p&gt;

&lt;p&gt;So the fix is to rewrite the references:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;baken rbsort ~/Music/rekordbox/collection.xml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Camelot key ascending as the primary key, BPM ascending as the tiebreaker inside each key group. Tracks with no Camelot key sort after all known keys. Nothing else in the file changes: names, folder structure, &lt;code&gt;Count&lt;/code&gt; and &lt;code&gt;Entries&lt;/code&gt; attributes and whitespace are all preserved byte for byte, which means running it twice is a no-op and it can safely run on every export.&lt;/p&gt;

&lt;p&gt;Your actual library is never touched. The sorted playlists show up in the separate &lt;code&gt;rekordbox xml&lt;/code&gt; tree, you drag the one you want into your real playlists, switch to EXPORT mode and write the USB. The deck plays it in that order in its default browse screen, with nothing to do on the night.&lt;/p&gt;

&lt;p&gt;Two things worth knowing before you run it. Keys have to be in Camelot notation, which is &lt;em&gt;Preferences → View → Key display format → Alphanumeric&lt;/em&gt;; if they are not, the tool stops rather than guessing. And the &lt;code&gt;rekordbox xml&lt;/code&gt; tree is a different sidebar tree from &lt;code&gt;Playlists&lt;/code&gt;, which is the single most common reason people think nothing happened.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why not just ask for the feature
&lt;/h2&gt;

&lt;p&gt;Even if rekordbox shipped a compound sort tomorrow, it would be a view, and the CDJ would still read the stored order. The same is true of Auto Gain: rekordbox works out a per-track gain, applies it in performance mode, and never writes it into the file, so a player reading USB has no idea it exists. Anything that lives only in the laptop app does not follow the music onto the deck. The general move is to bake it into the thing that travels.&lt;/p&gt;

&lt;p&gt;The tool is &lt;code&gt;baken&lt;/code&gt;, MIT, Rust, macOS, Windows and Linux: &lt;a href="https://github.com/M-Igashi/baken" rel="noopener noreferrer"&gt;https://github.com/M-Igashi/baken&lt;/a&gt;. &lt;code&gt;rbsort&lt;/code&gt; needs nothing but the XML, not even ffmpeg. There is a native Mac app too, which shows the resulting order before it writes anything, but the command line does the same sort and stays free.&lt;/p&gt;

&lt;p&gt;Full version of this write-up, which is the canonical one: &lt;a href="https://baken.ravers.workers.dev/sort" rel="noopener noreferrer"&gt;https://baken.ravers.workers.dev/sort&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;rekordbox, CDJ and Pioneer DJ are trademarks of AlphaTheta Corporation. This project is not affiliated with or endorsed by AlphaTheta Corporation.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>rust</category>
      <category>cli</category>
      <category>opensource</category>
      <category>music</category>
    </item>
    <item>
      <title>I rewrote mp3gain in Rust — 'compatible' turned out to be three different things</title>
      <dc:creator>Jesse Pinkman</dc:creator>
      <pubDate>Sat, 02 May 2026 21:29:13 +0000</pubDate>
      <link>https://dev.to/jphfa/i-rewrote-mp3gain-in-rust-compatible-turned-out-to-be-three-different-things-4fbc</link>
      <guid>https://dev.to/jphfa/i-rewrote-mp3gain-in-rust-compatible-turned-out-to-be-three-different-things-4fbc</guid>
      <description>&lt;p&gt;If you maintain a podcast, music server, or any audio pipeline that needs consistent volume across files, there's a non-trivial chance you have one of these somewhere:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;RUN &lt;/span&gt;apt-get &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; mp3gain
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Or in a beets config:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;replaygain&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;backend&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;command&lt;/span&gt;
  &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;mp3gain&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Or buried in a cron job from 2014.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mp3gain&lt;/code&gt; was written in C by Glen Sawyer in 2003. Upstream development stopped around 2009. Distributors (Debian, Ubuntu, Homebrew) keep it alive with security patches, but no new features have shipped in 15+ years. Its AAC counterpart &lt;code&gt;aacgain&lt;/code&gt; died around the same time and doesn't even build cleanly on modern 64-bit systems.&lt;/p&gt;

&lt;p&gt;People keep using both because the popular alternatives — &lt;code&gt;loudgain&lt;/code&gt;, &lt;code&gt;rsgain&lt;/code&gt;, &lt;code&gt;ffmpeg loudnorm&lt;/code&gt; — solve a &lt;em&gt;related&lt;/em&gt; problem (writing ReplayGain tags) but not the &lt;em&gt;same&lt;/em&gt; problem. A tag-only tool doesn't help when your players ignore tags entirely: DJ hardware, smart speakers, most car audio, podcast publishing pipelines that bake volume into the file. For those, you need the bitstream itself rewritten — losslessly, reversibly, fast.&lt;/p&gt;

&lt;p&gt;Rather than CVE-patch a 22-year-old C codebase one more time, I spent the last year writing &lt;a href="https://github.com/M-Igashi/mp3rgain" rel="noopener noreferrer"&gt;mp3rgain&lt;/a&gt;, a Rust implementation that reads and writes the same files mp3gain does. Halfway through, I realized the word "compatible" was hiding three completely different things.&lt;/p&gt;
&lt;h2&gt;
  
  
  Layer 1 — byte-identical output
&lt;/h2&gt;

&lt;p&gt;The strictest compatibility claim is that the &lt;em&gt;output file&lt;/em&gt; is bit-for-bit identical:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cp &lt;/span&gt;original.mp3 a.mp3 &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cp &lt;/span&gt;original.mp3 b.mp3
mp3gain  &lt;span class="nt"&gt;-g&lt;/span&gt; 2 a.mp3
mp3rgain &lt;span class="nt"&gt;-g&lt;/span&gt; 2 b.mp3
&lt;span class="nb"&gt;sha256sum &lt;/span&gt;a.mp3 b.mp3
&lt;span class="c"&gt;# → same hash&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;To get there, the Rust implementation has to match every detail of the C version's bitstream rewrite: synchronization word detection, MPEG version dispatch, side-information size calculation (which differs by MPEG version × channel mode), and bit-level reads/writes that span byte boundaries.&lt;/p&gt;

&lt;p&gt;I wanted to "clean up" something the C code did awkwardly more than once. Every time I had to remind myself: the moment I lose byte-identical output, I lose the right to call this a drop-in replacement. There's a CI script (&lt;code&gt;scripts/compatibility-test.sh&lt;/code&gt;) that diffs SHA-256 hashes between both tools across MPEG1/2/2.5, mono/stereo/joint stereo, CBR/VBR, and a range of gain values. If even one case mismatches, the PR doesn't merge.&lt;/p&gt;
&lt;h2&gt;
  
  
  Layer 2 — tag interoperability
&lt;/h2&gt;

&lt;p&gt;mp3gain stores undo information in APEv2 tags:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight properties"&gt;&lt;code&gt;&lt;span class="py"&gt;mp3gain_undo&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;-3,-2,N&lt;/span&gt;
&lt;span class="py"&gt;mp3gain_minmax&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;100,148&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;If I run &lt;code&gt;mp3gain -g 2&lt;/code&gt;, then later &lt;code&gt;mp3rgain -u&lt;/code&gt;, the undo has to work — and vice versa. This is a different layer from byte-identical output: it's about the &lt;em&gt;metadata block&lt;/em&gt;, not the audio frame data.&lt;/p&gt;

&lt;p&gt;mp3rgain reads and writes the same APEv2 fields with the same string format. There's one intentional break: after &lt;code&gt;-u&lt;/code&gt;, mp3gain leaves an empty APEv2 tag block in place (probably because rewriting it would shift downstream frame offsets). mp3rgain removes the tag completely. The audio data is identical either way and the bidirectional undo property still holds, so I judged this as still "compatible enough."&lt;/p&gt;
&lt;h2&gt;
  
  
  Layer 3 — text protocol
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;mp3gain -o&lt;/code&gt; (no argument) prints a tab-separated table:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csvs"&gt;&lt;code&gt;&lt;span class="k"&gt;File&lt;/span&gt;    &lt;span class="k"&gt;MP&lt;/span&gt;&lt;span class="mf"&gt;3&lt;/span&gt; &lt;span class="k"&gt;gain&lt;/span&gt;    &lt;span class="k"&gt;dB&lt;/span&gt; &lt;span class="k"&gt;gain&lt;/span&gt; &lt;span class="k"&gt;Max&lt;/span&gt; &lt;span class="k"&gt;Amplitude&lt;/span&gt;   &lt;span class="k"&gt;Max&lt;/span&gt; &lt;span class="k"&gt;global&lt;/span&gt;&lt;span class="err"&gt;_&lt;/span&gt;&lt;span class="k"&gt;gain&lt;/span&gt; &lt;span class="k"&gt;Min&lt;/span&gt; &lt;span class="k"&gt;global&lt;/span&gt;&lt;span class="err"&gt;_&lt;/span&gt;&lt;span class="k"&gt;gain&lt;/span&gt;
&lt;span class="k"&gt;song&lt;/span&gt;&lt;span class="err"&gt;.&lt;/span&gt;&lt;span class="k"&gt;mp&lt;/span&gt;&lt;span class="mf"&gt;3&lt;/span&gt;    &lt;span class="mf"&gt;0&lt;/span&gt;   &lt;span class="mf"&gt;0.0&lt;/span&gt; &lt;span class="mf"&gt;17234&lt;/span&gt;   &lt;span class="mf"&gt;148&lt;/span&gt; &lt;span class="mf"&gt;100&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://beets.io/" rel="noopener noreferrer"&gt;beets&lt;/a&gt; parses this with regex. So do an unknown number of personal scripts that have run unmodified for a decade. Change the column order, the header text, or the separator, and you break all of them silently.&lt;/p&gt;

&lt;p&gt;mp3rgain emits the exact same header — one &lt;code&gt;println!&lt;/code&gt; line at &lt;a href="https://github.com/M-Igashi/mp3rgain/blob/master/src/main.rs#L1275" rel="noopener noreferrer"&gt;main.rs:1275&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="nd"&gt;println!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"File&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="s"&gt;MP3 gain&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="s"&gt;dB gain&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="s"&gt;Max Amplitude&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="s"&gt;Max global_gain&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="s"&gt;Min global_gain"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;New structured output lives behind &lt;code&gt;-o json&lt;/code&gt;, opt-in, never the default.&lt;/p&gt;
&lt;h2&gt;
  
  
  What I deliberately &lt;em&gt;didn't&lt;/em&gt; keep
&lt;/h2&gt;

&lt;p&gt;Compatibility isn't free, and not every quirk is worth preserving:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AAC support&lt;/strong&gt;: mp3gain has none. mp3rgain rewrites AAC &lt;code&gt;global_gain&lt;/code&gt; in place (the same idea aacgain used) and stores undo info in MP4 freeform metadata atoms because APEv2 doesn't fit MP4 containers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;-o json&lt;/code&gt; and &lt;code&gt;--dry-run&lt;/code&gt;&lt;/strong&gt;: new flags for automated pipelines. Preview safely, then apply — something the original CLI didn't really support.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ID3v2 RVA2 / TXXX ReplayGain tags (&lt;code&gt;-s i&lt;/code&gt;)&lt;/strong&gt;: opt-in. foobar2000, mpd, and other ReplayGain-aware players read these; APEv2 tags are invisible to them.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Migrating: what it actually looks like
&lt;/h2&gt;

&lt;p&gt;For most pipelines, migration is one substitution.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Shell scripts:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sed&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="s1"&gt;'s/\bmp3gain\b/mp3rgain/g'&lt;/span&gt; your_pipeline.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Dockerfile&lt;/strong&gt; — replace the apt-installed binary with a 2 MB static image:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;- RUN apt-get install -y mp3gain &amp;amp;&amp;amp; rm -rf /var/lib/apt/lists/*
- ENTRYPOINT ["mp3gain"]
- FROM ghcr.io/m-igashi/mp3rgain:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;That's it. The image is &lt;code&gt;FROM scratch&lt;/code&gt; with a musl-static binary: no shell, no glibc, no apt cache to clean.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;beets&lt;/strong&gt; — change one line in &lt;code&gt;~/.config/beets/config.yaml&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;replaygain&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;backend&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;command&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;mp3gain&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;mp3rgain&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;The full migration guide is at &lt;a href="https://github.com/M-Igashi/mp3rgain/blob/master/docs/migrating-from-mp3gain.md" rel="noopener noreferrer"&gt;docs/migrating-from-mp3gain.md&lt;/a&gt;, with sed patterns, CI snippets, and the apt/dnf/pacman/brew/winget/cargo install matrix.&lt;/p&gt;
&lt;h2&gt;
  
  
  Why bother
&lt;/h2&gt;

&lt;p&gt;Three reasons that mattered to me:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Memory safety&lt;/strong&gt;. mp3gain's history includes a stream of CVEs — heap overflows in the side-info parser, mostly. Patching those in 2025 means tracking down a long-quiet maintainer's intent. A Rust rewrite removes the whole class from the picture.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AAC&lt;/strong&gt;. Most personal libraries on Apple platforms are AAC, and there's been no working tool to volume-normalize them losslessly since aacgain stopped building. DJ hardware, car audio, and smart speakers all ignore ReplayGain tags, so tag-only tools don't help.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Distribution&lt;/strong&gt;. Static binary in a 2 MB image, plus packages on Homebrew / Winget / AUR / PPA / Docker / Cargo. No "build from source on this niche distro" required.&lt;/li&gt;
&lt;/ol&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/M-Igashi" rel="noopener noreferrer"&gt;
        M-Igashi
      &lt;/a&gt; / &lt;a href="https://github.com/M-Igashi/mp3rgain" rel="noopener noreferrer"&gt;
        mp3rgain
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Lossless MP3 volume adjustment - a modern mp3gain replacement written in Rust
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;mp3rgain&lt;/h1&gt;
&lt;/div&gt;

&lt;p&gt;&lt;a href="https://opensource.org/licenses/MIT" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667" alt="License: MIT"&gt;&lt;/a&gt;
&lt;a href="https://www.rust-lang.org" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/ca1fb72f9979a9fdae8374b318ef81c515751ee3dde21f74644e5d46c3f1747e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f727573742d312e37302532422d626c75652e737667" alt="Rust"&gt;&lt;/a&gt;
&lt;a href="https://crates.io/crates/mp3rgain" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/f16970b9fc048f70836d37c0cb580b789bba45a4f9772930075eb239edd27bd3/68747470733a2f2f696d672e736869656c64732e696f2f6372617465732f762f6d7033726761696e2e737667" alt="crates.io"&gt;&lt;/a&gt;
&lt;a href="https://m-igashi.github.io/mp3rgain/" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/4b7c8a4625158be8ddf1562ee096b922b43f056e139064a2c31aa5cdc417348b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f646f776e6c6f6164732f4d2d4967617368692f6d7033726761696e2f746f74616c3f6c6162656c3d646f776e6c6f61647326636f6c6f723d627269676874677265656e" alt="GitHub Downloads"&gt;&lt;/a&gt;
&lt;a href="https://github.com/M-Igashi/mp3rgain/docs/compatibility-report.md" rel="noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/07e0a0ee53a70ca6498fea85204a336e9677e28cc7c9c3119aa3491c7cc3dbcc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d70336761696e2d636f6d70617469626c652d627269676874677265656e2e737667" alt="mp3gain compatible"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Lossless MP3/AAC volume adjustment - a modern mp3gain / aacgain replacement written in Rust&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;mp3rgain adjusts MP3 and AAC volume without re-encoding by modifying the &lt;code&gt;global_gain&lt;/code&gt; field in each frame. This preserves audio quality while achieving permanent volume changes.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The only actively maintained tool that performs lossless AAC/M4A bitstream gain adjustment.&lt;/strong&gt;
aacgain has been unmaintained since ~2009 and rarely builds on modern 64-bit systems. mp3rgain is the only practical option today for re-encode-free AAC volume normalization.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Features&lt;/h2&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Only tool with lossless AAC bitstream gain&lt;/strong&gt;: re-encode-free &lt;code&gt;global_gain&lt;/code&gt; rewrite for AAC/M4A — a capability previously only available in the long-abandoned aacgain&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lossless &amp;amp; Reversible&lt;/strong&gt;: No re-encoding, all changes can be undone (MP3 and AAC)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ReplayGain&lt;/strong&gt;: Track and album gain analysis for MP3 and AAC/M4A&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero dependencies&lt;/strong&gt;: Single static binary (no ffmpeg, no mp3gain, no aacgain)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cross-platform&lt;/strong&gt;: macOS, Linux, Windows (x86_64 and ARM64)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;mp3gain / aacgain compatible&lt;/strong&gt;…&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/M-Igashi/mp3rgain" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  What I'd love to hear
&lt;/h2&gt;

&lt;p&gt;If you have mp3gain or aacgain in a pipeline somewhere, I'd be curious which of the three compatibility layers actually matters to you in practice — and whether anyone is relying on &lt;code&gt;-s i&lt;/code&gt; ID3v2 ReplayGain tags I should know about. Issues and migration reports welcome.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Disclosure: prose drafted and generated descriptive cover.png with AI editorial assistance. Code, design decisions, and the SHA-256 verification setup are my own.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>rust</category>
      <category>podcast</category>
      <category>showdev</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
