{"id":17694171,"url":"https://github.com/vmagnin/formidi","last_synced_at":"2026-01-30T22:03:37.520Z","repository":{"id":139624137,"uuid":"343897971","full_name":"vmagnin/formidi","owner":"vmagnin","description":"A small Fortran MIDI sequencer for composing music, exploring algorithmic music and music theory.","archived":false,"fork":false,"pushed_at":"2025-01-27T19:56:15.000Z","size":1920,"stargazers_count":17,"open_issues_count":1,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-02-06T04:51:23.009Z","etag":null,"topics":["fortran","fortran-package-manager","midi","music"],"latest_commit_sha":null,"homepage":"https://vmagnin.github.io/formidi/","language":"Fortran","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vmagnin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":"ROADMAP.md","authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-02T20:04:28.000Z","updated_at":"2025-01-27T19:55:30.000Z","dependencies_parsed_at":"2023-04-23T23:34:26.594Z","dependency_job_id":"77745ace-c888-4e33-8dc9-5f9752ea7076","html_url":"https://github.com/vmagnin/formidi","commit_stats":{"total_commits":45,"total_committers":1,"mean_commits":45.0,"dds":0.0,"last_synced_commit":"7e40d69acb751644698606eaecf4089791791156"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmagnin%2Fformidi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmagnin%2Fformidi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmagnin%2Fformidi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmagnin%2Fformidi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vmagnin","download_url":"https://codeload.github.com/vmagnin/formidi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246392262,"owners_count":20769708,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fortran","fortran-package-manager","midi","music"],"created_at":"2024-10-24T13:48:02.756Z","updated_at":"2026-01-30T22:03:32.476Z","avatar_url":"https://github.com/vmagnin.png","language":"Fortran","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](logo/logo_formidi.svg)\n\nA small Fortran MIDI sequencer for composing music, exploring algorithmic music and music theory. It can also be used to teach Fortran programming in a fun way.\n\nMIDI notes are numbers. You can therefore make music with prime numbers, mathematical suites (Fibonacci, Syracuse...), the decimals of Pi, etc. Like Bach and Shostakovich, you can also use letters from your name to create your own [musical cryptogram](https://en.wikipedia.org/wiki/Musical_cryptogram), like BACH and DEsCH.\n\n## Features\n\n* Creates multi-tracks `.mid` files (MIDI 1.0).\n* Includes some music theory elements (scales, circle of fifths, chords, notes values and levels...)\n* Includes routines for easily playing chords and broken chords.\n* Includes the list of the General MIDI instruments and percussive instruments, and the list of the MIDI Control Changes.\n* The API is documented with FORD: https://vmagnin.github.io/formidi/\n* Includes various examples with comments.\n* You just need a modern Fortran compiler and a MIDI media player, whatever \nyour OS.\n* GPL-3.0-or-later license.\n\nIf you are interested by sound synthesis, you may also be interested by its twin project [ForSynth](https://github.com/vmagnin/forsynth).\n\n## Compilation and execution\n\nYou can easily build the project using the Fortran Package Manager [fpm](https://github.com/fortran-lang/fpm) at the root of the project directory:\n\n```\n$ fpm build\n```\n\nOr you can use the `build.sh` script and run the `build/*.out` executable files.\n\n### Running the examples\nThe examples can be found in the `example/` directory. For example, the `canon.f90` example can be run with the command:\n\n```bash\n$ fpm run --example canon\n```\n\nThe demos files are generated in the root directory of the project:\n\n```bash\n$ file canon.mid\ncanon.mid: Standard MIDI data (format 1) using 2 tracks at 1/128\n```\n\nMIDI files are similar to music scores. They don't contain any sound but just binary coded commands for the instruments, and are therefore very light files:\n\n```bash\n$ hexdump -C canon.mid\n00000000  4d 54 68 64 00 00 00 06  00 01 00 05 00 80 4d 54  |MThd..........MT|\n00000010  72 6b 00 00 00 1c 00 ff  02 0d 50 75 62 6c 69 63  |rk........Public|\n00000020  20 64 6f 6d 61 69 6e 00  ff 51 03 0f 42 40 00 ff  | domain..Q..B@..|\n00000030  2f 00 4d 54 72 6b 00 00  08 8a 00 ff 03 0b 67 72  |/.MTrk........gr|\n00000040  6f 75 6e 64 20 62 61 73  73 00 b0 5b 40 00 c0 30  |ound bass..[@..0|\n00000050  00 90 32 40 81 00 80 32  00 00 90 2d 40 81 00 80  |..2@...2...-@...|\n[...]\n00002329\n```\nThe \"MThd\" string begins the header of the MIDI file. Each track begins with a header beginning by \"MTrk\". The first track is always a metadata track, containing for example the tempo of the music.\n\n## Playing your MIDI file with a media player\n\n### Linux\n\n#### TiMidity++\n\nYou can use [TiMidity++](http://timidity.sourceforge.net/):\n\n```bash\n$ timidity canon.mid\n```\n\nThe quality of the output depends essentially on the quality of the soundfont. By default, timidity uses the [freepats](http://freepats.zenvoid.org/) soundfont. A better soundfont is `FluidR3_GM.sf2` (`fluid-soundfont-gm` package in Ubuntu):\n\n```bash\n$ timidity canon.mid -x \"soundfont /usr/share/sounds/sf2/FluidR3_GM.sf2\"\n```\n\nYou can save the music as a WAV file with the `-Ow` option, and a OGG with `-Ov`.\n\n#### FluidSynth\n\nAnother software synthesizer is [FluidSynth](https://www.fluidsynth.org/):\n\n```bash\n$ fluidsynth -a alsa -m alsa_seq -l -i /usr/share/sounds/sf2/FluidR3_GM.sf2 canon.mid\n```\nAdd the option `-F canon.wav` to generate a WAV file, instead of listening directly.\n\nSoundfonts can have several sound banks. For example, the `FluidR3_GM.sf2` has more instruments in the bank 8 and the bank 128 (drums). You can see the lists of instruments in those banks with those (Linux) commands:\n\n```shell\n$ fluidsynth /usr/share/sounds/sf2/FluidR3_GM.sf2\n\u003e fonts\nID  Name\n 1  /usr/share/sounds/sf2/FluidR3_GM.sf2\n\u003e inst 1\n```\n\n\n### macOS\n\nYou can use GarageBand.\n\n### Windows\n\nYou can simply play your MIDI files with the Windows Media Player.\n\n### Online tools\n\nYou can convert your MIDI files to several audio formats using online tools such as:\n\n* https://audio.online-convert.com/convert/midi-to-ogg\n* https://www.conversion-tool.com/midi/\n\nWith some of them, you can even choose the soundfont.\n\n## Playing your MIDI file with your synthesizer\n\nYou can easily connect your musical keyboard or synthesizer to your computer using a USB / MIDI interface (first price around 15 €), for example an E-MU Xmidi 2x2:\n\n![A MIDI/USB interface](pictures/MIDI_USB_interface.jpg)\n\n### Linux\n\nThis ALSA command will print the list of the connected MIDI devices:\n\n```bash\n$ aplaymidi -l\n Port    Client name                      Port name\n 14:0    Midi Through                     Midi Through Port-0\n 24:0    E-MU Xmidi 2x2                   E-MU Xmidi 2x2 MIDI 1\n 24:1    E-MU Xmidi 2x2                   E-MU Xmidi 2x2 MIDI 2\n```\n\nIf the synthesizer is connected to the port 24:0, this command will play the MIDI file:\n\n```bash\n$ aplaymidi -p 24:0 canon.mid\n```\n\n## Importing your MIDI file in other softwares\n\nYou can of course import your `.mid` file into any sequencer like [LMMS](https://lmms.io/) (Linux, Windows, macOS) or [Rosegarden](http://www.rosegardenmusic.com/).\n\n\n## Contributing\n\n* Post a message in the GitHub *Issues* tab to discuss the function you want to work on.\n* Concerning coding conventions, stay consistent with the style of the project.\n* When ready, make a *Pull Request*.\n\n## MIDI technical information\n\n* https://en.wikipedia.org/wiki/MIDI\n* A simple introduction to MIDI files: Oliveira, H. M. de, and R. C. de Oliveira, \"Understanding MIDI: A Painless Tutorial on Midi Format\", arXiv, 15th May 2017, http://arxiv.org/abs/1705.05322.\n* [Somascape](http://www.somascape.org/), a complete MIDI 1.0 documentation.\n* MIDI Association:\n    * [Standard MIDI Files](https://midi.org/standard-midi-files)\n    * [Control Change Messages](https://midi.org/midi-1-0-control-change-messages)\n* [Standard MIDI-File Format Spec. 1.1, updated](https://www.cs.cmu.edu/~music/cmsip/readings/Standard-MIDI-file-format-updated.pdf)\n* (fr) [La norme MIDI et les fichiers MIDI](https://www.jchr.be/linux/midi-format.htm)\n* [Codage Variable Length Quantity](https://en.wikipedia.org/wiki/Variable-length_quantity)\n* [General MIDI instruments](https://en.wikipedia.org/wiki/General_MIDI)\n* [MIDI notes](https://www.inspiredacoustics.com/en/MIDI_note_numbers_and_center_frequencies)\n* (fr) [Introduction au MIDI : les control change](https://fr.audiofanzine.com/mao/editorial/dossiers/le-midi-les-midi-control-change.html)\n\n## Other ressources\n* [CrisisGeneralMIDI 3.01 (1.57 Gb)](https://musical-artifacts.com/artifacts/2420)\n* [Virtual Piano Keyboard](https://www.onlinepianist.com/virtual-piano) (ONLINE PIANIST).\n\n\n## Bibliography\n### English\n\n* Jean-Claude Risset, [*Computer music: why ?*](https://www.posgrado.unam.mx/musica/lecturas/tecnologia/optativasRecomendadas/Risset_ComputerMusic%20why.pdf), 2003.\n* Dave Benson, [*Music - A Mathematical Offering*](https://homepages.abdn.ac.uk/d.j.benson/pages/html/music.pdf), 2008.\n* [Illiac Suite (\u003eWikipedia)](https://en.wikipedia.org/wiki/Illiac_Suite).\n* My [History of electronic music](https://github.com/vmagnin/forsynth/blob/main/ELECTRONIC_MUSIC_HISTORY.md).\n\n### French\n* Vincent Magnin, [\"Avec MIDI, lancez-vous dans la musique assistée par ordinateur !\"](https://connect.ed-diamond.com/Linux-Pratique/lphs-029/avec-midi-lancez-vous-dans-la-musique-assistee-par-ordinateur), *Linux Pratique*, HS n°29, février 2014.\n* Vincent Magnin, [\"Format MIDI : composez en C !\"](https://connect.ed-diamond.com/GNU-Linux-Magazine/GLMF-196/Format-MIDI-composez-en-C), *GNU/Linux Magazine,* n°196, sept. 2016.\n* Vincent Magnin, [\"Format MIDI et musique algorithmique\"](https://connect.ed-diamond.com/GNU-Linux-Magazine/GLMF-198/Format-MIDI-et-musique-algorithmique), *GNU/Linux Magazine,* n°198, nov. 2016.\n* Vincent Magnin, [\"Lancez-vous dans la « dance music » avec Linux MultiMedia Studio !\"](https://connect.ed-diamond.com/Linux-Pratique/lp-082/lancez-vous-dans-la-dance-music-avec-linux-multimedia-studio), *Linux Pratique,* n°82, mars 2014.\n* Vincent Magnin, [\"Composez librement avec le séquenceur Rosegarden\"](https://connect.ed-diamond.com/Linux-Pratique/lphs-029/composez-librement-avec-le-sequenceur-rosegarden), *Linux Pratique,* HS n°29, février 2014.\n* Moreno Andreatta, [\"Musique algorithmique\"](http://articles.ircam.fr/textes/Andreatta11b/index.pdf), 2009.\n* Laurent de Wilde, [*Les fous du son - D'Edison à nos jours*](https://www.grasset.fr/livres/les-fous-du-son-9782246859277), Éditions Grasset et Fasquelle, 560 pages, 2016, ISBN 9782246859277.\n* Laurent Fichet, [*Les théories scientifiques de la musique aux XIXe et XXe siècles*](https://www.vrin.fr/livre/9782711642847/les-theories-scientifiques-de-la-musique), Vrin, 1996, ISBN 978-2-7116-4284-7.\n* Guillaume Kosmicki , [*Musiques électroniques - Des avant-gardes aux dance floors*](https://lemotetlereste.com/musiques/musiqueselectroniquesnouvelleedition/), Éditions Le mot et le reste, 2nd edition, 2016, 416 p., ISBN 9782360541928.\n* Bibliothèque Tangente n°11, [*Mathématiques et musique - des destinées parallèles*](https://www.lalibrairie.com/livres/mathematiques-et-musique--des-destinees-paralleles--2022_0-9115242_9782848842462.html), Paris : Éditions POLE, septembre 2022, ISBN 9782848842462.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvmagnin%2Fformidi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvmagnin%2Fformidi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvmagnin%2Fformidi/lists"}