{"id":13995356,"url":"https://github.com/gin66/rusthesia","last_synced_at":"2025-03-22T15:30:57.781Z","repository":{"id":57665268,"uuid":"168678167","full_name":"gin66/rusthesia","owner":"gin66","description":"Reads midi files and create piano notes waterfall","archived":false,"fork":false,"pushed_at":"2020-11-13T19:13:52.000Z","size":334,"stargazers_count":25,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-20T18:42:32.274Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gin66.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-01T10:03:31.000Z","updated_at":"2024-12-31T02:02:47.000Z","dependencies_parsed_at":"2022-09-26T20:31:19.777Z","dependency_job_id":null,"html_url":"https://github.com/gin66/rusthesia","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gin66%2Frusthesia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gin66%2Frusthesia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gin66%2Frusthesia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gin66%2Frusthesia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gin66","download_url":"https://codeload.github.com/gin66/rusthesia/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244978508,"owners_count":20541862,"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":[],"created_at":"2024-08-09T14:03:21.800Z","updated_at":"2025-03-22T15:30:57.360Z","avatar_url":"https://github.com/gin66.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# Rusthesia\n\n![Build](https://github.com/gin66/rusthesia/workflows/Rust/badge.svg)\n![Rust](https://github.com/gin66/rusthesia/workflows/Rust/badge.svg)\n[![dependency status](https://deps.rs/repo/github/gin66/rusthesia/status.svg)](https://deps.rs/repo/github/gin66/rusthesia)\n\nRusthesia is till now just a hack to play a midi file, created from Logic Pro/X, and display a window with falling notes down onto a piano.\n\nThe midi file can be transposed in half notes in realtime by using shift left/right key. Playing can be paused by space.\n\nPlease note: without the \"-s\" commandline option, no window will be shown !\n\n### Audio\n\nSynthesizer is not included. Instead midi messages will be sent via core audio. Logic Pro/X can be used for playing the midi, but has to be set up accordingly.\n\nNo idea for other operation systems, if it works or how to do. \n\n### Video\n\nScreen output uses sdl2.\n\n### Screenshot\n\n![Screenshot](screenshot.png)\n\n## Preparation\n\nThe sdl2 libraries need to be installed. On macos this can be done by:\n\n```\nbrew install sdl2 sdl2_gfx sdl2_ttf\n```\n\n## Installation\n\n```\ncargo install rusthesia\n```\n\n## Usage\n\nFor help just execute\n\n```\nrusthesia -h\n```\n\nAs an example the midi-file \n[Marche_aux_Flambeaux.mid](http://www.mutopiaproject.org/cgibin/make-table.cgi?Instrument=Harmonium)\nis included. As per that website, this file is in the public domain.\n\nFirst list the available tracks:\n```\n\u003e rusthesia Marche_aux_Flambeaux.mid -l\nTrack 0:\n  Text: Creator: GNU LilyPond 2.8.7\n  Text: Generated automatically by: GNU LilyPond 2.8.7\n  Text: at Mon Oct 16 20:41:39 2006\n  Text: at Mon Oct 16 20:41:39 2006\n  Track name: Track 0\nTrack 1:\n  Track name: upper\n  Instrument name: accordion\nTrack 2:\n  Track name: lower\n  Instrument name: accordion\n```\n\nFor playing and displaying all tracks use:\n```\n\u003e rusthesia Marche_aux_Flambeaux.mid -p 0 1 2 -s 0 1 2\n```\n\nIn order to play the lower and show only the upper, use the following command:\n```\n\u003e rusthesia Marche_aux_Flambeaux.mid -p 1 -s 2\n```\n\nOnly use the midi player function without graphic output:\n```\n\u003e rusthesia Marche_aux_Flambeaux.mid -p 1\n```\n\nTo get info about the event loop in regard to timing debug flags can be added:\n```\n\u003e rusthesia Marche_aux_Flambeaux.mid -p 1 -vvv -d eventloop\n```\n\n## Todo\n\nTodo list is managed under [projects](https://github.com/gin66/rusthesia/projects)\n\n## Synthesizer\n\n### macos\n\n#### Logic Pro/X\n\nHave not been able to use Logic Pro/X as a synthesizer with channels assigned to different instruments. Still keep looking for the needed hidden feature.\n\n#### MainStage\n\nWorks, but need to create a concert with keyboard per channel, which is not very convenient.\n\n#### Connected piano (Roland RD-64) with synthesizer\n\nAs rusthesia offered to use my Roland RD-64 as output, I have given it a try.\nVery positively surprised, that it works pretty well. Even can play along by hand to the song.\n\n#### fluidsynth\n\nGood choice too is to use fluidsynth\n\n```bash\nbrew install fluid-synth\n```\n\nFor playing need still a soundfont .sf2 file, which can be found in the internet. Start synthesizer with:\n\n```bash\nfluidsynth your_soundfound.sf2\n```\n\nNow can start rusthesia and the midi-output should appear.\n\n```\nAvailable output ports:\n0: IAC-Treiber IAC-Bus 1\n1: FluidSynth virtual port (3776)\n```\n\nJust enter 1 for this case.\n\n### Linux\n\nAs per info from Samuel Da Mota, the code works on linux:\n\n\u003e No need to change a single\n\u003e line of code or configuration whatsoever. One only need to install the\n\u003e libsdl2-dev and libsd2-gfx-dev packages for your project to build. And\n\u003e then to install a system wide midi sequencer such as timidity and run\n\u003e it (using timidity -iA) to get music being played.\n\nIn the meantime have tried on deepin linux, which is IMHO based on Debian.\nThis steps to be executed for compilation:\n\n```\nsudo apt install librtaudio-dev libsdl2-2.0 cmake libfreetype6-dev libsdl2-dev libsdl2-gfx-dev libsdl2-ttf-dev libfontconfig1-dev\n```\n\nUnfortunatly it does not work for these issues:\n\n* Long pause before windows comes up\n* Super slow\n* No output if using timidity -A\n\nNeed further debugging.\n\nPerformance measurement using:\n\n```\ncargo run --release Marche_aux_Flambeaux.mid -p 0 1 2 -s 0 1 2 -d eventloop -vvvv\n````\n\nwithout mouse movements/gestures yields:\n\n```\nSleep time 1 ms - 1 times\nSleep time 14 ms - 1 times\nSleep time 15 ms - 1 times\nSleep time 16 ms - 1 times\nSleep time 17 ms - 1 times\nSleep time 22 ms - 24 times\nSleep time 23 ms - 81 times\nSleep time 24 ms - 151 times\nSleep time 25 ms - 285 times\nSleep time 26 ms - 1736 times\nSleep time 27 ms - 4152 times\nSleep time 28 ms - 2 times\nSleep time 37 ms - 1 times\nSleep time 38 ms - 1 times\nLost frames: 2\nmin=     0us avg=     1us max=    64us control at loop start\nmin=     0us avg=     1us max=    41us keyboard built\nmin=     0us avg=     0us max=  1531us keyboard drawn\nmin=     3us avg=    17us max=    77us canvas cleared\nmin=    17us avg=    36us max=   173us copy keyboard to canvas\nmin=     0us avg=    27us max= 24298us waterfall and pressed keys drawn\nmin=     1us avg=    10us max=   597us event loop\nmin=  1821us avg= 27083us max= 38550us sleep\nmin= 11747us avg= 12834us max= 41421us canvas presented\n```\n\nSame for macos:\n```\nSleep time 6 ms - 1 times\nSleep time 18 ms - 1 times\nSleep time 26 ms - 1 times\nSleep time 27 ms - 4 times\nSleep time 28 ms - 1 times\nSleep time 29 ms - 4 times\nSleep time 30 ms - 3 times\nSleep time 31 ms - 2 times\nSleep time 32 ms - 10 times\nSleep time 33 ms - 9 times\nSleep time 34 ms - 12 times\nSleep time 35 ms - 75 times\nSleep time 36 ms - 484 times\nSleep time 37 ms - 4921 times\nSleep time 38 ms - 1054 times\nSleep time 39 ms - 1 times\nLost frames: 2\nmin=     2us avg=     4us max=    98us control at loop start\nmin=     1us avg=     2us max=   115us keyboard built\nmin=     0us avg=     0us max=  1355us keyboard drawn\nmin=     7us avg=    11us max=   261us canvas cleared\nmin=     9us avg=    15us max=   905us copy keyboard to canvas\nmin=     0us avg=    43us max= 37208us waterfall and pressed keys drawn\nmin=    36us avg=   149us max= 90750us event loop\nmin=  7070us avg= 38221us max= 40092us sleep\nmin=  1058us avg=  1574us max= 22518us canvas presented\n```\n\nOn macos canvas present is on average 8 times faster. In addition on linux the waterfall has several flaws. \nNot sure if this is due to intel graphic driver or sdl library or ...\n\nFunnily on macos the event loop can be blocked by poll_event for a long time, which is weird. Luckily this appears to happen only for Window events, which are seldom.\n\nUpdate:\nAfter changing from Intel acceleration mode driver to Intel default driver the measurements are outperforming macos:\n\n```\nSleep time 34 ms - 1 times\nSleep time 37 ms - 1 times\nSleep time 38 ms - 3 times\nSleep time 39 ms - 6330 times\nLost frames: 1\nmin=     0us avg=     5us max=    58us control at loop start\nmin=     0us avg=     2us max=    34us keyboard built\nmin=     0us avg=     0us max=  1831us keyboard drawn\nmin=     3us avg=    37us max=   393us canvas cleared\nmin=    10us avg=    65us max=   251us copy keyboard to canvas\nmin=     0us avg=    41us max= 44905us waterfall and pressed keys drawn\nmin=     5us avg=    19us max=   326us event loop\nmin= 34978us avg= 39624us max= 40005us sleep\nmin=    47us avg=   207us max=   432us canvas presented\n```\n\n\n## Data to Marche_aux_Flambeaux.mid\n\n* 115 bars\n* 4/4 bar\n* 110 beats per minute (as per Logic Pro/X)\n* duration 4 minutes 8 seconds\n* First note starts at bar 2.0\n* Last note ends at bar 114.3\n\n## Solutions for known issues\n\n### Linux\n\nIf the application outputs lots of fontconfig errors, then there could be a libfontconfig mismatch. Please check, if pkg-config is able to find fontconfig:\n\n```\npkg-config --list-all|grep fontconfig\n```\n\nIf there is no output, then crate *servo-fontconfig-sys* will build its own version, which can be incompatible. Installation of libconfig1-dev has fixed this.\n\n## License\n\nThe attached LICENSE file defines the license for the code of this crate only - specifically before compiling or linking. The resulting binary after linking may be problematic in regard to license incompatibilities of included crates.\n\nFrom current point of view to be checked:\n    BSD-3-Clause (1): simple-logging\n    ISC (1): rdrand\n    N/A (2): fuchsia-cprng\n    Unlicense (1): midly\n\nAFAIK is incompatible:\n    GPL-3.0-or-later (1): sdl2-unifont\n\nConsequently automated builds resulting in a public available binary cannot be set up for now.\n\n## Final Words\n\nThe application works, but still this is a quick hack and not polished for code review ;-)\n\n## Alternatives\n\n* [Neothesia](https://github.com/PolyMeilex/Neothesia)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgin66%2Frusthesia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgin66%2Frusthesia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgin66%2Frusthesia/lists"}