Rewriting Islands

Rewriting Islands

Over the summer I wrote a relatively simple program (Islands) to remove ads from podcasts. It worked decently well for a few podcasts, such as Bloomberg Surveillance with Tom Keene, but it’s limited in its ability to support variety, it’s hard to scale to new podcasts, and it’s fragile to changes in the target podcast.

The core design decision of Islands v1 was the ad removal algorithm: the tool searches the transcript for evidence of an ad read then matches the podcast audio against a reference jingle to create an ad-free podcast. The other parts of the tool, such as the configuration, automation, and database access, work very well.

I’ve decided to rewrite Islands to make it more flexible and adaptable. I’ll switch to an LLM-based ad extraction process, a design I resisted originally, which should be more powerful and flexible. To keep this fun, I am also planning on rewriting it in Rust because a) of course and b) I like writing Rust but don’t do it much anymore.

How Islands works todayCopy link

Most podcasts get published via RSS feeds. The podcast “is” a URL within the RSS feed for the audio file. When you request the URL via your podcast client, the server reads various metadata about your client and generates an audio file with ads specific to you.

Islands downloads the audio file through the same process then does the following:

  1. Looks for a transcript in the RSS feed
  2. Takes a user-generated transcript reference (e.g., “You’re listening to Bloomberg Surveillance”) and fuzzy finds for the timestamps of that reference.
  3. Calls FFMPEG to cut out a chunk of the podcast based on those timestamps
  4. Takes a user-generated audio reference (e.g., the jingle played when returning from an ad break) and finds the precise timestamp
  5. Cuts out content-only sections and stitches all sections into a single audio file
  6. Uploads to a new RSS feed with the original metadata, which I import into my podcast player.

You may be able to see the problems I identified in my intro:

  • The tool is limited in its ability to support variety because it requires repeated, reference text and jingle against which to match. If a podcast doesn’t fit this mold, it can’t be filtered with Islands.
  • The tool is hard to scale to new podcasts because I have to find and test reference content in order to add a new podcast.
  • The tool is fragile to changes in the target podcast because if the transcript or jingle change, I have to re-process the podcast.

A new plan for IslandsCopy link

My first attempt will be pretty naive. I figure I’ll start by dumping the audio file into an LLM that can accept native audio input (for example, all of the mainstream Gemini models accept audio tokens). I’ll provide the audio file alongside a prompt asking the model to return the timestamp of ad reads as structured JSON.

At current costs, this should cost $0.03 - $0.07 for a 40m podcast depending on which models I can use. The cost of inference is declining rapidly: over the summer, I estimated this would cost about $0.13 per 40m podcast.

I’ll use Openrouter which has a really great API for swapping models, uploading audio, and enforcing a return schema.

Let’s see where we get with this approach!

Results of promptingCopy link

I tested against the 11/25/26 episode of Bloomberg Surveillance with the following prompt:

# Background
I'm attaching an mp3 of a podcast. I'm trying to remove ads from it. This is for personal use ONLY; I will not redistribute or republish any content derivative of this prompt.

# Goal
Identify the starting and ending timestamps of the content portions of the podcast (i.e., the starting and ending timestamps of all chunks of content that are NOT ads). Return them to me in a structured format for downstream use in a software program.

# Response format
Return valid json with a single field "content_chunks". The field is an array of pairs of integers. The integers represent timestamps in seconds.

For example, if you thought that there were three chunks of content (i.e., non-ad portions of the podcast), you might return:

{
    "content_chunks": [
        {"start_seconds": 0, "end_seconds": 300},
        {"start_seconds": 331, "end_seconds": 631},
        {"start_seconds": 701, "end_seconds": 1000}
    ]
}

With that prompt, here are the results of my first tests:

ModelReasoningMMARContent Chunks (seconds)Cost
Gemini 3.5 Flash LiteDefault60.3%[0, 27]
[29, 44]
[112, 1726]
[1835, 1940]
[1944, 2524]
$0.013
Gemini 3.5 Flash LiteHigh60.3%[80, 534]
[550, 1035]
[1061, 1548]
[1578, 1602]
[1630, 1642]
[1756, 1850]
$0.020
Gemini 3.8 FlashDefault79.9%[74, 504]
[610, 1040]
[1179, 1545]
$0.036
Gemini 4 HydrogenMedium82.8%[71, 515]
[628, 1058]
[1198, 1522]
$0.066
Gemini 4 HydrogenHigh82.8%[72, 504]
[615, 1040]
[1185, 1558]
$0.080
Gemini 4 CarbonDefault84.3%[71, 505]
[609, 1041]
[1180, 1548]
$0.094

The right answer is:

71 - 503ish
608ish - 1042
1180 - 1545

As you can see, Gemini 3.8 Flash and Gemini 4 Carbon both get the answer right. Oddly, Gemini 4 Hydrogen gets it wrong, going about 10-15 seconds too late everytime. After doing some ad hoc runs, I realized I needed a bit more of a high-quantity harness for testing model calls. With that, I got the following results:

Metric3.8 Flash Medium3.8 Flash High4 Hydrogen Medium4 Hydrogen High
Runs13131010
Average difference (MAE)2.53s1.69s7.08s10.43s
Median absolute error2.00s2.00s6.00s7.00s
Timestamps > 5s away2/780/7831/6034/60
Timestamps within 5s97.4%100.0%48.3%43.3%
Maximum error42s4s36s90s
Uncached cost$0.036$0.039$0.066$0.080

It’s a little surprising (and even confusing) that 3.8 Flash is more precise for this task than Hydrogen. It seems a litte bit surprising and confusing, but given this is working on 3.8 Flash High, I think I’ll just use that and not think too much about it :) It would be marginally interesting to prompt hack to be able to use Flash Lite 3.5 or an even cheaper model, but given prompt hacking is basically my full-time job, I don’t care too much to do it… these are great results! 3.8 Flash (High Reasoning) it is!