I'm writing an app which captures audio from the mic input which works fine but I want to capture audio from the dock connector rather than the mic input. I know that pins 5 and 6 are audio inputs, so my question is from a software point of view, is this possible and would I just use the AudioToolbox framework functions as I am now?
No. This is not possible for regular apps on stock OS iOS devices. Inputs on the dock connector appear to be inaccessible from any app except when working under Apple's MFi program. You have to contact Apple for any information on enrolling in this program, which may involve some paperwork.
Apples Camera Connection Kit might allow using USB microphones for input. There are also some 3rd-party audio dock input products.
Related
To prove a concept I am trying to output the iDevice microphone over Airplay. I have modified the AurioTouch code to provide the pass through, and it works fine using Airplay Mirroring from 4S / iPad 2 to Apple TV.
However, when I try to use standard Airplay, either from iPhone 4 / iPad 1 or to an Airport Express, the audio outputs from the device speaker, even if the Airplay device is selected using either the system output route selector or the MPVolumeView in my app.
Is there anything I need to do to enable Airplay on my AudioUnit? According to the documentation:
AirPlay support is built in to the AV Foundation framework and the Core Audio family of frameworks. Any audio content you play using these frameworks is automatically made eligible for AirPlay distribution. Once the user chooses to play your audio using AirPlay, it is routed automatically by the system.
But I don't seem to be having any joy.
Are there any external buttons/controls that can be plugged into the iPhone that can be used within an app. If so, does anyone have any links to any code to use with these controls.
I was thinking of some kind of iPod controller that I could hack that could be plugged into the slot on the bottom of the phone.
Cheers.
Yes. Several USB MIDI controllers are supported via the Camera Connection kit on stock OS iOS devices. An app can use CoreMIDI in/out messages to get input from the buttons on these external MIDI controllers.
But an app can't use a generic hackable USB input device under the stock OS, unless the developer is the manufacturer and also a member of Apple's MFi program.
ADDED:
...or you hack the USB device so that it imitates one of Apple's supported MIDI devices. Example of doing this with an AVR microcontroller is here.
Apple's CoreMIDI reference is here.
ADDED #2:
If you want even more accuracy for a timer app, consider using the mic audio input jack, and connecting some buttons to audio chirp generators (could be done either with analog circuitry or a tiny cheap micro). Use different chirp frequencies for different buttons. Some suitable DSP code on the iPhone could probably determine the relative timings of audio input chirp signals with sub-millisecond accuracy.
There are many solutions to this, most involve jailbreaking the iphone.
The most famous/popular is the iControlPad.
I have a guitar diagram app for Android that I am porting to iOS. Android has a embedded midi synthesizer (sonivox), so I can generate midi files and let Android handle the playback.
Is there a way to do this on iOS? Or are there very lightweight embeddable synths for iOS?
Since iOS 5 there's now the AUSampler audio unit for which you can load a sound bank (apple preset and soundfonts) and then control the sampler/synth via MIDI messages.
Seee this example app:
https://developer.apple.com/library/ios/#samplecode/LoadPresetDemo/Listings/ReadMe_txt.html
It works great!
Update: My answer is out-of-dated. #lukebuehler's answer is much appropriate.
If you don't mind non-opensource solution, try FMOD. Being a commercial audio engine for games, fmod equips a simple MIDI synth. I've tried the free evaluation version. It plays GM MIDI files correctly on my iPhone 3G.
If what you want is not just a SMF file player, you want a full function GS/GM softsynth, which can response individual midi events in realtime. You can try the midisynth from CrimsonTech. Its license fee is fair. Crimsontech provides several demo apps in the appstore. Besides, it also provides an evaluation SDK for free. You don't need to pay a penny for the license until you're really going to publish your app.
I don't think MIDI support in iOS 4.2 allows playback of MIDI data from the phone itself. It is merely for sending and receiving MIDI commands to other MIDI devices.
From the recent iOS 4.2 docs, it seems that you can use the MIDI support to send MIDI commands to other devices for playback. You can also receive commands from other devices and make changes to these commands, or to save it in a file. However I can't find any support to actually play MIDI file from the phone directly. Someone please correct me if I'm wrong (I wish I'm wrong!!).
There is MIDI support in iOS 4.2. If it is the same as what OS X provides then trhere will also be a basic synth included. Check it out.
How would I go abouts playing an 'audio in' through the dock connector in an iOS app? I'm making an app just for myself and have no plans of putting it into the apple store. I have the 30pin breakout board, and on it there are pins for L/R audio in, but I can not find any info on how to use them?
Thanks
As far as I'm aware, your only officially supported option for any accessory using the dock connector would be to use the External Accessory Framework, which requires enrollment in the Made for iPod Program (overkill for your purposes). However, the iPhone and iPod both support line-in via the headphone jack, and there are plenty of apps that make use of audio input. At least it provides some possibilities.
Have you looked at the pinouts for the dock connector floating about? It appears that certain resistances connected to pin 21 indicate to the iDevice what is connected.
68kΩ seems to be the magic number for audio in/out.
I want to write a function in my iPad App, which allows me to stream the music choosen on iPad to the connected Game-Interfaces (iPod, iPhone...) via bluetooth. Does anyone knows a simple solution or maybe wants to share some sample code?
Thanks for help!
I am doing something very similar. I have my iphone connecting to multiple devices to stream audio to them, but I want the device that is streaming the audio to also play audio as well.
You can look into the GKSession in the GameKit API and that should give you a good start.
Also maybe openAl, but I think that might be a little overboard. I heard Core Audio has a built in feature for bluetooth devices that are connected to play audio through them but I dont think this goes for iPhone, iPad, iTouch etc....
I have also created my own peer connection interface that allows me to see multiple bluetooth devices that are running my app. I then can click each one and each gets connected. I then I added a test to push a text message to all connected devices for testing. Next I need to find out how to stream audio to the connected apple devices.
If anyone has any info on this I am sure we would both appreciate it.