Skip to main content

A procedural, generative music engine with real-time DSP โ€” synthesized instruments, smart chord progressions, and live parameter control

Project description

๐ŸŽธ Engine La Musique

PyPI version License: MIT Python 3.9+

A procedural, generative music engine built entirely in Python. No samples, no WAV files โ€” every sound is synthesized in real-time using pure DSP.

Engine La Musique simulates a full band with drums, bass, rhythm, lead, pads, and arpeggios across 4 distinct styles โ€” all driven by smart music theory and a live conductor system.


โœจ Features

  • 4 Styles: Rock, Pop, EDM, Classical โ€” each with unique instrument voicings and arrangements
  • Generative Music Theory: Automatic chord progressions, scale mapping, and voice leading
  • Synthesized Instruments:
    • ๐ŸŽธ Guitar โ€” Karplus-Strong string synthesis with strumming, palm mutes, and distortion
    • ๐Ÿฅ Drums โ€” Procedurally synthesized kick, snare, hi-hats, and toms
    • ๐ŸŽน Synth โ€” Subtractive synthesis for bass, pads, arps, and piano
  • Effects Chain: Distortion, Delay, Reverb, Chorus โ€” all processed in real-time
  • Smart Conductor: Manages tension, intensity, chord progressions, and layer activation
  • Musical Outro: 3-phase ending with ritardando, cadential progression (IV โ†’ ii โ†’ V7 โ†’ I), and smooth fade
  • Live Control: Change style, key, tempo, effects, and layers in real-time via CLI

๐Ÿ“ฆ Installation

From PyPI

pip install EngineLaMusique

From Source

git clone https://github.com/Anish-MutliTalent/EngineLaMusique.git
cd EngineLaMusique
pip install -e .

Requirements

Package Required? Purpose
numpy โœ… Yes DSP math โ€” waveform generation, filtering, mixing
pyaudio โœ… Yes Real-time audio output via PortAudio
scipy โšก Optional Better guitar cabinet simulation (Butterworth filters). Install with pip install EngineLaMusique[full]

Note on PyAudio: On some systems, PyAudio requires PortAudio to be installed first.

  • Windows: pip install pyaudio usually works out of the box.
  • macOS: brew install portaudio && pip install pyaudio
  • Linux (Debian/Ubuntu): sudo apt install portaudio19-dev && pip install pyaudio

๐Ÿš€ Quick Start

As a CLI

EngineLaMusique

Or run directly:

python -m EngineLaMusique.main

This opens an interactive terminal where you type start to begin playing and control the engine with commands.

As a Python Library

from EngineLaMusique import Conductor, AudioEngine

# Configure the conductor
conductor = Conductor()
conductor.apply_style('rock')        # rock, pop, edm, classical
conductor.set_param('key', 'A min')  # Any key + maj/min
conductor.set_param('bpm', 120)
conductor.set_param('intensity', 80) # 0-100

# Start playing
conductor.start()
engine = AudioEngine(conductor)
engine.start()  # Blocks and plays audio

# To trigger an outro (from another thread):
# conductor.trigger_outro()

๐ŸŽ›๏ธ CLI Commands

Once the engine is running, control it in real-time:

Command Description Example
start Start the engine start
outro Trigger the 3-phase ending sequence outro
style <name> Switch style style classical
intensity <0-100> Set performance intensity intensity 80
bpm <value> Set tempo bpm 140
key <Note> [maj/min] Change musical key key G# min
section <name> Switch section: intro, verse, chorus, build, break section chorus
layer <name> <on/off> Toggle layers: kick, snare, bass, rhythm, lead, pad, arp, harmony, riser layer arp on
dist <0-100> Set distortion % dist 70
delay <0-100> Set delay mix % delay 40
reverb <0-100> Set reverb mix % reverb 50
chorus <0-100> Set chorus mix % chorus 30
sustain <0-100> Set note sustain (0=staccato, 100=legato) sustain 85
status Show current engine state status
quit Stop and exit quit

๐ŸŽต Styles

Each style configures the instrument layers, effects, and voicings differently:

Style Instruments Character
Rock Distorted lead guitar, power chord rhythm, full drums Heavy, driving, aggressive
Pop Clean guitar with chorus, strumming rhythm, full drums Bright, catchy, polished
EDM Saw/square synth leads, filter sweeps, arpeggios Electronic, pulsing, energetic
Classical Piano (Mozart-style), string section, woodwinds, cello Orchestral, dynamic, expressive

๐Ÿ”Š Effects

All effects are implemented as pure Python DSP โ€” no external plugins:

Effect Description
Distortion Multi-stage tube amp simulation with cabinet IR
Delay Analog-style multi-tap delay with filtered feedback
Reverb Large hall reverb with early reflections, comb filters, and allpass diffusers
Chorus 4-voice chorus with independent LFOs per voice

๏ฟฝ The Outro System

When you type outro, the engine doesn't just stop โ€” it performs a musically expressive ending:

  1. Approach โ€” Gentle slowdown, IV โ†’ ii chord progression, drums and rhythm layers fade out one by one
  2. Cadence โ€” Stronger ritardando, V7 โ†’ I perfect authentic cadence (the classic resolution), only harmonic layers remain
  3. Ring-out โ€” Deep deceleration, holds the tonic chord, volume fades smoothly to silence

Each style adds its own flavor during the cadence: rock gets a power chord ring with delay, classical gets a string swell, pop gets chorus shimmer, and EDM gets a filter sweep down.


๏ฟฝ๐Ÿ—๏ธ Architecture

EngineLaMusique/
โ”œโ”€โ”€ main.py           # CLI interface and command parsing
โ”œโ”€โ”€ conductor.py      # The brain โ€” state, chords, intensity, 3-phase outro
โ”œโ”€โ”€ audio_engine.py   # The heart โ€” renders audio beat-by-beat, mixes layers
โ”œโ”€โ”€ music_theory.py   # Scales, keys, chords, progression generator
โ”œโ”€โ”€ instruments/
โ”‚   โ”œโ”€โ”€ guitar.py     # Karplus-Strong string synthesis
โ”‚   โ”œโ”€โ”€ drums.py      # Procedural drum synthesis (kick, snare, hihat, tom)
โ”‚   โ””โ”€โ”€ synthesizer.py # Waveform generation, ADSR envelopes, piano synthesis
โ””โ”€โ”€ effects/
    โ””โ”€โ”€ __init__.py   # Distortion, delay, reverb, chorus DSP
Component Role
Conductor Decides chords, manages global state (intensity, style, layers), drives the outro sequence
AudioEngine Renders audio beat-by-beat, mixing all active instrument layers per style
Instruments Pure Python DSP โ€” Karplus-Strong strings, additive/subtractive synthesis, procedural drums
Effects Real-time audio effects โ€” distortion, delay, reverb, chorus

๐Ÿค Contributing

Contributions are welcome! Here are some areas that could use help:

  • New styles (jazz, funk, ambient, lo-fi...)
  • New instruments (brass, flute, organ...)
  • WAV/MP3 export (render to file instead of just live playback)
  • MIDI support (input/output)
  • Performance optimizations (Cython/Numba for the reverb comb filters)
git clone https://github.com/Anish-MutliTalent/EngineLaMusique.git
cd EngineLaMusique
pip install -e ".[full]"
python -m EngineLaMusique.main

๐Ÿ“„ License

MIT License โ€” see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

enginelamusique-0.1.0.tar.gz (27.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

enginelamusique-0.1.0-py3-none-any.whl (30.6 kB view details)

Uploaded Python 3

File details

Details for the file enginelamusique-0.1.0.tar.gz.

File metadata

  • Download URL: enginelamusique-0.1.0.tar.gz
  • Upload date:
  • Size: 27.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for enginelamusique-0.1.0.tar.gz
Algorithm Hash digest
SHA256 251d11ca8e10788591990ba53466714d98c2fec37fe4bb6ae4cbbd7b64592530
MD5 24f42f2416dc124ab45e10fcf0a44dd6
BLAKE2b-256 ff5936064bfa2f3d424f4d1f2e78570e724b948ff060a2bea277162920e4ae96

See more details on using hashes here.

File details

Details for the file enginelamusique-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for enginelamusique-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ac992dcb2fe9f1d09f945a5b49f0fcd713077fcc24a53e4ecf0e13f8118e18d2
MD5 02e1cbcbee0266090b222c767ea1705d
BLAKE2b-256 60e22394d3f4fa9121c87350a90fa219523b2ee38dd51d78e56213d4e5b921d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page