Compose complete musical pieces in readable text, then export to MIDI or sheet music.
Wolfgang is a functional music DSL with an approachable text notation called Amadeus. Write melodies, chords, and structure with simple words; combine and transform ideas compositionally; output to DAWs via MIDI and to notation formats like SVG, LilyPond, and MusicXML.
- Readable notation: Write music like "C4 quarter", "Cmaj half", "rest eighth".
- Composable: Build phrases, repeat, and transform (transpose, invert, retrograde) using functional ideas.
- Multiple outputs: Export to MIDI for DAWs and to sheet music formats for engraving and sharing.
- Hackable: Pure Haskell core with clear modules for Core, MIDI, Sheet, Parser, and Theory.
- Build and run
stack setup && stack build
stack run- Compose a file to MIDI
# Create a file
cat > twinkle_star.amadeus <<'EOF'
# Twinkle (excerpt)
C4 quarter
C4 quarter
G4 quarter
G4 quarter
A4 quarter
A4 quarter
G4 half
Cmaj quarter
Fmaj quarter
Gmaj quarter
Cmaj half
EOF
# Compile to MIDI
stack run -- compose twinkle_star.amadeus
# => twinkle_star.mid- Try the REPL
stack run -- --repl
# wolfgang> :play C4 quarter
# wolfgang> :save demo.mid Cmaj halfAmadeus favors clear words over symbols. The implemented subset supports:
- Notes:
C4 quarter,F#5 half - Rests:
rest eighth,rest quarter - Named chords:
Cmaj whole,Dmin half - Scales:
scale C major,scale D minor - Directives:
tempo 96,timesig 3/4,key G major,pickup quarter - Assignments:
theme = C4 quarter(assign a name to reuse later)
Durations include names and shorthands: whole|half|quarter|eighth|sixteenth and w|h|q|e|s, plus dotted and triplet shorthands in the core library.
Planned/partially implemented (see Grammar and modules):
- Sequences and parallel blocks:
seq [ ... ],par [ ... ], bar-delimited| - Chords by explicit notes:
chord [C4,E4,G4] half - Transforms:
transpose n,invert PIVOT,retrograde,augment r,diminish r - Articulations and dynamics:
staccato,legato,mf,ffetc.
Refer to docs/GRAMMAR.md for the full EBNF and examples; the parser is being expanded to match the full spec.
wolfgang -- Run default example
wolfgang --example NAME -- Run named example (scale|chords|canon|variations)
wolfgang --sheet-example NAME -- Sheet examples (simple|progression|classical|demo)
wolfgang --repl -- Start interactive REPL
wolfgang compose FILE.amadeus -- Compile .amadeus to MIDI (.mid)
wolfgang sheet FILE.amadeus [svg|lilypond|musicxml|png]
Notes on sheet export:
- MIDI export uses your
.amadeuscontent today. - Sheet export support (SVG, LilyPond, MusicXML, PNG) is available via the API and CLI examples; the end-to-end Amadeus→Sheet pipeline is in progress and will broaden coverage as the parser expands.
Single line melody
C4 quarter
D4 quarter
E4 quarter
F4 quarter
G4 half
Directive + scale + rest + chord
tempo 96
timesig 3/4
key G major
scale C major
rest quarter
Cmaj half
- MIDI (.mid): Import into Logic Pro, Ableton Live, Cubase, FL Studio, etc.
- SVG (sheet): Viewable in browsers; great for docs and the web.
- LilyPond (.ly): Professional engraving. Compile with
lilypond file.ly. - MusicXML (.xml): Import into MuseScore, Finale, Dorico, Sibelius.
- PNG: Quick shareable images (requires LilyPond when using that backend).
src/Wolfgang/Core/*: Core types forPitch,Duration,Music, combinators.src/Wolfgang/Parser/*: Amadeus grammar and parser.src/Wolfgang/MIDI/*: MIDI types, compiler, and file writer.src/Wolfgang/Sheet/*: Sheet music model, compiler, and exporters.docs/: Design notes, grammar, testing guidance.examples/: Example.amadeusfiles and Haskell demos.
- Commands:
:help,:quit,:play EXPR,:save FILE EXPR - Try:
:play C4 quarter,:save chords.mid Cmaj whole
- Build:
stack build - Run examples:
stack run -- --example scale - Tests:
stack testor./run-tests.sh
Active development. MIDI export is stable for the implemented subset. The Amadeus parser and sheet export are expanding rapidly toward the full grammar in docs/GRAMMAR.md.
MIT
