Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

17 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽต Magenta RT JAM CLI

Real-time AI Audio Jamming in Your Terminal
Transform your music with PyTorch-powered neural networks

Python 3.10+ PyTorch uv


โœจ What is This?

Magenta RT JAM CLI brings real-time AI audio generation to your command line. Feed it your music, and watch as PyTorch-powered neural networks learn and jam along with you in real-time. Originally a complex Colab notebook, now a streamlined CLI that just works.

๐Ÿš€ Key Features:

  • ๐ŸŽค Live microphone jamming - AI responds to your playing in real-time
  • ๐ŸŽ›๏ธ Interactive TUI by default - Real-time volume meters and live session control
  • ๐Ÿ“ Audio file processing - Enhance existing recordings
  • ๐Ÿง  Built-in PyTorch models - No complex setup required
  • ๐Ÿ“Š Rich terminal UI - Beautiful progress bars and live stats
  • ๐Ÿ’พ Auto-save sessions - Never lose your jams
  • โšก GPU acceleration - CUDA & Apple Silicon support

๐Ÿƒโ€โ™‚๏ธ Quick Start

Installation

# Run directly from GitHub
uvx --from git+https://github.com/oxysoft/MagentaRT-jamcli jamcli --help

# Or install locally for repeated use
uv tool install git+https://github.com/oxysoft/MagentaRT-jamcli
jamcli --help  # Now available globally

Your First Jam Session

# Start jamming with TUI (default)! Models download automatically:
uv run jamcli run --input-source mic --model-tag medium

# Or use console mode instead:
uv run jamcli run --input-source mic --model-tag medium --no-tui

# Or if installed globally with uvx:
jamcli run --input-source mic --model-tag medium

That's it! The AI will start jamming along with whatever you play. The Terminal User Interface with live volume meters is now the default - use --no-tui if you prefer the simple console interface.


๐ŸŽ›๏ธ Terminal User Interface (TUI) - Default Mode

The TUI provides a professional full-screen interface with real-time monitoring and is now the default mode:

Features

  • Live Volume Meters - Real-time RMS visualization for Input, AI Output, and Mixed audio
  • Session Statistics - Runtime, chunks processed, generation rate, latency, and performance metrics
  • Interactive Controls - Keyboard shortcuts for session control
  • System Status - Model and device status indicators
  • Peak Hold Indicators - Volume bars with 1-second peak hold visualization

TUI Controls

Key Action
SPACE Start/Stop Recording Session
R Reset Statistics
Q or Ctrl+C Quit Application

TUI Layout

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ๐ŸŽต Magenta RT JAM CLI - Terminal Interface      โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Configuration        โ”‚ Live Volume Levels       โ”‚
โ”‚ Model: large         โ”‚ Input      โ–‘โ–‘โ–‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘  โ”‚
โ”‚ Device: gpu          โ”‚ AI Output  โ–‘โ–‘โ–‘โ–‘โ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘  โ”‚
โ”‚ Input: mic           โ”‚ Mixed      โ–‘โ–‘โ–‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘  โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Session Statistics   โ”‚ System Status            โ”‚
โ”‚ Runtime: 0:02:34     โ”‚ Status: ๐Ÿ”ด RECORDING     โ”‚
โ”‚ Chunks: 153          โ”‚ Model: โœ“ Ready          โ”‚
โ”‚ Rate: 0.5 chunks/s   โ”‚ Audio: โœ“ Connected      โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ SPACE: Start/Stop  R: Reset  Q: Quit            โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“š Complete Command Reference

๐ŸŽต Running Audio Sessions

Basic Usage

# Jam with microphone (TUI default)
โฏ uv run jamcli run --input-source mic

# Use console mode instead
โฏ uv run jamcli run --input-source mic --no-tui

Audio File Processing

# Process an audio file
โฏ uv run jamcli run --audio-file path/to/song.wav --model-tag large

# Custom loop settings
โฏ uv run jamcli run --audio-file song.wav --bpm 140 --beats-per-loop 16

Advanced Options

# Full control over the session (TUI default)
โฏ uv run jamcli run \
    --input-source mic \
    --model-tag large \
    --device gpu \
    --bpm 120 \
    --beats-per-loop 8 \
    --intro-loops 4

# Or force console mode
โฏ uv run jamcli run --input-source mic --model-tag large --no-tui

๐Ÿค– Model Management

List Available Models

โฏ uv run jamcli models list
                         Available PyTorch Audio Models                         
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
โ”ƒ Model  โ”ƒ   Status    โ”ƒ     Size โ”ƒ Description         โ”ƒ Location             โ”ƒ
โ”กโ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ
โ”‚ large  โ”‚ โœ“ Available โ”‚   7.4 MB โ”‚ Large PyTorch audio โ”‚ /home/user/.cache/mโ€ฆ โ”‚
โ”‚        โ”‚             โ”‚          โ”‚ generation model    โ”‚                      โ”‚
โ”‚        โ”‚             โ”‚          โ”‚ 1024d, 16L, 16H     โ”‚                      โ”‚
โ”‚ medium โ”‚ โœ— Not Available โ”‚       -- โ”‚ Medium PyTorch      โ”‚ Not downloaded       โ”‚
โ”‚        โ”‚             โ”‚          โ”‚ audio generation    โ”‚                      โ”‚
โ”‚        โ”‚             โ”‚          โ”‚ model               โ”‚                      โ”‚
โ”‚        โ”‚             โ”‚          โ”‚ 512d, 12L, 12H      โ”‚                      โ”‚
โ”‚ small  โ”‚ โœ“ Available โ”‚ 696.0 KB โ”‚ Small PyTorch audio โ”‚ /home/user/.cache/mโ€ฆ โ”‚
โ”‚        โ”‚             โ”‚          โ”‚ generation model    โ”‚                      โ”‚
โ”‚        โ”‚             โ”‚          โ”‚ 256d, 8L, 8H        โ”‚                      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Download Models (with Progress)

โฏ uv run jamcli models download large
โœ“ large model ready โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 100% 0:00:01 56 bytes/s 0:00:00
โœ“ Built-in model 'large' configured at /home/user/.cache/magenta-rt-jamcli/pytorch_audio_large

   Downloaded Files in pytorch_audio_large    
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
โ”ƒ File              โ”ƒ   Size โ”ƒ Type          โ”ƒ
โ”กโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ
โ”‚ config.json       โ”‚  235 B โ”‚ Configuration โ”‚
โ”‚ pytorch_model.bin โ”‚ 7.4 MB โ”‚ Model weights โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Total             โ”‚ 7.4 MB โ”‚               โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โœ“ Model 'large' ready at /home/user/.cache/magenta-rt-jamcli/pytorch_audio_large

Model Management

# Download specific model
โฏ uv run jamcli models download medium --force

# Clear cached models
โฏ uv run jamcli models clear small
โฏ uv run jamcli models clear all --confirm

๐ŸŽ›๏ธ Audio Device Management

List Audio Devices

โฏ uv run jamcli devices
                                    Available Audio Devices                                    
โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
โ”ƒ ID โ”ƒ Name                             โ”ƒ Max Inputs  โ”ƒ Max Outputs โ”ƒ Default Rate   โ”ƒ
โ”กโ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ
โ”‚  0 โ”‚ Built-in Microphone              โ”‚           2 โ”‚           0 โ”‚      48000 Hz  โ”‚
โ”‚  1 โ”‚ Built-in Output                  โ”‚           0 โ”‚           2 โ”‚      48000 Hz  โ”‚
โ”‚  2 โ”‚ USB Audio Device                 โ”‚           2 โ”‚           2 โ”‚      44100 Hz  โ”‚
โ””โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐ŸŽค Testing microphone... โœ“ Microphone working (RMS: 0.001493)
๐Ÿ”Š Testing speakers... โœ“ Speakers working

๐Ÿ“Š Session Management

View Past Sessions

โฏ uv run jamcli sessions
                           Saved Audio Sessions                           
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
โ”ƒ Filename                         โ”ƒ     Size โ”ƒ        Modified โ”ƒ
โ”กโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ
โ”‚ jamcli_mixed_20241208_143022.wav โ”‚  45.2 MB โ”‚ 2024-12-08 14:32 โ”‚
โ”‚ jamcli_output_20241208_143022.wavโ”‚  22.6 MB โ”‚ 2024-12-08 14:32 โ”‚
โ”‚ jamcli_input_20241208_143022.wav โ”‚  22.6 MB โ”‚ 2024-12-08 14:32 โ”‚
โ”‚ jamcli_mixed_20241208_142155.wav โ”‚  12.1 MB โ”‚ 2024-12-08 14:22 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Custom Output Directory

โฏ uv run jamcli sessions --output-dir /path/to/my/sessions

โš™๏ธ Configuration Management

Create Configuration File

โฏ uv run jamcli init-config --output my-settings.toml
Setting up Magenta RT JAM CLI configuration
Input source [mic/file] (file): mic
BPM (120): 140
Beats per loop (8): 16
Intro loops (4): 2
Device [cpu/gpu/mps] (cpu): gpu
Sample rate (48000): 
Chunk seconds (2.0): 
Temperature (1.2): 1.5
Top-k (30): 20
Guidance weight (1.5): 

Configuration saved to my-settings.toml

Use Configuration File

โฏ uv run jamcli run --config my-settings.toml

โฏ uv run jamcli show-config my-settings.toml
       Configuration        
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”“
โ”ƒ Setting         โ”ƒ Value  โ”ƒ
โ”กโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ
โ”‚ Input Source    โ”‚ mic    โ”‚
โ”‚ BPM             โ”‚ 140    โ”‚
โ”‚ Beats per Loop  โ”‚ 16     โ”‚
โ”‚ Intro Loops     โ”‚ 2      โ”‚
โ”‚ Device          โ”‚ gpu    โ”‚
โ”‚ Model Tag       โ”‚ large  โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Sample Rate     โ”‚ 48000  โ”‚
โ”‚ Chunk Seconds   โ”‚ 2.0    โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Temperature     โ”‚ 1.5    โ”‚
โ”‚ Top-k           โ”‚ 20     โ”‚
โ”‚ Guidance Weight โ”‚ 1.5    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐ŸŽฌ Live Session Demo

Here's what a complete jamming session looks like:

Starting a Session

โฏ uv run jamcli run --input-source mic --model-tag large --device gpu

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Magenta RT JAM CLI                    โ”‚
โ”‚ Audio Injection with Magenta RealTime โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

       Configuration        
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”“
โ”ƒ Setting         โ”ƒ Value  โ”ƒ
โ”กโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ
โ”‚ Input Source    โ”‚ mic    โ”‚
โ”‚ BPM             โ”‚ 120    โ”‚
โ”‚ Beats per Loop  โ”‚ 8      โ”‚
โ”‚ Intro Loops     โ”‚ 4      โ”‚
โ”‚ Device          โ”‚ gpu    โ”‚
โ”‚ Model Tag       โ”‚ large  โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Sample Rate     โ”‚ 48000  โ”‚
โ”‚ Chunk Seconds   โ”‚ 2.0    โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Temperature     โ”‚ 1.2    โ”‚
โ”‚ Top-k           โ”‚ 30     โ”‚
โ”‚ Guidance Weight โ”‚ 1.5    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Continue with these settings? [y/n]: y

Auto-Download & Initialization

โ ธ โœ“ Model ready        0:00:01
โ ธ โœ“ Codec ready        0:00:00  
โ ธ โœ“ System initialized 0:00:01
โ ธ โœ“ Audio ready        0:00:00
โœ“ Magenta RT system fully initialized

                                    Available Audio Devices                                    
โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
โ”ƒ ID โ”ƒ Name                             โ”ƒ Max Inputs  โ”ƒ Max Outputs โ”ƒ Default Rate   โ”ƒ
โ”กโ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ
โ”‚  0 โ”‚ Built-in Microphone              โ”‚           2 โ”‚           0 โ”‚      48000 Hz  โ”‚
โ”‚  1 โ”‚ Built-in Output                  โ”‚           0 โ”‚           2 โ”‚      48000 Hz  โ”‚
โ””โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐ŸŽค Testing microphone... โœ“ Microphone working (RMS: 0.001493)
๐Ÿ”Š Testing speakers... โœ“ Speakers working

Live Jamming Session

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Starting Audio Injection Session          โ”‚
โ”‚ Model will join after 26.67 seconds       โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Ready to start? [y/n]: y

๐ŸŽต Audio session running! Press Ctrl+C to stop

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
โ”ƒ Audio Stats  โ”ƒ    Value  โ”ƒ Performance  โ”ƒ      Value   โ”ƒ 
โ”กโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ
โ”‚ Runtime      โ”‚   1m 23s  โ”‚ Latency      โ”‚     3.2ms    โ”‚
โ”‚ Chunks       โ”‚      42   โ”‚ Processing   โ”‚    97.2%     โ”‚
โ”‚ Input RMS    โ”‚   0.045   โ”‚ GPU Usage    โ”‚    84%       โ”‚
โ”‚ Output RMS   โ”‚   0.156   โ”‚ Memory       โ”‚   1.2GB      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โ ผ ๐ŸŽค Listening... ๐Ÿค– AI Jamming ๐ŸŽต Mixing... โšก GPU Processing

Session Complete

^C
Stopping session...

โœ“ Session completed
โœ“ Output saved: jamcli_output/jamcli_output_20241208_143022.wav
โœ“ Input saved: jamcli_output/jamcli_input_20241208_143022.wav  
โœ“ Mixed audio saved: jamcli_output/jamcli_mixed_20241208_143022.wav

๐ŸŽจ Model Comparison

Model Sizes & Capabilities

Model Size Parameters Best For Speed
small 696 KB 256d, 8L, 8H Quick tests, CPU-only โšกโšกโšก
medium 2.1 MB 512d, 12L, 12H Balanced quality/speed โšกโšก
large 7.4 MB 1024d, 16L, 16H Best quality, GPU recommended โšก

Auto-Download Example

Models download automatically when needed:

โฏ uv run jamcli run --model-tag medium --input-source mic

# If medium model isn't available, you'll see:
โœ“ medium model ready โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 100% 0:00:01 72 bytes/s 0:00:00
โœ“ Built-in model 'medium' configured at /home/user/.cache/magenta-rt-jamcli/pytorch_audio_medium

    Downloaded Files in pytorch_audio_medium    
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
โ”ƒ File              โ”ƒ     Size โ”ƒ Type          โ”ƒ
โ”กโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ
โ”‚ config.json       โ”‚    236 B โ”‚ Configuration โ”‚
โ”‚ pytorch_model.bin โ”‚ 518.4 KB โ”‚ Model weights โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Total             โ”‚ 518.6 KB โ”‚               โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

# Then immediately continues with session setup...

๐Ÿ”ง Configuration Options

TOML Configuration File Example

# Basic settings
input_source = "mic"
audio_file = "path/to/audio.wav"  # Only used if input_source = "file"
bpm = 140
beats_per_loop = 16
intro_loops = 2
device = "gpu"  # cpu, gpu, or mps
model_tag = "large"

[audio]
sample_rate = 48000
chunk_seconds = 2.0

[model]
temperature = 1.2      # Creativity (0.1-2.0)
topk = 30             # Sampling diversity
guidance_weight = 1.5  # How much to follow input
model_volume = 0.8    # AI output volume
input_volume = 1.0    # Your input passthrough volume
model_feedback = 0.95 # How much AI hears itself
input_gap = 400       # ms of recent input to silence

Device Selection

  • cpu - Works everywhere, slower
  • gpu - CUDA GPUs, much faster
  • mps - Apple Silicon (M1/M2/M3), optimized for Mac

The CLI automatically detects your hardware and suggests the best option.


๐Ÿš€ Advanced Usage

Batch Processing Multiple Files

# Process all WAV files in a directory
for file in *.wav; do
    uv run jamcli run --audio-file "$file" --model-tag large
done

Custom Session Directory

# Save sessions to specific location
mkdir ~/my-jams
uv run jamcli run --input-source mic
# Sessions auto-save to jamcli_output/, move them:
mv jamcli_output/* ~/my-jams/

Performance Monitoring

# Run with verbose output to see detailed stats
uv run jamcli run --input-source mic --model-tag large 2>&1 | tee session.log

๐Ÿ› ๏ธ Troubleshooting

Common Issues

No Audio Devices Found

โฏ uv run jamcli devices
# If empty, install PortAudio:
# macOS: brew install portaudio
# Ubuntu: sudo apt-get install portaudio19-dev
# Windows: Usually works out of the box

PyTorch Not Found

# Reinstall with PyTorch dependencies
โฏ uv sync --reinstall

GPU Not Detected

# Check CUDA installation
โฏ python -c "import torch; print(f'CUDA: {torch.cuda.is_available()}')"
# Check MPS (Mac)
โฏ python -c "import torch; print(f'MPS: {torch.backends.mps.is_available()}')"

Poor Audio Quality

  • Try a larger model: --model-tag large
  • Increase sample rate in config: sample_rate = 48000
  • Use GPU for better real-time performance: --device gpu

soundfile Missing

# Install optional audio export dependency
โฏ uv add soundfile

Getting Help

# Help for any command
โฏ uv run jamcli --help
โฏ uv run jamcli run --help
โฏ uv run jamcli models --help

# Or install globally for direct access
โฏ uvx --from . jamcli --help

๐ŸŽฏ What's Under the Hood

This CLI transforms the complex Magenta RT Audio Injection notebook into a production-ready tool:

  • ๐Ÿง  PyTorch Neural Networks - Built-in audio generation models
  • ๐ŸŽต Real-time Processing - Low-latency audio streaming with crossfading
  • ๐Ÿ“Š Rich Terminal UI - Progress bars, live stats, beautiful tables
  • ๐Ÿ’พ Auto-save - Never lose your creative sessions
  • โšก Hardware Acceleration - CUDA & Apple Silicon optimized
  • ๐Ÿ”ง Zero Configuration - Works out of the box, customize as needed

๐Ÿ“œ License

Apache 2.0 License - Same as the original Magenta project. Model weights under Creative Commons Attribution 4.0.


๐ŸŽต Happy Jamming! ๐ŸŽต

Made with โค๏ธ for the AI music community

About

๐ŸŽต Real-time AI Audio Jamming CLI - Production-ready upgrade from the original Magenta RT notebook with PyTorch-powered neural networks

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages