Send midi with AKSequencer over virtual output - midi

I’m trying to send a midi data from a .mid file with AKSequencer(), on a virtual output to use it outside the app (more detail below). My problem is my AKSequencer doesn't send midi outside my app like I would like to do with the virtualOuput port.
// My midiOutput is set like this:
let midiOut = AKMIDI()
midiOut.createVirtualOutputPort()
midiOut.openOutput()
//And my AKSequencer connect to the midiOuput like this:
sequencer.setGlobalMIDIOutput(midiOut.virtualOutput)
I set up an AKSampler() to be sure my AKSequencer work fine.
I think my issue provide either from my connexion to the midiOutput, either my use of AKSequencer not design to send midi like I imagine.
To enter into details, I’m trying to send MIDI over Bluetooth from an iOS app to a DAW. Thank the CABTMIDILocalPeripheralViewController. it’s very easy to set up a connection to send midi when two devices are connected established. I achieve to send midi with AKMIDI().sendNoteOnMessage() so I’m sure the connection is not the problem.

Sending MIDI outside with AKSequencer a bit tricky. You need to either use AKMIDICallbackInstrument or your own AKMIDIListener to get MIDI from the sequencer and reroute outside of your app by AKMIDI output.
There is a discussion on this thread:
https://groups.google.com/forum/#!topic/audiokit/6VkayJMpMvY
Also, you may want to check out my MIDISequencer library built top on AKSequencer with iOS and Mac examples:
https://github.com/cemolcay/MIDISequencer

Related

Connect CBPeripheral so that macOS MIDI Studio recognises the connection

This is probably in a book but I don't know which.
I'm trying to connect a BLE MIDI CBPeripheral so that it becomes connected on MIDI Studio, i.e. usable as a MIDI source/sink by all the apps in the system. Although I get the indication that it is connected, it doesn't appear so in MIDI Studio or other apps. I know it's possible because Korg's Bluetooth MIDI Connect is able to do it. But it does seem to open the system's 'Bluetooth Configuration' window, so maybe there's no programmatic way of doing it.
I'm creating a CBCentralManager and keeping a reference to it;
When state is poweredOn I do a scanForPeripherals;
When I get a didDiscover:CBPeripheral, I keep the reference to the CBPeripheral and call central.connect(peripheral...);
I get a didConnect:CBPeripheral and keep my app running, but it doesn't appear as connected to anyone else.
I know 'connected' means connected to my app. But I'd really like to have it available for others.
If this is a purposefully Apple-designed limitation, does anyone know what the purpose is?
If not, is there some CoreMIDI API I can use?
Maybe I am missing something, but the apple guide gives you a hint on how to connect a BLE MIDI device to your Mac:
In the Audio MIDI Setup app on your Mac, choose Window > Show MIDI
Studio.
In the MIDI Studio window, click the Configure Bluetooth button in
the toolbar.
Set your Bluetooth MIDI peripheral in pairing mode.
Select the peripheral in the list of devices, then click Connect.
There is no need for custom coding. It should be possible for multiple apps to use the same BLE device, but the apps need to connect to it. BLE devices usually don't show up in the system settings but this might be different for MIDI devices.
For items connected by USB, it does keep the connection information. Once you use the Bluetooth Configuration screen and select the devices, do they appear on the MIDI Studio screen. You may have to create a new External Device.
I think it's like using a new printer. You have to add the new printer using manual methods. However, you can print to it using code.
I have an Objective-C program in the BRossTools directory of the GitHub repository https://github.com/BradleyRoss/ObjectiveC-Examples . If you run the program, it might be interesting to see what happens when you use "Show Configuration" and "Show Sources/Destinations"

How to make chromecast a dlna receiver/client (indirectly)

I got a chromecast, rPi, PC, iphone, android tablet.
The apps I want to cast live video from only support DLNA, and I want to watch those lives using chromecast.
I think it maybe kinda like this:
[1.Phone apps] -> [2.Conversion server] -> [3.Chromecast]
1.Phone apps can show a list of DLNA receiver to cast its live video to;
2.Conversion server can be detected as DLNA receiver, it receives lives sent from phone apps and convert them to something that chromecast supports in real-time, then send them to chromecast;
3.Chromecast is plugged to TV, it receives things from conversion server, so I can watch them on TV.
Let's say the server is shown as DLNA receiver [myRelay]. The use case would be like this:
I open my app on my phone, select where to cast live video to(which is myRelay) from detected device list, myRelay do the conversion thing and send them to chromecast, then I can watch live video on my TV.
The problem is, I don't know how to set up the server, what kind of sofwares out there I can use.
Maybe there is some kind of server that can run on rPi? I don't know. I'm new to this.
Please help!
If you want to use the Pi, check out this instructable: https://www.instructables.com/id/Raspberry-Pi-Media-Server-MiniDLNA/
Keep in mind that depending on the model, the WiFi might chug when trying to stream high-bitrate content. It might be better to connect the Pi to the network via Ethernet.

iOS and Bluetooth low energy, possibilities?

I want to connect a robot, via Bluetooth, with an iPhone (4S or more) via Bluetooth low energy (BLE) 4.0. This robots require to send all the notifications of the iPhone to the device.
For example: If the iPhone gets a new email, I must send the event to the robot, and it will blink an LED. Stop.
I want to know if the iOS Bluetooth APIs of the Bluetooth framework can do this, or better, can share the Internet connection or whatever that can do this work.
I'm asking this, because I have heard that the APIs have some restrictions.
PS: ANY solution that can do this is very accepted (no Wi-Fi connection solution).
Bluetooth LE would be the way you want to go here, because standard Bluetooth requires your device to be MFi-compliant. Standard Wi-Fi could also work, if you're able to require the presence of the supporting network.
As of iOS 6.0, you can set up your iPhone as a Bluetooth LE peripheral, which would allow it to send notifications to your device, if it is configured in a central role. That would be a pretty power-efficient way of updating your device with new data.
However, there's one large hurdle to doing what you want here. iOS applications have no access to system-wide notifications, so you won't be able to listen for incoming emails or other notifications like that. You'll be able to send data to your device via Bluetooth LE, but you're not going to know when emails come in so that you could send that to your device.
With bluetooth 4, you could control a robot, as well as create a "notification" bot. It could be done quite easily. However as mentioned, you can't access system wide notifications in iOS.
However, you could use an external solution to listen for system notifications and then an API to listen a singular encoded notification and have your app listen to that.
One such system is https://ifttt.com (no affiliation)
There are also some great plug and play BLE options for rapid prototyping.
You can do it. A simple solution would be let a phone check your email periodically. Don't rely or try to use external Apple applications to do that, but use services provided by your mail.
In the case of Gmail, try to go to https://mail.google.com/mail/feed/atom. If you are logged in your Gmail, you will see the unread mail in XML format. The way you would login using a URL is: https://username:password#mail.google.com/mail/feed/atom
So what you can do is periodically parse the output and when <fullcount>0</fullcount> value changes call your robot service via BLE which should act as a callback for this specific event.

How to send data to iPhone from external device

I have an external device that we manufacture that basically monitors 4 voltages, converts them to a 16 bit digital number then streams this info back to a PC every 100mS or so, using a serial over USB style chip. Basically a data logging system.
We would now like to collect this information on an iPhone and I am wondering what is the best way to get the data into the iPhone?
I am assuming there is no way we can physically connect directly to the iPhone dock connector as the protocol to do this is not available to iOS developers?
Obviously we could do it over a WiFi network but there will not always be one and we want to keep the external hardware fairly simple, i.e. no need for a computer or Wireless router etc.
If we add Bluetooth connectivity to our hardware would this work? I read that only 'Made for iPod' type Bluetooth devices will connect, in which case how can we achieve 'made for iPod' status? It would be relatively easy to add the necessary Bluetooth chips to get the system up and running.
In an ideal world we would like to do this without having to use a 3rd party interface.
I have been thinking about trying to digitise data as an audio signal – like a modem, and send it into the line input jack, but I don’t think it will be fast enough – this would be new territory for me.
Anyway all suggestions gratefully received!
Thanks!

How can I create a small Mac app that receives data over the WiFi network from an iOS app?

What I need is to have a simple screen in this Mac app that just prints a string as the iPhone is transmitting strings through the WiFi network.
This string is simply a string value from a slider being adjusted up and down by the user on the iPhone. The data will be sent to the Mac app and then the Mac app will receive this signal from the WiFi network and simply print the values.
This is a constant connection. I'm not trying to sync once. I'm trying to listen to the iPhone device from the Mac to see if the iPhone is sending any more strings as the user slides the UISlider up and down from the iPhone app.
How can I create the client side? Do I need to use Bonjour or something?
In my answer to this question, I provide a link to a sample application that has a Mac component and an iPhone one. These components communicate between one another over a WiFi network, with changes in a label on one being reflected in the other. This is done using Bonjour discovery and the standard networking APIs.
With simple modifications, this could be used to send the continuous updates you need for your particular case.
Use the CFNetwork framework, you can use bonjour for discovery and then handle a persistent connection through native sockets for passing data back and forth.
http://developer.apple.com/library/ios/#documentation/Networking/Conceptual/CFNetwork/Introduction/Introduction.html
Here is an excellent tutorial to get started, its for iOS but CFNetwork is available in OS X too.
http://mobileorchard.com/tutorial-networking-and-bonjour-on-iphone/