DEV Community

KAVANA Engineering
KAVANA Engineering

Posted on

How Radio Station Music Rotation Actually Works: A Software Engineering Perspective

How Radio Station Music Rotation Actually Works: A Software Engineering Perspective

By the KAVANA engineering team

Music rotation sounds simple: pick a track, play it, pick the next one. In practice, it is a constrained optimization problem that has to run in real time, every day, for decades.

The Core Constraints

A music rotation system must satisfy constraints simultaneously:

  • Hour count: A track should not repeat within N hours (typically 2-4 hours for hit music, 6-12 for gold)
  • Artist separation: Two tracks from the same artist should not play back-to-back, or even within the same segment
  • Sound consistency: Consecutive tracks should be sonically compatible (energy, tempo, key)
  • Day of week variation: Monday morning should sound different from Saturday night
  • Daypart targeting: Drive time (06:00-09:00, 16:00-19:00) gets the highest-rotation, highest-energy tracks

What Rotation Actually Means

Radio uses named categories:

  • A rotation: Newest and hottest, plays 5-8 times per day
  • B rotation: Current hits, 3-4 times per day
  • C rotation: Recurrents, 1-2 times per day
  • Gold: Catalog, varies widely

The scheduler maintains a queue for each category and handles promotion/demotion based on week-over-week performance data.

The Database Layer

Each track has extended metadata beyond the obvious:

TrackID          VARCHAR(36)
Title            VARCHAR(200)
Artist           VARCHAR(200)
Duration         INTEGER        -- milliseconds
Energy           FLOAT          -- 0.0-1.0, from audio analysis
BPM              FLOAT
Category         VARCHAR(10)    -- A/B/C/Gold
LastPlayedAt     TIMESTAMP
PlayCountToday   INTEGER
Enter fullscreen mode Exit fullscreen mode

The scheduler joins on LastPlayedAt and PlayCountToday to enforce separation rules.

Handling the Hour Boundary

The hardest operational problem is the end of the hour. The broadcast clock has hard boundaries: news at :00:00. If the scheduler places a 4-minute track starting at :57:30, that track will still be playing when news is supposed to start.

The practical solution: schedule tracks with predicted end times, flag any track that would cross a hard boundary, and substitute a shorter track from a fill pool. The fill pool contains station IDs, jingles, and short instrumentals indexed by duration range.

The AI Extension

Modern systems augment traditional rotation with real-time context: current weather, local events, time of day. A track tagged "summer/outdoor" gets a rotation boost when the temperature exceeds 30C. This requires the rotation engine to pull live context and re-weight selection probability at runtime.

The implementation uses a base score from rotation rules, multiplied by a context-weight lookup, normalized to sum to 1.0 across the eligible pool. Context weights update on a configurable interval, typically 15-30 minutes.


KAVANA has been building broadcast scheduling and rotation software for 500+ FM stations since 2005. Learn more at kavanafm.com.

Top comments (0)