Created
April 22, 2020 05:04
-
-
Save elihugarret/32ba8b80db142e8416858d9115d98c4e to your computer and use it in GitHub Desktop.
Receive and visualize MIDI CC input messages in Julia with PyCall.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pip install mido | |
using PyCall, GR, Interact | |
mido = pyimport("mido") | |
mido.set_backend("mido.backends.portmidi") | |
mido.get_input_names() | |
# here goes the name of your midi input | |
inport = mido.open_input("KAOSSILATOR PRO+ MIDI 1") | |
msg = inport.receive() | |
function read_input() | |
while true | |
for msg in inport.iter_pending() | |
if msg.type == "control_change" | |
print("Value: $(msg)\n") | |
@manipulate for i = 1:1 | |
x = 8 .* rand(100) .+ msg.value | |
y = 8 .* rand(100) .+ msg.control | |
z = sin.(x) .+ cos.(y) | |
trisurf(x, y, z) | |
end | |
end | |
end | |
end | |
end | |
read_input() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment