BiteofanApple Archive About Code Microblog Photos
by Brian Schrader

More Efficient VBR MP3s and Podcasting

Posted on Mon, 15 Aug 2016 at 12:30 PM

Marco Arment

I explained how MP3s work, and why this is a problem, on Accidental Tech Podcast last week...

See for yourself: here’s that same podcast in VBR. Note that the file is 25% smaller and the theme song (at 1:22:47 in the original file) sounds way nicer in the VBR version. But if you seek to the same timestamp as the above share link — 1:24:30 — you’ll hear the wrong audio. The player will say 1:24:30, but you’re actually hearing the audio at 1:25:16.

This post is direct follow up to his really awesome discussion on ATP this week about Variable BitRate (VBR) MP3s and why they're more space-efficient, better sounding, and yet no one uses them. It's a really interesting topic, and as usual, Marco does a great job illustrating the problem and the many possible solutions.

As with so many things in software, the solutions are rarely limited by technology, they're limited by the standards we use (or don't use).

Why don’t podcasts use VBR MP3s? Because iOS and macOS don’t accurately seek them →

Tabletop Audio

Posted on Sun, 07 Aug 2016 at 05:27 PM

I really like Tabletop Audio. It's a great tool for anyone who's running a Tabletop RPG, or for writers who're looking for atmospheric background music. There's lots of different genres represented (much more than typical fantasy stuff). I've been using the site for a while, but I just discovered the new SoundPad feature.

SoundPad was designed for those of you who wanted more control over your sonic environments. Instead of fire-and-forget 10 minute ambiences, each SoundPad is made up of a few dozen sounds, divided into categories.

I've spent a bit of time today playing with SoundPad, and it's really cool. Instead of hunting for just the right atmospheric music, or just defaulting to the Skyrim soundtrack, I can tweak and tune the music, and sound-effects in the game. One of the coolest features of SoundPads, and playlists, is the ability to send live links to the music/sounds you're mixing.

Tabletop Audio →

Primitive Tech tiptoes into the Bronze Age

Posted on Fri, 29 Jul 2016 at 04:18 PM

Once again Primitive Tech amazes me. If you haven't heard of this YouTube channel, you should check it out (you should read his blog posts too). So far, he's mostly built huts (one even had a fireplace) and primitive tools, but with the latest video, he's taken on building a furnace hot enough to smelt metal. It's super simple in concept, and looks pretty effective.

It's amazing what he's able to build with clay and water.

Easy Refactoring with Source Making

Posted on Tue, 19 Jul 2016 at 11:58 AM

If you haven't heard of Source Making, you should check them out. They have a lot of really great and simple tips and tricks to help developers write good code and refactor bad code, and they have lots of practical examples for each of their techniques.

Here's two of my favorite tips:

Replace Conditional with Polymorphism

  • This technique adheres to the Tell-Don't-Ask principle: instead of asking an object about its state and then performing actions based on this, it is much easier to simply tell the object what it needs to do and let it decide for itself how to do that.

  • Removes duplicate code. You get rid of many almost identical conditionals.

  • If you need to add a new execution variant, all you need to do is add a new subclass without touching the existing code (Open/Closed Principle).

Replace Nested Conditional with Guard Clauses

Problem You have a group of nested conditionals and it is hard to determine the normal flow of code execution.

Solution Isolate all special checks and edge cases into separate clauses and place them before the main checks. Ideally, you should have a "flat" list of conditionals, one after the other.

In regards to the first tip, I find myself falling into the trap of if/elsing though a list of cases just to determine what to do next, or what state to alter. Unfortunately, a lot of Python libraries are guilty of this practice. Replacing each of the cases with concrete subclasses would definitely help developers keep track of the various code paths, all while making the code cleaner.

In keeping with the second tip, one of my favorite features of Swift is its Guard statement. It keeps the normal execution logic clean, while still allowing the developer to handle rare, or extraordinary cases easily.

Archive

RSS

Creative Commons License