• Stars
    star
    315
  • Rank 132,951 (Top 3 %)
  • Language
    HTML
  • License
    SIL Open Font Lic...
  • Created over 8 years ago
  • Updated almost 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Typeface for rendering waveform/data

wavefont build

A typeface for rendering data: waveforms, spectrums, diagrams, bars etc.

Playground  •  Google fonts  •  V-fonts  •   Wavearea

Usage

Place wavefont.woff2 into your project directory and use this code:

<style>
@font-face {
	font-family: wavefont;
	font-display: block;
	src: url(./wavefont.woff2) format('woff2');
}
.wavefont {
	--wght: 10;
	font-family: wavefont;
	font-variation-settings: 'wght' var(--wght), 'ROND' 30, 'YELA' 0;
}
</style>

<!-- Set values manually -->
<textarea id="waveform" class="wavefont" cols="100">
abcdefghijklmnopqrstuvwwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
</textarea>

<script>
// Set values programmatically (more precise)
waveform.textContent = Array.from({length: 100}, (_,i) => String.fromCharCode(0x100 + i)).join('')
</script>

Ranges

Wavefont bars correspond to values from 0 to 100, assigned to different characters:

  • 0-9 chars are for simplified manual input with step 10 (bar height = number).
  • a-zA-Z for manual input with step 2, softened at edges a and Z (bar height = number of letter).
  • U+0100-017F for 0..127 values with step 1 (char = String.fromCharCode(0x100 + value)).

Variable axes

Tag Range Default Meaning
wght 100-900 400 Bar width, or boldness (in upm).
ROND 0-100 100 Border radius, or roundness (percent).
YELA -100-100 -100 Alignment: bottom, center or top.

To adjust axes via CSS:

.wavefont {
  font-variation-settings: 'wght' var(--wght, 40), 'ROND' var(--rond, 0), 'YELA' var(--align, 0);
  letter-spacing: 1ch; /* 1ch unit === 1 bar width */
}

Features

  • Visible charcodes fall under marking characters unicode category, ie. recognized as word by regexp and can be selected with Ctrl + or double click. Eg. waveform segments separated by or - are selectable by double click.
  • Characters outside of visible ranges are clipped to 0, eg. , \t etc.
  • -–._* map to 1 value, | maps to max value, ▁▂▃▄▅▆▇█ map to corresponding bars.
  • Accent acute  ́ (U+0301) shifts bar 1-step up, circumflex accent  ̂ (U+0302) 10-steps up. Eg. \u0101\u0302\u0302\u0301\u0301\u0301 shifts 23 steps up.
  • Accent grave  ̀ (U+0300) shifts bar 1-step down, caron  ̌ (U+030C) shifts 10 steps down, eg. \u0101\u030c\u0300\u0300\u0300 shifts 13 steps down.
  • Caret span is -20..120, so line-height = 1.4 is minimal non-overlapping selection.

JS package

To facilitate calculation, wavefont exposes a function that calculates string from values.

import wf from 'wavefont'

// get characters for values from 0..127 range
wf(0, 1, 50, 99, 127, ...) // ĀāIJţŤ...

Building

make build

See also

  • linefont − font-face for rendering linear data.

References

🕉

More Repositories

1

linefont

Font for rendering line chart data
JavaScript
156
star
2

sprae

∴ DOM tree microhydration
JavaScript
125
star
3

gl-waveform

Performant waveform renderer.
HTML
100
star
4

gl-spectrum

📉 Spectrum visualizer
JavaScript
93
star
5

pan-zoom

Pan / zoom for any element
JavaScript
88
star
6

spect

Observable selectors in DOM
JavaScript
75
star
7

settings-panel

Control panel for app, demo or tests
JavaScript
71
star
8

resizable

Resizable behavior for elements
JavaScript
68
star
9

subscript

Fast and tiny expression evaluator with minimal syntax.
JavaScript
68
star
10

gl-spectrogram

🌌 Render spectrogram of any audio source in webgl or canvas2d
JavaScript
62
star
11

svg-path-bounds

Get boundary box of svg path data
JavaScript
58
star
12

scope-css

Prefix each css selector with parent selector
JavaScript
57
star
13

bitmap-sdf

Calculate SDF for image/bitmap/bw data
JavaScript
43
star
14

svg-path-sdf

Generate signed distance bitmap for an svg path
JavaScript
42
star
15

save-file

Save any data to file in browser or node
JavaScript
42
star
16

plot-grid

2D/webgl grid for plots
JavaScript
33
star
17

fps-indicator

Tiny fps indicator for demo or tests
JavaScript
30
star
18

image-pixels

Load pixel data from any image source
JavaScript
29
star
19

gl-util

Set of practical webgl functions
JavaScript
25
star
20

enhook

Enable hooks for a function
JavaScript
24
star
21

wavearea

Multiline audio player / editor
JavaScript
23
star
22

arraybuffer-to-string

Convert ArrayBuffer to string
JavaScript
23
star
23

xhtm

XHTM − eXtended Hyperscript Tagged Markup
JavaScript
23
star
24

draggy

Draggable provider
JavaScript
23
star
25

image-encode

Encode pixels data to PNG, GIF, BMP, TIF or JPG
JavaScript
22
star
26

unihooks

Universal unreacted hooks
JavaScript
21
star
27

image-decode

Decode image data from any image format
JavaScript
21
star
28

autoesm

Import esm in node@13+ based on source, not package.json
JavaScript
21
star
29

font-atlas-sdf

Populate <canvas> with SDF font atlas texture
JavaScript
19
star
30

sort-ids

Calculate ids corresponding to sorting an input array
JavaScript
19
star
31

image-output

Output image to a file, stream, canvas, console, buffer or any other destination
JavaScript
18
star
32

watr

Light & fast wasm text compiler & formatter
WebAssembly
18
star
33

optical-properties

Get character optical properties
JavaScript
18
star
34

gauge

Circular gauge indicator component
JavaScript
16
star
35

swapdom

Fast & tiny DOM differ
JavaScript
15
star
36

mell

Microlanguage for audio-processing
JavaScript
13
star
37

connection-line

Connector line DOM element (NOT MAINTAINED)
JavaScript
13
star
38

point-cluster

2d point clustering for datavis purposes.
JavaScript
12
star
39

dotprop

Get property value by string dot notation
JavaScript
12
star
40

image-equal

Test if two images are equal
JavaScript
11
star
41

sube

Subscribe to any reactive source, weakly
JavaScript
11
star
42

get-uid

Generate unique numeric id.
JavaScript
11
star
43

string-to-arraybuffer

Convert plain/base64/datauri string to ArrayBuffer
JavaScript
10
star
44

templize

Template parts for DOM elements
JavaScript
10
star
45

placer

Place any element relative to any other element the way you define
JavaScript
10
star
46

signal-struct

Combined signal storage
JavaScript
10
star
47

hyperf

Hypertext fragment builder
JavaScript
10
star
48

any-hooks

Resolve any installed hooks
JavaScript
9
star
49

tst

Tests without efforts
JavaScript
9
star
50

to-array-buffer

Convert any binary-like data to ArrayBuffer
JavaScript
9
star
51

color-tool

Color picker component
JavaScript
9
star
52

parse-fraction

Parse numerator and denominator from a string
JavaScript
8
star
53

weakset

Weakset polyfill.
JavaScript
8
star
54

element-props

Normalized access to element attributes/properties
JavaScript
8
star
55

emmy

Events toolkit
JavaScript
8
star
56

prepr

C/GLSL-preprocessor in JS
JavaScript
8
star
57

template-parts

Template Parts ponyfill
JavaScript
7
star
58

input-number

Make input recognize numbers
JavaScript
7
star
59

detect-kerning

Calculate kerning pairs for a font
JavaScript
7
star
60

wait-please

Await interval constructors
JavaScript
7
star
61

popoff

Create popups, dropdowns, tooltips and sidebars
JavaScript
7
star
62

st8

Tiny state machine
JavaScript
6
star
63

unhook

Unscoped hooks
JavaScript
6
star
64

analogs

Some research, thoughts and ideas for packages in browserify/webpack
JavaScript
6
star
65

key-name

Dict of keycodes for keynames
6
star
66

value-ref

Value reference with reactivity
JavaScript
6
star
67

slidy

Range slider component
JavaScript
6
star
68

array-rearrange

Rearrange array elements by index
JavaScript
6
star
69

parenthesis

Parse / stringify parenthesis
JavaScript
5
star
70

app-audio

Get audio for application, demo or tests.
JavaScript
5
star
71

typographic-hotkeys

Anyhotkey™ script that extends keyboard with typographic keys.
AutoHotkey
5
star
72

pretty-number

Format number to more humane form than toFixed
JavaScript
5
star
73

audio-experiment

Assorted sound experiments
JavaScript
5
star
74

color-ranger

Render range for a color space. Useful in color pickers.
JavaScript
5
star
75

primitive-pool

Get unique object for a primitive value to store primitives in WeakMap etc.
JavaScript
4
star
76

flip-pixels

Flip pixel data after readPixels
JavaScript
4
star
77

mobilify

📱 Make stream of html mobile-friendly
JavaScript
4
star
78

add-font

Attach font to the page by url or from array buffer
JavaScript
4
star
79

esdom

Build DOM from AST, change it and convert back to AST.
JavaScript
4
star
80

gaussian-fit

Fit mixture of gaussians into data
JavaScript
4
star
81

aligner

Align DOM elements as Photoshop/Illustrator does
JavaScript
4
star
82

has-hover

Test if device has hover support
JavaScript
4
star
83

piano-game

Guess notes from stave
JavaScript
3
star
84

obj-map-prop

Map object properties by a dict
JavaScript
3
star
85

audio-lab

🔬 Audio streams playground
JavaScript
3
star
86

normal-pdf

Get gaussian density at a point
JavaScript
3
star
87

pxls

Convert any input pixels array to normalized 4-channel uint8 array
JavaScript
3
star
88

clip-pixels

Slice rectangle from pixels array
JavaScript
3
star
89

is-svg-path

Check if a string is an svg path data
JavaScript
3
star
90

polyline-clean

Clean polygon or polyline coordinates: remove duplicates, degenerate, collinear or bad items, trim.
JavaScript
2
star
91

to-uint8

Convert input argument to Uint8Array
JavaScript
2
star
92

nogl

WebGL shim for node
JavaScript
2
star
93

parse-rect

Return rectangle object from any possible rect-like argument
JavaScript
2
star
94

cln

Clean source code for comparison
JavaScript
2
star
95

lines-intersection

Get intersection point of two lines, if any
JavaScript
2
star
96

russi

Russian language tools
JavaScript
2
star
97

piano-key

Piano keys frequences
JavaScript
2
star
98

swizz

Provide swizzles for an array
JavaScript
2
star
99

symbol-dispose

Symbol.dispose / Symbol.asyncDispose ponyfill
JavaScript
1
star
100

negative-index

Convert negative index to positive, starting from the end
JavaScript
1
star