{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreief7mplrhticyjvpyld6qprdy67bcomecd5tgkrh74rnhshgcly6q",
"uri": "at://did:plc:pi6woz4d47bkuws673w2il2r/app.bsky.feed.post/3mnirdbwjos52"
},
"path": "/t/euterpea-library-to-create-music-with-haskell/8391#post_6",
"publishedAt": "2026-06-04T23:02:40.000Z",
"site": "https://discourse.haskell.org",
"textContent": "in `ghci` :\n_- I played the file (i.e. saved in music.hs) using my piano (BlueTooth MIDI #7),_\n\n * saved to a midi file called ` music.midi` and\n * opened the file using MuseScore\n\n\n\n\n Loaded package environment from /Users/me/.ghc/aarch64-darwin-9.6.6/environments/default\n GHCi, version 9.6.6:\n :? for help\n ghci> :l music.hs\n [1 of 2] Compiling Main ( music.hs, interpreted )\n Ok, one module loaded.\n ghci> devices\n Input devices:\n InputDeviceID 0 IAC Driver Bus 1\n InputDeviceID 1 Network RTP Session 1\n InputDeviceID 2 UMP Network Network MIDI 2.0 Session 1\n InputDeviceID 3 FP-30 Bluetooth\n Output devices:\n OutputDeviceID 4 IAC Driver Bus 1\n OutputDeviceID 5 Network RTP Session 1\n OutputDeviceID 6 UMP Network Network MIDI 2.0 Session 1\n OutputDeviceID 7 FP-30 Bluetooth\n ghci> playDev 7 mel\n ghci> writeMidi \"music.midi\" mel\n ghci> :q\n Leaving GHCi.\n\n % open music.midi\n\n\n\nThis is what is displayed in MuseScore\n\n* * *\n\nToxypiks:\n\n>\n> import Euterpea\n>\n> hNote :: Dur -> Pitch -> Int -> Music Pitch\n> hNote d p h = note d p :=: note d (trans (-h) p)\n>\n> mel :: Music Pitch\n> mel = wnr :+: hNote qn (F,4) 3 :+: hNote qn (A,4) 4 :+: wnr :+: hNote qn (F,4) 3\n>\n> main :: IO()\n> main = do\n> play mel\n>",
"title": "Euterpea library to create music with Haskell"
}