Skip to content
LargeModGamesPublic

About

Milkdrop Audio VIsualizer: MilkDrop presets for any music, in your terminal

Topics

Resources

Contributing

Stars

5 stars

Watchers

0 watching

Forks

Latest commit

 

History

76 Commits

Folders and files

Repository files navigation

mavi

Milkdrop Audio VIsualizer: MilkDrop presets for any music, drawn in your terminal.

mavi listens to the sound your computer plays and renders MilkDrop-format presets (.milk, and MilkDrop 3 .milk2 double presets), including MilkDrop 2 presets with pixel shaders, in your terminal: as real pixels where the terminal has the Kitty or Sixel image protocol, and as color blocks in any other truecolor terminal. It runs on the GPU through tidewarp.

Photosensitivity warning. MilkDrop presets may contain flashing lights and fast patterns. mavi shows a warning on first start and has a photosensitive mode (f, or --photosensitive) that slows down brightness changes and dims bright peaks. It lowers the risk, but it cannot promise that no image triggers a reaction.

mavi in kitty: a blue and green MilkDrop preset with the status line below it

Show the animated demo (may contain flashing lights)

mavi in kitty at 60 frames per second: two MilkDrop presets that react to the music

Install

cargo install mavi --locked

On Arch Linux, install the prebuilt binary from the AUR (mavi-bin, or mavi to build it from source):

yay -S mavi-bin

Prebuilt binaries for Windows, macOS (Apple Silicon and Intel) and Linux (x86_64) are on the GitHub Releases page. The Linux binary needs glibc 2.39 or newer (Ubuntu 24.04, Debian 13). cargo install needs PipeWire 0.3.53 or newer, so it also builds on Debian 12 but not on Ubuntu 22.04. On a Mac, the binary and cargo install need macOS 14.2 or newer. The macOS binary is not notarized: when macOS blocks it after a browser download, run xattr -d com.apple.quarantine mavi once, or allow it under System Settings, Privacy & Security.

On Linux, mavi needs the ALSA and PipeWire libraries at runtime. To build it, also install their headers and clang, for example sudo apt install libasound2-dev libpipewire-0.3-dev clang on Debian and Ubuntu.

Use

mavi                      # the presets in ~/.config/mavi/presets, or the built-in ones
mavi path/to/presets      # every .milk and .milk2 file in a folder, in a shuffled order
mavi --photosensitive     # start in the photosensitive mode
mavi presets --textures path/to/textures   # also read texture images from a folder
mavi --graphics blocks    # draw with color blocks, also where an image protocol works
Flag What it does
[preset folder] play the .milk and .milk2 files in this folder and its subfolders
--photosensitive start in the photosensitive mode
--textures FOLDER also read texture images from this folder; give it more than once for more folders
--graphics KIND draw with kitty, sixel or blocks instead of the best one the terminal reports
--cell WxH the size of a character cell in screen pixels, for example 9x19, when circles show as ovals (see Round circles)
-h, --help print the help
-V, --version print the version

Without a preset folder, mavi plays the presets in ~/.config/mavi/presets, a folder it creates at its first start, on Windows and macOS too (XDG_CONFIG_HOME moves it, as it moves the settings). When no .milk or .milk2 file is found, mavi plays tidewarp's built-in presets and says so on the status line. Folders whose name starts with _ are skipped, as packs keep broken presets there.

Presets that sample images by name (sampler_clouds, sampler_rand00) get them from the .jpg, .jpeg, .jfif, .png and .tga files in the preset folder and in every --textures folder, also in their subfolders. A texture that no folder has shows as a grey surface.

Key Action
n, → next preset
p, ← previous preset
space hold the preset (no change every 30 seconds)
/ search the preset names: type a part of a name, Enter blends to the next match, Backspace erases, Esc closes the search
* mark the preset as a favourite, or remove the mark
F all presets or the favourites only
x hide the preset: it never plays again
f photosensitive mode on or off
q, Esc, Ctrl+C quit (in the search, only Ctrl+C)

The settings, the favourite and the hidden presets are kept in settings.txt, favourites.txt and hidden.txt, in ~/.config/mavi (or in the mavi folder of XDG_CONFIG_HOME when that is set). Each line of the two lists is one preset: its path below the preset folder, or builtin: and the name for a built-in preset. To play a hidden preset again, remove its line.

Without a GPU, mavi plays the presets that need no shaders on the CPU.

Audio

mavi plays what your computer plays:

  • Windows: a loopback of the default output device. When the default output changes, mavi follows it.
  • Linux: the monitor of the default sink through PipeWire, or a monitor device through ALSA where mavi does not reach PipeWire.
  • macOS: the default input device, not the output. To capture the music, install a loopback device such as BlackHole, play the music to it and make it the default input.

When that source does not open on Windows or Linux, mavi takes the default input. The status line names the source it captures.

Terminals

At start, mavi asks the terminal which image protocol it has and takes the best one:

  • Kitty graphics: the best picture. Full color at up to four times the pixels of Sixel, scaled smoothly by the terminal. When the terminal runs on the same machine, frames go to it as temporary files in /dev/shm, so 60 frames per second hold in a large window; over ssh they go through the terminal stream.
  • Sixel: up to 256 colors, chosen again for each frame.
  • Color blocks (▀): two pixels per character, in any truecolor terminal.

Inside tmux and screen mavi does not ask for Kitty graphics.

Round circles

mavi shapes the picture from the cell size that the terminal reports. Windows Terminal reports 10x20 pixels for every font and then scales the Sixel image to the real cell, so with most fonts circles show as ovals. Give the real cell size in screen pixels with --cell, or for every run as a line in settings.txt:

cell=9x19

To find the size, take a screenshot and divide the width of the text area in pixels by the columns, and its height by the rows. For example, CaskaydiaCove NF at 12 pt on a 100 % display scale has cells of 9x19. When you change the font, its size or the zoom of the terminal, the cell size changes too.

Tested terminals

Terminal Drawing Tested
Windows Terminal Sixel yes
WezTerm Kitty graphics yes
foot Sixel yes, on Linux
kitty Kitty graphics yes, on Linux: 60 frames per second in a large window
Others color blocks, or Kitty or Sixel when the terminal reports it no

Where to find presets

mavi ships only tidewarp's few built-in presets, because almost no preset pack has a licence that permits redistribution. The first two packs below are free downloads from their own pages. Download one, extract it into ~/.config/mavi/presets for a plain mavi, or give mavi its folder:

Status

Early development. A preset that renders differently from MilkDrop is an engine bug and belongs in tidewarp.

License

Licensed under the MIT license. Contributions are licensed the same way.

mavi is not affiliated with Nullsoft, Winamp or the authors of MilkDrop.

About

Milkdrop Audio VIsualizer: MilkDrop presets for any music, in your terminal

Topics

Resources

Contributing

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages