Drawings
Ten ways to draw a sound, from rounded bars to a heartbeat monitor. Every player on this page plays; press any of them.
Loading the sound…
Ten ways to draw the sound
Every drawing takes the played, hover and unplayed colors, and any of them can carry a knob at the playing position.
Choosing one
new SonicFrame({ container, media, peaks, wave: 'pulse' });
// With details:
new SonicFrame({
container,
media,
peaks,
wave: { style: 'line', lineWidth: 3, glow: 6, smooth: true },
});
// Later:
frame.setWave('blocks');
| Detail | Default | What it does |
|---|---|---|
style |
'bars' |
'bars',
'needles',
'blocks',
'dots',
'steps',
'line',
'area',
'scope',
'pulse' or
'track'.
|
lineWidth |
2 |
The line of line drawings and of the track, in CSS pixels. |
glow |
0 |
A soft glow around lines. |
mirror |
true |
The line also traces the lower edge. |
smooth |
true |
Curves instead of corners. |
knob |
0 |
The diameter of a dot riding the playing position, over any drawing. |
{ style: 'track', knob: 12 } needs no peaks
at all: a line with a moving dot, for sounds you have no
peaks for yet.
The bar style
Every drawing takes its density, curve and alignment
from
bar, in CSS pixels:
| Option | Default | What it does |
|---|---|---|
width |
3 |
Width of a bar. |
gap |
2 |
Space between bars. |
radius |
1.5 |
Corner radius of a bar. |
minHeight |
2 |
The height of silence, so the wave never disappears. |
align |
'center' |
'center', or
'bottom' for a level meter.
|
curve |
0.7 |
Below 1 lifts quiet sounds (speech reads well); 1 draws the peaks as they are; above 1 leaves only the loud parts standing out. |
Every bar has the same width in whole device pixels, edge to edge, so the wave stays sharp at any page zoom. Live frequency and exported clips use the same drawing.