Solution

AudD for venues and background music suppliers

How bars, shops, gyms and the companies that supply their background music keep a log of what played at each location with AudD streams or short clips, what it costs, and what a play log is and isn't for.

view .md auddbackground musicvenuesplay log

You can use our music recognition service to identify the songs playing in bars, shops and gyms. If you run the venues, or you supply their background music, and want to know what played at each location, this page is for you. We wanted to make it as simple as possible: you send us the URL of each location’s stream, and we send you the songs in real time.

Main Street,2020-04-13 10:31:43,111,"Alan Walker, A$AP Rocky",Live Fast (PUBGM),https://lis.tn/LiveFastPUBGM

Here’s a row from a play log: the location, the time, how long the song played (in seconds), the artist, the title and the song’s lis.tn page.

What you can do

Keep a play log for each location

You send us the URL of the stream once, and we send you every song it plays. Each result has the radio_id you chose for the stream, so if you give every location its own radio_id, every song comes with its location. One server can keep the log for all your locations: the callbacks from all the streams will be sent to the one URL you set.

Check a supplier’s playlist reports

If your supplier sends you reports of what it played, you can check them against your log. If you’re the supplier, you can use the log to answer a client’s question about a day with the list of the songs that played.

Show the song on a screen

A screen at the bar or by the door can show the song that is playing now. You can use our widget for that, https://widget.audd.tech/?ch=-<category>: it shows the last recognized song, and the history if you want it. The category is the longpoll_category of the location’s stream in the getStreams response. The now-playing widget recipe shows how to set it up, and Show the song that’s playing in OBS shows how to style it.

Which AudD service fits

When the music is already a stream

If the music at a location is already a stream, use our streams. You send us the URL of the stream once, and we send you every song it plays in callbacks: requests with recognition results our servers will send to your server. As the URL of the audio stream, you can simply send the URL of the stream. We support most of the stream formats, including DASH, Icecast, HLS, m3u/m3u8, and plain http:// URLs, so an Icecast or SHOUTcast server with its default settings is fine.

By default, we will send new results after songs end playing, with the location (the radio_id you chose for the stream), the timestamp and the played duration in play_length. That’s the shape a play log needs. If you want to receive the callbacks as soon as a song starts playing, for a screen, set callbacks to before; you won’t receive the played duration then.

If something happens to an audio stream, we’ll let you know by sending a notification so you can fix the stream or change its URL. There are 3 codes: 0 (which means that everything’s fine), 650 (which means that we can’t connect to the stream) and 651 (which means that we don’t receive any music from the stream, only white noise). At a venue, 651 is the one to watch: the stream is running, but there’s no music on it. See stream health for the fixes.

If the music comes from a player in the room and not from a stream, you can make it a stream with an Icecast server. Our servers connect to the stream from the internet, so the server needs a public address: see Icecast, SHOUTcast and AzuraCast for the stream URL to send us.

When there’s no stream: a small device in the room

You can also use a small computer with a microphone, or with a line input from the amplifier. It records a few seconds and sends them to our standard endpoint. The vinyl scrobbler recipe shows how to record the clips on a Raspberry Pi, skip the quiet ones and send fewer requests. A line input hears only the music, and a microphone hears the room, with the people in it.

If you put devices in your venues, please don’t include your API token in the software on them. Send the clips to your server instead, and send them to us from there: see keeping your token on the server.

What it costs

Stream monitoring is $45 per stream per month. You pay for the maximum number of streams you will run at the same time, so 20 locations, each with its own stream, cost 20 × $45 = $900 per month. Set the limit of audio streams and pay on the API Dashboard. If you change the limit later, the unused amount of time will be applied as a discount.

Clips from a device are counted as requests: basically, as 1 request per clip. So if a device sends a clip every minute while a location is open, 12 hours a day, that’s 720 requests a day and 21,600 in a 30-day month: $5 + 20.6 × $5.00 = $108 on the Indie plan ($5 per month with 1,000 requests, then $5.00 per 1,000). If it sends one or two clips per song, and the location plays about 200 songs a day, that’s 6,000 to 12,000 requests a month, or $30 to $60.

The requests from all the devices on your account add up. From 90,000 to about 188,900 requests a month, the Startup plan ($450 per month with 100,000 requests, then $4.50 per 1,000) is the cheapest, and the Pro plan above that. New accounts get a free trial of 300 requests, where available, and may also get a 3-day trial of one stream. The prices are from our pricing page.

What a play log is for, and what it isn’t

Please note that a play log is only a list of the songs we recognized. It isn’t a licence to play them, and we don’t send it to collecting societies for you. If you have any questions about licences or about what you have to report, please ask the collecting society in your country: this page isn’t legal advice.

In the United Kingdom, PPL PRS says: “If you use, play or perform music in your business or organisation, the chances are you need a music licence.” It also says that music that’s played outside of a domestic environment is classed as a public performance, even if the music can only be heard by employees in the workplace, canteen or staff areas. PPL PRS asks you to let them know about any changes in your music usage, as this may affect how much you need to pay. Its FAQ says that if you are a venue that is hosting a live event and have been asked to submit a setlist, you can do this by email or post. (Sources: PPL PRS, TheMusicLicence and FAQs.)

In Canada, SOCAN says that any public performance or reproduction of copyright-protected musical works requires a license. If you use music in your establishments, such as a restaurant, bar, or hotel, it sends you to a SOCAN general music license administered through Entandem, for background and live music. (Source: SOCAN, Music licensing.)

We recognize the recordings in our database of 160 million songs. A song that isn’t there, like a track a supplier had made for its clients, won’t be in the log. If you want us to recognize your own catalog, contact us: [email protected]. And a match tells you which recording played, not whether your licence covers it.

Code teaser: a log for every location

Set the URL for callbacks using the setCallbackUrl API method, then add the streams using the addStream API method, one for every location. If you add more streams than your limit, addStream returns error 902:

from audd import AudD, AudDQuotaError, AudDStreamLimitError

audd = AudD()  # reads AUDD_API_TOKEN; get your own token at dashboard.audd.io
STREAMS = {  # radio_id -> the stream of the music at that location
    1: "http://icecast.your-venue.example:8000/main-street",
    2: "http://icecast.your-venue.example:8000/harbour-road",
}

audd.streams.set_callback_url("https://your-server.example/audd-callback")
for radio_id, url in STREAMS.items():
    try:
        audd.streams.add(url=url, radio_id=radio_id)
    except (AudDQuotaError, AudDStreamLimitError):  # error 902 (or 610)
        print(f"Stream limit reached: raise it on the dashboard to add location {radio_id}")
        break

The server at that URL writes every song to plays.csv (pip install audd flask):

import csv

from flask import Flask, request
from audd import AudD

audd = AudD()  # reads AUDD_API_TOKEN; get your own token at dashboard.audd.io
LOCATIONS = {1: "Main Street", 2: "Harbour Road"}  # radio_id -> location

app = Flask(__name__)


@app.post("/audd-callback")
def callback():
    match, notification = audd.streams.handle_callback(request)
    if match and match.song:
        with open("plays.csv", "a", newline="") as f:
            csv.writer(f).writerow([
                LOCATIONS.get(match.radio_id, match.radio_id),
                match.timestamp,
                match.play_length,
                match.song.artist,
                match.song.title,
                match.song.song_link,
            ])
    elif notification:
        print(f"location {notification.radio_id}: {notification.notification_code} "
              f"{notification.notification_message}")
    return "OK"  # always answer 200 OK, or the callback is queued and sent again

Please ensure that your handler responds with the 200 OK HTTP status when it receives the callbacks. If your server doesn’t respond to the callbacks with the 200 OK status or we can’t connect to your server, we’ll put the callbacks in a queue. When your server is back online, we’ll gradually send all of the backlog. The callbacks aren’t signed, so secure the callback endpoint before you rely on it.

If you don’t have a server to receive the results and just want to download reports as, e.g., sheets, contact us at [email protected]. The AudD CLI can also keep the log on one computer: audd streams add <url> --id 1, then audd streams export --since 7d --format csv > plays.csv.


Related

Reading this as an AI agent? The raw Markdown is at for/venues-and-background-music.md, and the full index is /resources/llms.txt.