st.audio() in Streamlit

In Streamlit, the audio method is used to play audio files directly inside your app. It supports local files, URLs, and raw audio bytes, making it useful for media apps, speech AI, and machine learning projects.

Basic Syntax

st.audio(data, format="audio/wav", start_time=0)    

The function has the following parameters:

Example: Play a local audio file.

Python

import streamlit as st

st.title("Audio Player")

# Play audio file
st.audio("audio.mp3")