Midica
A Music programming language. Translates source code into MIDI. Includes a player. Supports MIDI-Karaoke. Includes a MIDI analyzer.
Install / Use
/learn @truj/MidicaREADME
Get Started | Features | Screenshots | Programming | CLI | Contribute | License
Midica is an interpreter for a Music Programming Language. It translates source code to MIDI.
But it can also be used as a MIDI Player, MIDI compiler or decompiler, Karaoke Player, ALDA Player, ABC Player, LilyPond Player or a MIDI File Analyzer.
You write music with one of the supported languages (MidicaPL, ALDA or ABC).
The built-in music programming language MidicaPL supports the same techniques as regular programming languages, like:
- Variables and Constants
- Functions
- Loops
- Conditions (if/elsif/else)
- Including Libraries
- Code Comments
You write your songs in plain text files using the text editor of your choice. Midica converts these files into MIDI or plays them directly.
Get started
- Install Java Runtume Environment (JRE) version 1.7 or higher.
- Go to the latest release and download the file
midica.jar. - Start Midica using the command:
java -jar midica.jar(or just by double-click if your operating system supports that) - Download one of the example files or create your own file and save it with the file extension
.midica. - In the Midica application, load this file by pressing the upper right button
select file. - Switch to the MidicaPL tab (it's the default tab) and choose this file.
- Press the button
Start Playerand play the sequence
If you prefer to write your music in ALDA or ABC, you need to:
- Install ALDA or abcMIDI
- In Step 4: Download an ALDA example or ABC example or create your own file with the extension
.aldaor.abc. - In Step 6: Switch to the ALDA or ABC tab (and maybe adjust the program path).
Features of the Midica Application itself
- Loading and playing MIDI sequences from:
- Exporting MIDI sequences
- Integrated MIDI player featuring:
- Regulation of volume, tempo and pitch transposition
- Memorizing a position in the MIDI sequence and jumping back to that position
- Channel Overview (showing current instrument and channel activity)
- Channel Detail viewer (Note name and number, volume and tick, channel by channel)
- Channel configuration (Volume, Mute and Solo configurable channel by channel)
- Quick reloading and reparsing of a loaded file
- Karaoke Player
- Integrated as a part of the MIDI player
- displaying syllables in different colors for future and past
- displaying syllables in italic, shortly before they must be sung
- Converter
- converts various formats to MIDI (MidicaPL, ALDA, ABC, LilyPond, MusicXML, MuseScore, Guitar Pro, Capella, Bagpipe, Overture, Score Writer, PowerTab)
- converts MIDI to various formats (MidicaPL, ALDA, Audio, ABC, Lilypond, MuseScore, MusicXML and others)
- Soundbanks
- Loading Soundfonts (SF2) or Downloadable Sounds (DLS) and using them for playback
- either from an SF2 or DLS file
- or via download (with caching, both formats work)
- Analyzing Soundbank contents
- Test Soundbanks with the Soundcheck window
- Using the loaded soundbank for Audio exports
- Loading Soundfonts (SF2) or Downloadable Sounds (DLS) and using them for playback
- Configuration of
- GUI language (currently English or German)
- Note System - (6 different systems), e.g. International (C,D,E,F,G,A,B), German (C,D,E,F,G,A,H), Italian (Do,Re,Mi,Fa,Sol,La,Si)
- Half Tone Symbols (3 different sets)
- Octave Naming - 4 different systems
- Syntax (3 different sets of key words for the programming language) - not that important as the syntax can be redefined in MidicaPL anyway
- Percussion IDs (English or German)
- Instrument IDs (English or German)
- Key bindings
Screenshots
You can find a lot of screenshots here: https://www.midica.org/screenshots.html
I will not repeat them all in this Readme. But at least here are three screenshots. The first one shows the main window. The second one shows the player in default mode. The third one shows the player in Karaoke mode.
<img src="img/main.png" title="Midica Player"> <img src="img/player.png" title="Midica Player"> <img src="img/karaoke.png" title="Karaoke Mode">Programming with Midica
Midica has its own Music Programming Language: MidicaPL. But alternatively you can also code in ALDA or ABC.
For learning, each language has its own resources:
Here we focus on MidicaPL. For a quick reference, here are the links to the main chapters of the MidicaPL tutorial:
- Preparation
- Chapter 1: Basics
- Chapter 2: Improving
- Chapter 3: Functions
- Chapter 4: Blocks
- Chapter 5: Tweaking
- Chapter 6: Patterns
Examples of complete songs can be found in the examples directory. In this Readme we just show some short examples to get an impression of the language.
Example 1
This example uses only one channel and lyrics:
// use Piano in channel 0
INSTRUMENTS
0 ACOUSTIC_GRAND_PIANO Piano
END
// Every line beginning with "0:" defines events in channel 0
0: (v=95) // (...=...) set an option to a value; v = velocity; 95 = forte
0: (l=Hap) c:8. // (l=...) defines a syllable. "c:8." = dotted eighth middle C
0: (l=py_) c:16 // _ = space; c:16 = sixteenth middle C
// More special characters in syllables: \c = comma, \r = new line, \n = new paragraph
0: (l=birth) d:4 (l=day_) c (l=to_) f (l=you\c\r) e:2 (l=Hap) c:8. (l=py_) c:16
0: (l=birth) d:4 (l=day_) c (l=to_) g (l=you.\n) f:2 (l=Hap) c:8. (l=py...) c:16
This results in a MIDI sequence like this:
<img src="img/example-birthday.svg" title="Example Score">Example 2
This example uses nestable blocks and global commands:
// initialize channel 0 and 1
INSTRUMENTS
0 ACOUSTIC_GRAND_PIANO Piano (Right Hand)
1 ACOUSTIC_GRAND_PIANO Piano (Left Hand)
END
* key d/min // key signature
* time 3/4 // time signature
* tempo 170 // tempo in beats per minute
{ q=2 // outer block to be repeated twice
{ q=3 // inner block to be repeated 3 times
// in channel 1: switch to mezzo piano (v=70) and play D3 as an 8th note
1: | (v=70) d-:4 // the pipe "|" checks for measure borders (optional)
// in channel 0: switch to mezzo piano and play some notes and rests ("-" = rest)
0: | (v=70) d:8 - d eb d eb |
// synchronize: bring all channels to the same time
*
}
1: d-:4 f- c-
0: d:8 - d eb f eb
}
This results in a MIDI sequence like this:
<img src="img/example-score.svg" title="Example Score">Instead of the nested blocks we could have written this equivalent code:
0: (v=70) | d:8 - d eb d eb | d - d eb d eb | d - d eb d eb | d - d eb f eb |
0: | d:8 - d eb d eb | d - d eb d eb | d - d eb d eb | d - d eb f eb |
1: (v=70) | d-:4 -:/2 | d-:4 -:/2 | d-:4 -:/2 | d-:4 f- c- |
1: | d-:4 -:/2 | d-:4 -:/2 | d-:4 -:/2 | d-:4 f- c- |
Example 3
This example uses a guitar picking pattern with several chords. It produces the beginning of "Dust in the wind":
// use the guitar in channel 0
INSTRUMENTS
0 STEEL_GUITAR Guitar
END
// define some chords
CHORD cmaj c- e- g- c
CHORD cmaj7 c- e- g- b-
CHORD cadd9 c- e- g- d
CHORD asus2 a-2 e- a- b-
CHORD asus4 a-2 e- a- d
CHORD amin a-2 e- a- c
// Define the picking pattern (Travis picking)
// The numbers inside the pattern aren't channel numbers but note indices
PATTERN travis
: 0,3:4 1:8 2 0 3 1 2
END
// play the chords using this pattern
0: | cmaj:travis | cmaj7:travis | cadd9:travis | cmaj:travis |
0: | asus2:travis | asus4:travis | amin:travis | asus2:travis |
This results in the following sequence:
<img src="img/example-dust.svg" title="Example Score">Example 4
This example uses functions and percussion instruments.<br> It produces the first beats of "Another one bites the Dust":
// Use bass in channel 5
// Drums are always in channel 9 (automatically)
INSTRUMENTS
5 E_BASS_FINGER Bass
END
// anacrusis
* time 1/8
5: (d=30%) a-2:16 g-2 // d=30% --> staccato
//
Related Skills
openhue
337.1kControl Philips Hue lights and scenes via the OpenHue CLI.
sag
337.1kElevenLabs text-to-speech with mac-style say UX.
weather
337.1kGet current weather and forecasts via wttr.in or Open-Meteo
tweakcc
1.4kCustomize Claude Code's system prompts, create custom toolsets, input pattern highlighters, themes/thinking verbs/spinners, customize input box & user message styling, support AGENTS.md, unlock private/unreleased features, and much more. Supports both native/npm installs on all platforms.
