From 194c5623a9a064046a51da2b0518dfc137906a91 Mon Sep 17 00:00:00 2001 From: Sam Neurohack Date: Sat, 16 Jan 2021 21:45:00 +0100 Subject: [PATCH] Led guidance doc --- README.md | 11 ++++++++++- esp/lserver.py | 14 +++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b9e2b30..79898b6 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,15 @@ By Sam Neurohack Forward incoming midi messages as OSC message (UDP) to micropython host to trigger hardware event. In example : noteon, noteoff lights on/off some leds connected to an ESP 8266. Remember to edit netconf.py for network/OSC configuration. +In this early version you also need to edit in main.py : + + - On your midikeyboard the left key midi notenumber : i.e leftnote = 36 + - motherip and motheroscport if you want some debug information. + Connect the led strip data line to D5 (GPIO 14) +How it works ? + * Computer side : List and hook to all midi devices (real or virtual). OSC commands generated from incoming midi messages : - /noteon midichannel, note, velocity - /noteoff midichannel, note @@ -23,8 +30,10 @@ Connect the led strip data line to D5 (GPIO 14) - Flash firmware, upload python files, run files,... thonny IDE : https://thonny.org/ - Great tutorials : https://randomnerdtutorials.com/getting-started-thonny-micropython-python-ide-esp32-esp8266/ +* midi learning software : - + - This has been tested with Synthesia. + - Synthesia/Neothesia hook to midi OUT ports to send light guidance and obviously midiOSCesp listen to INcoming events. So you need to create a virtual midi port will forward event sent to its OUT port and to its IN port. https://help.ableton.com/hc/en-us/articles/209774225-How-to-setup-a-virtual-MIDI-bus More soon... \ No newline at end of file diff --git a/esp/lserver.py b/esp/lserver.py index c1161e5..d10f5b5 100644 --- a/esp/lserver.py +++ b/esp/lserver.py @@ -10,7 +10,8 @@ from uosc.server import run_server, split_oscstr, parse_message, parse_bundle from uosc.client import send from uosc.client import Client from machine import Pin -import mynetconf as netconf +import netconf +#import mynetconf as netconf import machine, neopixel @@ -19,18 +20,21 @@ print('Loading OSC server module...') MAX_DGRAM_SIZE = 1472 -OSCport = 9001 +leftnote = 36 +motherip = "192.168.2.104" +motheroscport = 9002 + +OSCport = 9001 ledpin = Pin(2, Pin.OUT) ESPledstate = False stripin = Pin(14, Pin.OUT) n = 144 np = neopixel.NeoPixel(stripin, n) -motherip = "192.168.2.104" -motherosc = Client(motherip, 9002) +motherosc = Client(motherip, motheroscport) + -leftnote = 36 def ESPledon(): global ESPledstate