I wrote an Pythonista application to show lyrics and chord for live performance. It also plays backingtracks and is able to sort setlists. Works great. But I missed the option to use it with MIDI program changes to also setup my synths to the matching programs.
Finally I found a way to get this working: Pythonista --> UDP --> MidiFire --> MIDI-out
Could also be used the other way to receive midi data
Use MidiFire with OSC Exchange to MIDI synth. Setup UDP to port 8051, wrap data in sysex to no.
From Pythonista use the simple code that i found elsewhere, easy to tweak into program changes or other midi commands.
I hope this helps others
#https://adamsiembida.com/how-to-send-a-udp-packet-in-python/ import socket # addressing information of target #fill in your ip and port IPADDR = '127.0.0.1' PORTNUM = 8051 # enter the data content of the UDP packet as hex msg1 = bytearray([0x90, 0x40, 0x60]) msg2 = bytes.fromhex('903e70') #or using variable for midi note message midi_message = '903c50' midi_packet = bytes.fromhex(midi_message) # initialize a socket, think of it as a cable # SOCK_DGRAM specifies that this is UDP s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0) try: # connect the socket, think of it as connecting the cable to the address location s.connect((IPADDR, PORTNUM)) # send the command s.send(midi_packet) s.send(msg1) s.send(msg2) # close the socket except: pass # close the socket s.close()
The idea is great! it will not work in your form of coding as the return value contains a full path.
With minor adjustments it can work.
In my app I read .txt and .jpg files for displaying
However It seems that the problem is the .jpg files. For some reason the are offloaded in iCloud. I got only '.xxxx.jpg' files (with the . ).
After opening the folder with 'Files' the image files had a small cloud icon on top and after a few seconds they started to download from the cloud and that made everything working again.
For some reason the iCloud off loaded the images and downloaded them after opening them with 'files'
Perhaps someone knows why and how to prevent this (As I use this app on stage during a performance)...
The files that I want to read are stored in iCloud, also the python script files.
and for some reason when this happens, I cannot open my python file from pythonista (the iCloud location where I keep my python files is empty), the files do exist when using "Files" on my iPad, I can see the python files, when clicking on it, it will open Pythonista and runs fine
I want to select files from a folder. I use the following code:
from pathlib import Path
self.contents = list(curPath.iterdir())
f = self.contents[i]
name = os.path.basename(os.path.splitext(f))
I have a folder with 66 items, self.contents has 66 items.
Sometimes it contains the correct names, sometimes, there are names with a '.' in the name.
perhaps it has to do with the mix of PathLib and OS.
The strange thing is that is can be working without the '.' for longer time and then suddenly it inludes the '.' files.
Thanks for all the remarks.
I want to disable WIFI during a gig because some synchonisation services (I use iCloud and Google Drive to synchronize my settings, apple update) use WIFI and might cause CPU spikes and so audio spikes.
Perhaps it might not be a problem when this is an ad-hoc connection .
Mulitpeer works great in Pythonista, but no library for regular python...
Searched for hours.
I might try UDP broadcast just to get the few bytes over to python on my MacBook
Wifi will work for sure. with some UDP messages
The setup is not always the same:
- Ip addresses might change depending connection
- sometimes an ad-hoc connection is needed (during gig)
- at home or during rehearsels the IP address might change
- somtimes I need to control my behringer mixer
While BT is just there and will connect automatically.
Perhaps I'm wrong with all the WIFI issues and a uniform way of working can be found.
Communication from Pythonista on iPad to MacBook via Bluetooth.
My application is a chord/text application I wrote in Pythonista and want to control my softsynths on my Macbook.
Flow would be:
1 Select song in Pythonista
2 send a message to my Macbook,
3 recieve the message in Pyhton
4 Send the correct Midi program change command from python to Mainstage (or other softsynth-host)
1 and 4 are working
- midi over bluetooth from Pythonista --> not working (too complex and not enought documentation (see my other thread)
- Mulitpeer --> nu support on MacOs for multipeer over Bluetooth ;(
- direct Bluetooth serial --> no success
I don't want to use WIFI, because this is might be used to control my behringer mixer and internet access. So I don't want to switch with this too often and loose access
Any clue what to use for this?
Thanks for al the help and comments!!!
I've seen examples that only get a destinationget and use Midi-Receive on it.
Tried many options and still am stuck.
If you create a client, than You have to select the client in the synth as input.
In the end I want to select the Bluetooth (by name) from the destinations and sent a program change via that.
The most simple example was to try to get a note on via destiantions to a virtual synth and build on that.