Skip to content

Make mediocre music compositions with LLMs for synthetic dataset generation!

Notifications You must be signed in to change notification settings

agrathwohl/mediocre

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

27 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽต MEDIOCRE-MUSIC ๐ŸŽต

Genre-bending AI music composition toolkit for LLM training dataset creation.

npm version MIT License Node.js Version

๐Ÿ”Š **Create intricate, nuanced, and musically-sophisticated audio using our unique approach to LLM prompting for musical generation. Perfect for training LLM models on audio processing tasks like mixing, de-verbing, and effects processing.

๐Ÿš€ Examples

trombone.webm
berio.webm
pcmusic.webm

โœจ Features

  • ๐ŸŽญ Genre Fusion - Combine classical and modern elements into unique hybrids
  • ๐Ÿค– AI Composition - Generate ABC notation using Claude 3.7 Sonnet or Ollama
  • ๐ŸŽผ Format Conversion - ABC โ†’ MIDI โ†’ WAV pipeline with PDF scores
  • ๐ŸŽ›๏ธ Audio Processing - Apply reverb, delay, distortion and more
  • ๐Ÿ“Š Dataset Building - Create structured datasets for ML training
  • ๐Ÿ–ฅ๏ธ Interactive TUI - Browse compositions with playback and rating system
  • ๐Ÿ”„ Model Flexibility - Switch between Anthropic Claude and Ollama models

๐Ÿ› ๏ธ Installation

Quick Start (CLI)

# Global installation
npm install mediocre-music -g

# Using Anthropic Claude
export ANTHROPIC_API_KEY=your_key_here

# OR Using Ollama (running locally)
export AI_PROVIDER=ollama
export OLLAMA_ENDPOINT=http://localhost:11434
export OLLAMA_MODEL=llama3

Development Setup

# Clone and setup
git clone https://github.com/yourusername/mediocre.git
cd mediocre
npm install

# Create .env with your API key settings
# For Anthropic:
echo "ANTHROPIC_API_KEY=your_key_here" > .env

# OR for Ollama:
echo "AI_PROVIDER=ollama" > .env
echo "OLLAMA_ENDPOINT=http://localhost:11434" >> .env
echo "OLLAMA_MODEL=llama3" >> .env

๐Ÿ“ฆ Requirements

  • Node.js 18+
  • AI Provider (choose one):
    • Anthropic API key (Claude 3.7 Sonnet recommended)
    • Ollama with a compatible model (llama3, mistral, etc.)
  • External tools:
    • abcmidi - ABC โ†” MIDI conversion
    • abcm2ps & ghostscript - PDF score generation
    • timidity - MIDI โ†’ WAV conversion
    • sox - Audio effects processing

๐ŸŽฎ Usage Guide

Note: All commands that work with existing music files (like modify, mix-and-match, info, more-like-this, etc.) accept direct file paths to ABC notation files, allowing precise control of which files to manipulate.

Generate Wild Genre Hybrids

# Create 5 hybrid genres
mediocre genres -n 5

# Customize genre combinations
mediocre genres -c "baroque,serialist,minimalist" -m "techno,trap,vaporwave" -n 3

Compose Musical Masterpieces

# Generate a composition for a specific hybrid
mediocre generate -g "Baroque_x_Techno" -c 1

# Generate multiple pieces with random hybrids
mediocre generate -C "baroque,classical" -M "techno,ambient" -c 3

# Use custom system prompt
mediocre generate -g "Renaissance_x_Trap" --system-prompt examples/custom-system-prompt.txt

# Use Ollama instead of Anthropic Claude
mediocre generate -g "Baroque_x_Techno" --ai-provider ollama --ollama-model llama3

Process & Convert

# Convert ABC โ†’ MIDI โ†’ WAV
mediocre convert --to midi -d ./output
mediocre convert --to wav -d ./output

# Convert to WAV with individual instrument stems
mediocre convert --to wav -d ./output --stems

# Generate PDF scores
mediocre convert --to pdf -d ./output

# Add effects
mediocre process -d ./output -e reverb

Modify Compositions

# Extend or transform existing pieces
mediocre modify "/path/to/baroque_x_jazz-score1-1234567890.abc" -i "Add a dramatic breakdown with harpsichord solo"

Get Information About a Composition

# Display detailed information about a composition
mediocre info "/path/to/baroque_x_jazz-score1-1234567890.abc"

Generate More Like an Existing Composition

# Create compositions similar to an existing one
mediocre more-like-this "/path/to/baroque_x_jazz-score1-1234567890.abc" -c 2 --solo

Mix and Match Compositions

# Create a new composition by combining elements from multiple ABC files
mediocre mix-and-match -f "/path/to/first.abc" "/path/to/second.abc" --instruments "Piano,Violin,Synthesizer"

Add Lyrics to a Composition

# Add lyrics to an existing MIDI file using a corresponding ABC file
mediocre lyrics -m "/path/to/composition.mid" -a "/path/to/composition.abc" -p "A song about the beauty of nature" --instruments "Piano,Vocals"

Build ML Datasets

# Create structured dataset
mediocre dataset -d ./output

Validate and Fix ABC Notation

# Process a single file
mediocre validate-abc -i "/path/to/composition.abc" -o "/path/to/fixed.abc"

# Process all ABC files in the output directory
mediocre validate-abc

๐ŸŽฏ Hybrid Genre System

Mix and match from these example categories to create unique sonic fusions:

๐ŸŽป Classical/Traditional

  • Baroque, Classical, Romantic
  • Renaissance, Medieval, Impressionist
  • Serialist, Minimalist, Neoclassical
  • Opera, Cantata, Oratorio
  • Chamber, Concerto, Ballet, Fugue

๐ŸŽง Modern

  • Techno, House, Drum and Bass
  • Dubstep, Ambient, IDM, Glitch
  • Vaporwave, Lo-fi, Chillwave
  • Trap, Drill, Grime, Hip Hop
  • Rock, Metal, Punk, Jazz, Funk

Come up with your own crazy ideas and give them a try! I merged Cardi B and John Zorn and I think it turned out really great.

๐Ÿง  How It Works

  1. Genre Fusion - AI combines musical traditions into hybrid forms
  2. Composition - AI (Claude or Ollama) creates ABC notation with abc2midi extensions
  3. Conversion - Pipeline transforms notation into playable formats
  4. Processing - Effects chain generates training pairs
  5. Dataset - Organized structure with complete metadata

Observations

Read OBSERVATIONS.md for some helpful hints about how to most effectively utilize the tool.

๐Ÿ“ Project Structure

mediocre/
โ”œโ”€โ”€ src/              # Source code
โ”‚   โ”œโ”€โ”€ commands/     # Command implementations
โ”‚   โ”œโ”€โ”€ utils/        # Utility functions
โ”‚   โ””โ”€โ”€ index.js      # Entry point
โ”œโ”€โ”€ output/           # Generated music files
โ”œโ”€โ”€ dataset/          # Final processed dataset
โ””โ”€โ”€ temp/             # Temporary files

๐Ÿ“„ License

MIT

About

Make mediocre music compositions with LLMs for synthetic dataset generation!

Resources

Stars

Watchers

Forks

Packages

No packages published