• eriknie

    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

    posted in Pythonista read more
  • eriknie

    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.

    posted in Pythonista read more
  • eriknie

    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

    I tried:

    • 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?


    posted in Pythonista read more
  • eriknie

    I tried all possible combination, no midi is recieved by any clients. I spent way too much time on this....
    Would be nice if Pythonista had a coreMidi module installed...

    Thanks for all the help!

    posted in Pythonista read more
  • eriknie

    Any other idea to send data via bluetooth from Pythonista to my macbook Pro?

    I can write a python program on the macbook pro to convert it to midi (that part is easy)

    posted in Pythonista read more
  • eriknie

    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.


    posted in Pythonista read more
  • eriknie

    That was also my first guess, but in al the examples where the destinations are used, they use MIDIReceived().
    If you open een client, then you have to use MIDISend().


    I seem to miss something....

    posted in Pythonista read more
  • eriknie

    I tried to send a note to a midi application. (eventually through Bluetooth). My code to output a midi note seems fine, but I receive nothing.
    Not much data found, I combined several swift/pyhtonista combinations.
    Sorry for the ugly code, just try to figure out how it works, clean up later.
    Not sure what i'm doing wrong here.
    I you want to test is, download Synth One. it shows up in the list of destinations, but i hear no triggered note....
    Been struggling for days to get this working.

    My goal is to write an application for showing chords/lyrics on on iPad. I want to send a midi program change after selecting a song via bluetooth midi to mainstage.
    Got the base of the application running, also the bluetooth connection running.
    The bluetooth shows up in the destinations.

    I isolated the midi part. in this example

    from objc_util import *
    from ctypes import *
    import time
    CoreMIDI = NSBundle.bundleWithPath_('/System/Library/Frameworks/CoreMIDI.framework')
    #NOTE: `c` is defined in objc_util as `ctypes.cdll.LoadLibrary(None)`
    MIDIClientCreate = c.MIDIClientCreate
    MIDIClientCreate.restype = c_int
    MIDIClientCreate.argtypes = [c_void_p, c_void_p, c_void_p, c_void_p]
    MIDIObjectGetProperties = c.MIDIObjectGetProperties
    MIDIObjectGetProperties.restype = c_int
    MIDIObjectGetProperties.argtypes = [c_void_p, c_void_p, c_bool]
    MIDIObjectGetStringProperty = c.MIDIObjectGetStringProperty
    MIDIObjectGetStringProperty.restype = c_int
    MIDIObjectGetStringProperty.argtypes = [c_void_p, c_void_p, c_void_p]
    MIDIOutputPortCreate = c.MIDIOutputPortCreate
    MIDIOutputPortCreate.restype = c_int
    MIDIOutputPortCreate.argtypes = [c_void_p, c_void_p, c_void_p]
    MIDIGetNumberOfDevices = c.MIDIGetNumberOfDevices
    MIDIGetNumberOfDevices.restype = c_int
    MIDIGetNumberOfDevices.argtypes = []
    MIDIGetDevice = c.MIDIGetDevice
    MIDIGetDevice.restype = c_void_p
    MIDIGetDevice.argtypes = [c_int]
    MIDIPacketListInit = c.MIDIPacketListInit
    MIDIPacketListInit.restype = c_void_p
    MIDIPacketListInit.argtypes = [c_void_p]
    MIDIPacketListAdd = c.MIDIPacketListAdd
    MIDIPacketListAdd.restype = c_void_p
    MIDIPacketListAdd.argtypes = [c_void_p, c_int, c_void_p, c_ulonglong, c_int, c_void_p]
    MIDIReceived = c.MIDIReceived
    MIDIReceived.restype = c_int
    MIDIReceived.argtypes = [c_void_p, c_void_p]
    MIDIGetNumberOfDestinations = c.MIDIGetNumberOfDestinations
    MIDIGetNumberOfDestinations.restype = c_int
    MIDIGetNumberOfDestinations.argtypes = []
    MIDIGetDestination = c.MIDIGetDestination
    MIDIGetDestination.restype = c_void_p
    MIDIGetDestination.argtypes = [c_int]
    NumberOfDestinations = MIDIGetNumberOfDestinations()
    print("NumberOfDestinations: ",NumberOfDestinations) 
    MIDIPacketList = create_string_buffer(64)
    MIDIPacket = MIDIPacketListInit(MIDIPacketList)
    myPacket = (c_char * 3)(0x90,60,100) 
    myPacketp = pointer(myPacket)
    r = MIDIPacketListAdd(MIDIPacketList, 17, MIDIPacket,0,3,myPacketp)
    print("MIDIPacketListAdd:", r)
    for i in range(17):
        print(i, repr(MIDIPacketList[i]) )
    for i in range(NumberOfDestinations):
            dst = MIDIGetDestination(i)
            props = c_void_p()
            MIDIObjectGetProperties(dst, byref(props), True)
            uniqueID = c_void_p()
            MIDIObjectGetStringProperty(dst, ns('uniqueID'), byref(uniqueID))
            name = c_void_p()
            MIDIObjectGetStringProperty(dst, ns('name'), byref(name))
            print(i, " DESTINATION: ", ObjCInstance(props),"name: ", ObjCInstance(name))
            #print(i, " ID: ", ObjCInstance(uniqueID),"name: ", ObjCInstance(name))
            r = MIDIReceived(dst,MIDIPacketList)
            print( "send: ", r)

    The output:

    NumberOfDestinations:  2
    MIDIPacket: 4487117236
    MIDIPacketListAdd: 4487117236
    <ctypes.c_char_Array_64 object at 0x10b76bcc8>
    0 b'\x01'
    1 b'\x00'
    2 b'\x00'
    3 b'\x00'
    4 b'\x00'
    5 b'\x00'
    6 b'\x00'
    7 b'\x00'
    8 b'\x00'
    9 b'\x00'
    10 b'\x00'
    11 b'\x00'
    12 b'\x03'
    13 b'\x00'
    14 b'\x90'
    15 b'<'
    16 b'd'
    0  DESTINATION:  {
        uniqueID = "-1336782696";
    } name:  Session 1
    send:  0
    1  DESTINATION:  {
        name = "AudioKit Synth One";
        uniqueID = 95433;
    } name:  AudioKit Synth One
    send:  0

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!