Skip to content

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.



Terminal window
npm install @sonoscope/ascii-spectrogram @sonoscope/core

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);

OptionTypeDefaultWhat it does
colorMode"colormap" | "monochrome" | "green" | "amber""colormap"Color scheme for the text
charSetstring" .:-=+*#%@"Characters used, from quiet to loud
fontSizenumber10Size of each character in pixels
fontFamilystring"monospace"Font used for the text
textColorstring"#00ff66"Text color when colorMode is "monochrome"
backgroundColorstring"#0a0a0c"Background color behind the text
invertbooleanfalseFlips bright and dark characters

Experiment with different fonts, character sets, and color modes in the live editor: