Simple embeddable MidiSynth for iOS? - iphone

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.

Related

.Net (or other) dev links for streaming video to an Apple TV?

We are a school district and are in the middle of deploying ~800 iPads, one for every teacher. Next year we'll probably be installing an Apple TV in every room to mirror the iPads wirelessly to the classroom projectors.
I would love to use Apple TV as our standard to mirror all our Windows7 laptops also.
AirParrot (http://airparrot.com/) allows this from Mac OS/X. Apple doesn't license the mirroring protocol so the way AirParrot gets around it is they basically stream the desktop as an H.264 "movie" that is sent to the Apple TV. The Apple TV thinks it's just playing a movie. From the reviews it seems they've gotten the lag to a pretty acceptable level.
I can't see why this couldn't easily be done for Windows 7, I just can't see a app out there that has done it.
Any ideas? I'm a .Net software developer. If anyone has at least links towards how to handle Apple TV video streams from .Net that would be a good first step.
Thanks!
I'm working on a C# library for sending pictures/video to the AppleTV, having trouble with video cutting out after 30 seconds (Link to question), but hopefully I'll figure that out soon. If that problem is overcome you can probably figure out how to generate a movie of the screen and stream it using the library code.
https://airlib.codeplex.com/

iPhone Bluetooth Audio API

My car has bluetooth capabilities for connecting to my iphone for phone calls; however, it does NOT support bluetooth audio for music streaming. I know apps like viber or skype also use bluetooth for phone calls. My question is: is it possible to write an app that fakes phone calls to stream music to my car, as if someone is calling me (but is actually playing music)? Is there some other way to hack this to get bluetooth audio streaming?
No need to jailbreak your phone. Just buy the A2DPblocker app. Costs $2.99. Sound quality isn't perfect but better than the alternative. Worked for my 2010 Volkswagen so should work for any other car that supports bluetooth but not streaming music.
First poster -
There is already an app to do this - it's part of SBSettings called Bluetooth Mono that needs to be installed (so only MONO and only for JB'd phones).
Second poster -
I suspect you are correct about HSP - I've installed the app and the sound quality is terrible.
So, I've put all my music on a USB stick and leave it permanently plugged in. Far superior sound.
Mike
I don't think there's an easy way to do this. But the bigger issue is that it would sound terrible. The bluetooth connections for doing phone calls use headset profile (HSP) and are low bitrate, mono, and frequency limited to voice ranges.
Applications for streaming audio/music over bluetooth use A2DP profile, which is much higher bandwidth and stereo.
If you try to pipe music over a an HSP phone link it will sound horrible, just as it does if you are talking to someone on the phone and they have music playing in the background.

Capture audio from dock connector

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.

Sharing Audio over bluetooth

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.

MIDI player/synthesizer library for the iPhone

Does anyone know if there is a free/cheap MIDI player/synthesizer library that I can incorporate into my iPhone application?
As I understand it the iPhone doesn't have native support for MIDI playback.
To work around this limitation I've created a bank of .caf sound samples that I playback myself but I'd really like to improve the implementation and use MIDI if possible.
Any advice would be greatly appreciated.
Since 10 october of 2011, that is since iOS5, Apple has started delivering basic API for midi files playback. The API is called MusicPlayer along with MusicSequence Check this out :
https://developer.apple.com/library/ios/#documentation/AudioToolbox/Reference/MusicPlayerServices_Reference/Reference/reference.html#//apple_ref/doc/uid/TP40009301-CH1-SW1
By setting up an appropriate Audio Unit Processing Graph you can output the sound you like.
Look at TiMidity++; it looks like something that should be portable to the iPhone platform.
TiMidity++ is a software synthesizer. It can play MIDI files by converting
them into PCM waveform data; give it a
MIDI data along with digital
instrument data files, then it
synthesizes them in real-time, and
plays. It can not only play sounds,
but also can save the generated
waveforms into hard disks as various
audio file formats. TiMidity++ is a
free software, distributed under the
terms of GNU general public license.
Many people have ported TiMidity++ into various platforms; FreeBSD,
NetBSD, many Linux distributions,
Windows (and/or Cygwin environment),
and Mac OS are known to have their own
versions.
There is a commercial library available from Crimson Technology
Crimson Technology Library
I have never used it so I can't vouch for it's quality.
This is a library I've used for MIDI synthesis in Android:
https://code.google.com/p/android-midi-lib/
Although it can't be used for iOS, I think you(and anyone who's interested) can still take a look at the implementation of the MIDI file format(i.e. how bytes are written to a .mid file) and possibly implement a MIDI library yourself.