Gradio's Journey to 1 Million Monthly Users!

Read More
  1. Helpers
  2. make_waveform

New to Gradio? Start here: Getting Started

See the Release History

make_waveform

gradio.make_waveform(ยทยทยท)

Description

Generates a waveform video from an audio file. Useful for creating an easy to share audio visualization. The output should be passed into a gr.Video component.

Initialization

Parameters
๐Ÿ”—
audio: str | tuple[int, np.ndarray]

Audio file path or tuple of (sample_rate, audio_data)

๐Ÿ”—
bg_color: str
default = "#f3f4f6"

Background color of waveform (ignored if bg_image is provided)

๐Ÿ”—
bg_image: str | None
default = None

Background image of waveform

๐Ÿ”—
fg_alpha: float
default = 0.75

Opacity of foreground waveform

๐Ÿ”—
bars_color: str | tuple[str, str]
default = ('#fbbf24', '#ea580c')

Color of waveform bars. Can be a single color or a tuple of (start_color, end_color) of gradient

๐Ÿ”—
bar_count: int
default = 50

Number of bars in waveform

๐Ÿ”—
bar_width: float
default = 0.6

Width of bars in waveform. 1 represents full width, 0.5 represents half width, etc.

๐Ÿ”—
animate: bool
default = False

If true, the audio waveform overlay will be animated, if false, it will be static.