Bar Waveform
A customizable bar audio waveform visualization component.
Animate a bar waveform, often used for audio visualizations.
Installation
CLI
Manual
Create a new file, for example, at
src/components/clippkit/bar-waveform.tsx
(or your preferred location) and
paste the following code into it.
Update the import paths in your Remotion compositions if you placed the file in a different location than shown in the usage examples.
Usage
Once the BarWaveform
component is added to your project (either via CLI or Manually), you can integrate it into your Remotion project by importing it and defining a Composition
.
Prerequisite
Ensure you have a Remotion project set up. If not, please refer to the Remotion documentation to get started.
Project Structure Example
Here’s an example folder layout showing where to place the component and how it fits into a typical Remotion project
Define a Composition
In your Remotion project's entry file (commonly src/Root.tsx
, src/index.tsx
, app/main.tsx
), import BarWaveform
and define a Composition
.
API Reference
The component exported as BarWaveform
(e.g., from apps/docs/registry/default/ui/bar-waveform.tsx
or your project's component path) accepts the following props to customize its appearance and animation:
Prop | Type | Default Value | Description |
---|---|---|---|
audioData | MediaUtilsAudioData | null | Audio data processed by @remotion/media-utils . |
numberOfSamples | number | 64 | Number of bars to render. |
barColor | string | "var(--foreground)" | Color of the bars. Accepts any valid CSS color value. |
barWidth | number | 5 | Width of each bar in pixels. |
barGap | number | 2 | Gap between each bar in pixels. |
barBorderRadius | string | number | 0 | Border radius for the bars. |
waveAmplitude | number | 100 | Maximum height of the bars. |
waveSpeed | number | 10 | Speed of the wave animation. Higher value means slower animation. |
height | string | number | Video config height | Explicit height for the waveform container. Overrides video config height. |
width | string | number | Video config width | Explicit width for the waveform container. Overrides video config width. |
containerStyle | React.CSSProperties | {} | Custom CSS styles for the main container div . |