ASCII Spectrogram
@sonoscope/ascii-spectrogram turns your audio into ASCII art. Louder frequencies show up as denser characters, creating a live terminal-style visualizer on a canvas.
Interactive preview
Section titled “Interactive preview”Installation
Section titled “Installation”npm install @sonoscope/ascii-spectrogram @sonoscope/coreQuick start
Section titled “Quick start”Importing the /auto path automatically registers the "ascii" renderer keyword:
import "@sonoscope/ascii-spectrogram/auto";import { Sonoscope } from "@sonoscope/core";
const scope = await Sonoscope.fromUrl("/audio/sample.wav");
scope.createSpectrogram(canvas, { renderer: "ascii", rendererOptions: { colorMode: "green", // "colormap", "monochrome", "green", or "amber" fontSize: 10, },});
scope.attachNavigation(canvas);Options
Section titled “Options”| Option | Type | Default | What it does |
|---|---|---|---|
colorMode | "colormap" | "monochrome" | "green" | "amber" | "colormap" | Color scheme for the text |
charSet | string | " .:-=+*#%@" | Characters used, from quiet to loud |
fontSize | number | 10 | Size of each character in pixels |
fontFamily | string | "monospace" | Font used for the text |
textColor | string | "#00ff66" | Text color when colorMode is "monochrome" |
backgroundColor | string | "#0a0a0c" | Background color behind the text |
invert | boolean | false | Flips bright and dark characters |
Try it yourself!
Section titled “Try it yourself!”Experiment with different fonts, character sets, and color modes in the live editor: