Current section
5 Versions
Jump to
Current section
5 Versions
Compare versions
15
files changed
+883
additions
-169
deletions
| @@ -26,7 +26,7 @@ variables. | |
| 26 26 | Build the required Go MIDI server and compile the LFE: |
| 27 27 | |
| 28 28 | ```shell |
| 29 | - $ make |
| 29 | + $ make clean && make |
| 30 30 | ``` |
| 31 31 | |
| 32 32 | Start up the LFE REPL: |
| @@ -38,33 +38,52 @@ $ rebar3 lfe repl | |
| 38 38 | Start the app: |
| 39 39 | |
| 40 40 | ```cl |
| 41 | - lfe> (application:ensure_all_started 'undermidi) |
| 41 | + lfe> (undermidi:start) |
| 42 42 | ``` |
| 43 43 | |
| 44 | - See the running `gen_server`s for the Go MIDI server: |
| 45 | - |
| 46 | - ```lisp |
| 47 | - lfe> (undermidi.app:children) |
| 48 | - ``` |
| 49 | - ```lisp |
| 50 | - (#(ports.lisp.server #Pid<0.366.0> worker (ports.lisp.server)) |
| 51 | - #(ports.go.server #Pid<0.365.0> worker (ports.go.server))) |
| 52 | - ``` |
| 44 | + Depending upon the configured log level, you may see a fair amount of output, including the Go MIDI server being started. |
| 53 45 | |
| 54 46 | ## API |
| 55 47 | |
| 56 48 | ```lisp |
| 57 | - (ports.go.server:send #(command echo)) |
| 58 | - ``` |
| 59 | - ```lisp |
| 60 | - #(result "echo") |
| 49 | + lfe> (undermidi:ping) |
| 50 | + pong |
| 61 51 | ``` |
| 62 52 | |
| 53 | + Play the example MIDI code (requires the first MIDI device on your system, index 0, to be connected to a MIDI device, hardware or software, listening on channel 1): |
| 54 | + |
| 63 55 | ```lisp |
| 64 | - (ports.lisp.server:send #(command echo)) |
| 56 | + lfe> (undermidi:example) |
| 57 | + ok |
| 65 58 | ``` |
| 66 | - ```lisp |
| 67 | - #(result "echo") |
| 59 | + |
| 60 | + ## Macros |
| 61 | + |
| 62 | + The `midi` macros is provided as a typing convenience for generating MIDI messages: |
| 63 | + |
| 64 | + ``` lisp |
| 65 | + lfe> (include-lib "undermidi/include/macros.lfe") |
| 66 | + |-- loaded include: macros --| |
| 67 | + lfe> (midi (midimsg:device 0) |
| 68 | + (midimsg:channel 0)) |
| 69 | + #(midi |
| 70 | + #(batch |
| 71 | + (#(device 0) |
| 72 | + #(channel 0)))) |
| 73 | + ``` |
| 74 | + |
| 75 | + The `send` macro from the same include saves typing when sending many messages to the Go MIDI server. Additionally, macros for MIDI notes are provided via another include: |
| 76 | + |
| 77 | + ``` lisp |
| 78 | + lfe> (include-lib "undermidi/include/notes.lfe") |
| 79 | + |-- loaded include: notes --| |
| 80 | + lfe> (set volume 40) |
| 81 | + lfe> (progn |
| 82 | + (send (midimsg:device 0) |
| 83 | + (midimsg:channel 0)) |
| 84 | + (send (midimsg:note-on (Bb1) volume)) |
| 85 | + (timer:sleep 2000) |
| 86 | + (send (midimsg:note-off (Bb1)))) |
| 68 87 | ``` |
| 69 88 | |
| 70 89 | [//]: ---Named-Links--- |
| @@ -2,16 +2,30 @@ | |
| 2 2 | {<<"build_tools">>,[<<"rebar3">>]}. |
| 3 3 | {<<"description">>,<<"An LFE MIDI Port Server">>}. |
| 4 4 | {<<"files">>, |
| 5 | - [<<"LICENSE">>,<<"README.md">>,<<"rebar.config">>,<<"rebar.config.script">>, |
| 6 | - <<"rebar.lock">>,<<"src/undermidi.app.src">>,<<"src/undermidi/app.lfe">>, |
| 7 | - <<"src/undermidi/go/server.lfe">>,<<"src/undermidi/supervisor.lfe">>, |
| 5 | + [<<"LICENSE">>,<<"README.md">>,<<"include/macros.lfe">>, |
| 6 | + <<"include/notes.lfe">>,<<"rebar.config">>,<<"rebar.config.script">>, |
| 7 | + <<"rebar.lock">>,<<"src/undermidi.app.src">>,<<"src/undermidi.lfe">>, |
| 8 | + <<"src/undermidi/app.lfe">>,<<"src/undermidi/go/execserver.lfe">>, |
| 9 | + <<"src/undermidi/go/portserver.lfe">>,<<"src/undermidi/supervisor.lfe">>, |
| 8 10 | <<"src/undermidi/util.lfe">>]}. |
| 9 11 | {<<"licenses">>,[<<"BSD 2-clause">>]}. |
| 10 12 | {<<"links">>,[]}. |
| 11 13 | {<<"name">>,<<"undermidi">>}. |
| 12 14 | {<<"requirements">>, |
| 13 | - [{<<"lfe">>, |
| 15 | + [{<<"erlexec">>, |
| 16 | + [{<<"app">>,<<"erlexec">>}, |
| 17 | + {<<"optional">>,false}, |
| 18 | + {<<"requirement">>,<<"1.18.11">>}]}, |
| 19 | + {<<"lfe">>, |
| 14 20 | [{<<"app">>,<<"lfe">>}, |
| 15 21 | {<<"optional">>,false}, |
| 16 | - {<<"requirement">>,<<"2.0.1">>}]}]}. |
| 17 | - {<<"version">>,<<"0.0.0">>}. |
| 22 | + {<<"requirement">>,<<"2.0.1">>}]}, |
| 23 | + {<<"logjam">>, |
| 24 | + [{<<"app">>,<<"logjam">>}, |
| 25 | + {<<"optional">>,false}, |
| 26 | + {<<"requirement">>,<<"1.0.0">>}]}, |
| 27 | + {<<"midilib">>, |
| 28 | + [{<<"app">>,<<"midilib">>}, |
| 29 | + {<<"optional">>,false}, |
| 30 | + {<<"requirement">>,<<"0.4.0-rc3">>}]}]}. |
| 31 | + {<<"version">>,<<"0.1.0-rc1">>}. |
| @@ -0,0 +1,11 @@ | |
| 1 | + (defmacro midi body |
| 2 | + `(midimsg:batch (list ,@body))) |
| 3 | + |
| 4 | + (defmacro send body |
| 5 | + `(undermidi:send |
| 6 | + (midimsg:batch (list ,@body)))) |
| 7 | + |
| 8 | + ;; This function is for display purposes when used in the REPL |
| 9 | + ;; and needs to be the last function in the include file. |
| 10 | + (defun |-- loaded include: macros --| () |
| 11 | + 'ok) |
| \ No newline at end of file |
| @@ -0,0 +1,186 @@ | |
| 1 | + (defun G9 () 127 ) |
| 2 | + (defun F#9 () 126 ) |
| 3 | + (defun Gb9 () 126 ) |
| 4 | + (defun F9 () 125 ) |
| 5 | + (defun E9 () 124 ) |
| 6 | + (defun D#9 () 123 ) |
| 7 | + (defun Eb9 () 123 ) |
| 8 | + (defun D9 () 122 ) |
| 9 | + (defun C#9 () 121 ) |
| 10 | + (defun Db9 () 121 ) |
| 11 | + (defun C9 () 120 ) |
| 12 | + (defun B8 () 119 ) |
| 13 | + (defun A#8 () 118 ) |
| 14 | + (defun Bb8 () 118 ) |
| 15 | + (defun A8 () 117 ) |
| 16 | + (defun G#8 () 116 ) |
| 17 | + (defun Ab8 () 116 ) |
| 18 | + (defun G8 () 115 ) |
| 19 | + (defun F#8 () 114 ) |
| 20 | + (defun Gb8 () 114 ) |
| 21 | + (defun F8 () 113 ) |
| 22 | + (defun E8 () 112 ) |
| 23 | + (defun D#8 () 111 ) |
| 24 | + (defun Eb8 () 111 ) |
| 25 | + (defun D8 () 110 ) |
| 26 | + (defun C#8 () 109 ) |
| 27 | + (defun Db8 () 109 ) |
| 28 | + (defun C8 () 108 ) |
| 29 | + (defun B7 () 107 ) |
| 30 | + (defun A#7 () 106 ) |
| 31 | + (defun Bb7 () 106 ) |
| 32 | + (defun A7 () 105 ) |
| 33 | + (defun G#7 () 104 ) |
| 34 | + (defun Ab7 () 104 ) |
| 35 | + (defun G7 () 103 ) |
| 36 | + (defun F#7 () 102 ) |
| 37 | + (defun Gb7 () 102 ) |
| 38 | + (defun F7 () 101 ) |
| 39 | + (defun E7 () 100 ) |
| 40 | + (defun D#7 () 99 ) |
| 41 | + (defun Eb7 () 99 ) |
| 42 | + (defun D7 () 98 ) |
| 43 | + (defun C#7 () 97 ) |
| 44 | + (defun Db7 () 97 ) |
| 45 | + (defun C7 () 96 ) |
| 46 | + (defun B6 () 95 ) |
| 47 | + (defun A#6 () 94 ) |
| 48 | + (defun Bb6 () 94 ) |
| 49 | + (defun A6 () 93 ) |
| 50 | + (defun G#6 () 92 ) |
| 51 | + (defun Ab6 () 92 ) |
| 52 | + (defun G6 () 91 ) |
| 53 | + (defun F#6 () 90 ) |
| 54 | + (defun Gb6 () 90 ) |
| 55 | + (defun F6 () 89 ) |
| 56 | + (defun E6 () 88 ) |
| 57 | + (defun D#6 () 87 ) |
| 58 | + (defun Eb6 () 87 ) |
| 59 | + (defun D6 () 86 ) |
| 60 | + (defun C#6 () 85 ) |
| 61 | + (defun Db6 () 85 ) |
| 62 | + (defun C6 () 84 ) |
| 63 | + (defun B5 () 83 ) |
| 64 | + (defun A#5 () 82 ) |
| 65 | + (defun Bb5 () 82 ) |
| 66 | + (defun A5 () 81 ) |
| 67 | + (defun G#5 () 80 ) |
| 68 | + (defun Ab5 () 80 ) |
| 69 | + (defun G5 () 79 ) |
| 70 | + (defun F#5 () 78 ) |
| 71 | + (defun Gb5 () 78 ) |
| 72 | + (defun F5 () 77 ) |
| 73 | + (defun E5 () 76 ) |
| 74 | + (defun D#5 () 75 ) |
| 75 | + (defun Eb5 () 75 ) |
| 76 | + (defun D5 () 74 ) |
| 77 | + (defun C#5 () 73 ) |
| 78 | + (defun Db5 () 73 ) |
| 79 | + (defun C5 () 72 ) |
| 80 | + (defun B4 () 71 ) |
| 81 | + (defun A#4 () 70 ) |
| 82 | + (defun Bb4 () 70 ) |
| 83 | + (defun A4 () 69 ) |
| 84 | + (defun G#4 () 68 ) |
| 85 | + (defun Ab4 () 68 ) |
| 86 | + (defun G4 () 67 ) |
| 87 | + (defun F#4 () 66 ) |
| 88 | + (defun Gb4 () 66 ) |
| 89 | + (defun F4 () 65 ) |
| 90 | + (defun E4 () 64 ) |
| 91 | + (defun D#4 () 63 ) |
| 92 | + (defun Eb4 () 63 ) |
| 93 | + (defun D4 () 62 ) |
| 94 | + (defun C#4 () 61 ) |
| 95 | + (defun Db4 () 61 ) |
| 96 | + (defun C4 () 60 ) |
| 97 | + (defun B3 () 59 ) |
| 98 | + (defun A#3 () 58 ) |
| 99 | + (defun Bb3 () 58 ) |
| 100 | + (defun A3 () 57 ) |
| 101 | + (defun G#3 () 56 ) |
| 102 | + (defun Ab3 () 56 ) |
| 103 | + (defun G3 () 55 ) |
| 104 | + (defun F#3 () 54 ) |
| 105 | + (defun Gb3 () 54 ) |
| 106 | + (defun F3 () 53 ) |
| 107 | + (defun E3 () 52 ) |
| 108 | + (defun D#3 () 51 ) |
| 109 | + (defun Eb3 () 51 ) |
| 110 | + (defun D3 () 50 ) |
| 111 | + (defun C#3 () 49 ) |
| 112 | + (defun Db3 () 49 ) |
| 113 | + (defun C3 () 48 ) |
| 114 | + (defun B2 () 47 ) |
| 115 | + (defun A#2 () 46 ) |
| 116 | + (defun Bb2 () 46 ) |
| 117 | + (defun A2 () 45 ) |
| 118 | + (defun G#2 () 44 ) |
| 119 | + (defun Ab2 () 44 ) |
| 120 | + (defun G2 () 43 ) |
| 121 | + (defun F#2 () 42 ) |
| 122 | + (defun Gb2 () 42 ) |
| 123 | + (defun F2 () 41 ) |
| 124 | + (defun E2 () 40 ) |
| 125 | + (defun D#2 () 39 ) |
| 126 | + (defun Eb2 () 39 ) |
| 127 | + (defun D2 () 38 ) |
| 128 | + (defun C#2 () 37 ) |
| 129 | + (defun Db2 () 37 ) |
| 130 | + (defun C2 () 36 ) |
| 131 | + (defun B1 () 35 ) |
| 132 | + (defun A#1 () 34 ) |
| 133 | + (defun Bb1 () 34 ) |
| 134 | + (defun A1 () 33 ) |
| 135 | + (defun G#1 () 32 ) |
| 136 | + (defun Ab1 () 32 ) |
| 137 | + (defun G1 () 31 ) |
| 138 | + (defun F#1 () 30 ) |
| 139 | + (defun Gb1 () 30 ) |
| 140 | + (defun F1 () 29 ) |
| 141 | + (defun E1 () 28 ) |
| 142 | + (defun D#1 () 27 ) |
| 143 | + (defun Eb1 () 27 ) |
| 144 | + (defun D1 () 26 ) |
| 145 | + (defun C#1 () 25 ) |
| 146 | + (defun Db1 () 25 ) |
| 147 | + (defun C1 () 24 ) |
| 148 | + (defun B0 () 23 ) |
| 149 | + (defun A#0 () 22 ) |
| 150 | + (defun Bb0 () 22 ) |
| 151 | + (defun A0 () 21 ) |
| 152 | + (defun G#0 () 20 ) |
| 153 | + (defun Ab0 () 20 ) |
| 154 | + (defun G0 () 19 ) |
| 155 | + (defun F#0 () 18 ) |
| 156 | + (defun Gb0 () 18 ) |
| 157 | + (defun F0 () 17 ) |
| 158 | + (defun E0 () 16 ) |
| 159 | + (defun D#0 () 15 ) |
| 160 | + (defun Eb0 () 15 ) |
| 161 | + (defun D0 () 14 ) |
| 162 | + (defun C#0 () 13 ) |
| 163 | + (defun Db0 () 13 ) |
| 164 | + (defun C0 () 12 ) |
| 165 | + (defun B-1 () 11 ) |
| 166 | + (defun A#-1 () 10 ) |
| 167 | + (defun Bb-1 () 10 ) |
| 168 | + (defun A-1 () 9 ) |
| 169 | + (defun G#-1 () 8 ) |
| 170 | + (defun Ab-1 () 8 ) |
| 171 | + (defun G-1 () 7 ) |
| 172 | + (defun F#-1 () 6 ) |
| 173 | + (defun Gb-1 () 6 ) |
| 174 | + (defun F-1 () 5 ) |
| 175 | + (defun E-1 () 4 ) |
| 176 | + (defun D#-1 () 3 ) |
| 177 | + (defun Eb-1 () 3 ) |
| 178 | + (defun D-1 () 2 ) |
| 179 | + (defun C#-1 () 1 ) |
| 180 | + (defun Db-1 () 1 ) |
| 181 | + (defun C-1 () 0 ) |
| 182 | + |
| 183 | + ;; This function is for display purposes when used in the REPL |
| 184 | + ;; and needs to be the last function in the include file. |
| 185 | + (defun |-- loaded include: notes --| () |
| 186 | + 'ok) |
| \ No newline at end of file |
| @@ -1,7 +1,10 @@ | |
| 1 1 | {erl_opts, [debug_info, {no_auto_import, [{get,1}]}]}. |
| 2 2 | |
| 3 3 | {deps, [ |
| 4 | - {lfe, "2.0.1"} |
| 4 | + {lfe, "2.0.1"}, |
| 5 | + {logjam, "1.0.0"}, |
| 6 | + {erlexec, "1.18.11"}, |
| 7 | + {midilib, "0.4.0-rc3"} |
| 5 8 | ]}. |
| 6 9 | |
| 7 10 | {plugins, [ |
Loading more files…