More thoughts on Bassline MoDrum and CoreMIDI

I was thinking about the updates that came to BassLine and MoDrum over the weekend and their use of CoreMIDI.

Firstly I’ve been wondering how many other developers will take this on board and allow their apps to use the clock in the same way as these two and also use background play.

Actually my first real thought was ‘Wow’, this is a big step forward for mobile music making, getting multiple apps to sync clocks on a single device is awesome. The next problem of course is to be able to control them all properly and even record them from inside one device.

So I’d be very interested to hear from developers to know if they are going to take their apps in the same direction.

I tried that multitask thing written about earlier here with funkbox, but funkbox is the only app that closes down when leaving,it doesnt keep running in the background like the other apps?what am i doing wrong?

@kovsky, FunkBox doesn't do background audio yet, it can send MIDI clock that happens to work with finger's MoDrum/BassLine apps but you can't go back and forth like you can with them. He put the feature in his apps on purpose, and it's really cool. My app just accidentally half-works with what he did. Use only his apps to really try this feature out, he did it right.

To answer the original post, I definitely would like to put this feature in, but it may take me a little bit. It took me about five minutes to get it mostly working, and it's super fun to play with. But, I realized quickly that in this case “mostly working” isn't going to cut it.

Apps that sit in the background like that have to be super well behaved, and tweaked to be this sort of background app. With the way iOS multi-tasking works, when you “quit” them they are still sitting back there doing their thing, unless you go into the task bar and kill them. In MoDrum and BassLine's case, this wasn't a problem as I'm sure he spent time on this, so they sat back there fine for the most part. With my own app, I noticed that if I was sitting back there other audio apps were impaired. N-Log Synth, for instance, would start crackling with 5 or more notes played, whereas normally I can play many more than that with no problem. I don't want to release something that works okay when you're using my app, but causes problems for other apps if you don't go out of your way to kill it. You may forget mine is running in the background and blame N-Log for the problems, that's no good.

So for me it's going to take some re-designing and experimenting to get it right. I think the payoff is worth it, it's so fun to be able to switch back and forth with your favorite app for each specific part all synced together. But previously I always looked at one of the biggest advantages of making an iOS music app to be that it took over the device, and you mostly didn't have to worry about anything but yourself. It limits you, but it also gives you a lot of freedom to make things look and work exactly how you want them to. With this new twist, that's no longer the case, you have to think about how you're interacting with other music apps and the overall system in general. So it gets trickier.

Add in all the other tricks we've been adding recently like CoreMIDI, juggling an increasing number of iOS version and devices, and increased feature expectations coupled with decreasing prices, and, well, we'll see what happens. On the one hand I'm really happy to see the potential for apps to become real music tools instead of just toys. On the other hand, a big reason that so many interesting ideas were realized in app form so quickly was that it was relatively easy to create something and get it into peoples hands without having to worry about a lot of the technical and feature baggage that traditionally came along with desktop software.

@iLpDI didn't know BM2 played in the background too. I just tried it and you're right. I notice it also seems to affect N-Log's polyphony even when sitting back there silently, like my FunkBox experiment did. Maybe MoDrum and BassLine just spent more time optimizing that part. Hmmm, guess I'll keep tinkering with it and think about where it needs to be for me to be comfortable releasing it. It is a super fun feature but I really don't like the idea of sitting in the background there causing random problems.

So, after spending all that time writing that long self pitying post, I got pissed that it wasn't working and went back at it to try again, and fixed it. Turns out I just had to increase the audio latency, FunkBox has it set low so you can tap the pads, but nobody's tapping the pads when NLog's in the foreground. So I need to do that any time I get backgrounded. This should have been the first thing I tried.

Sorry to bore all of you, I did in fact wait a bit before posting all that because I knew I'd stick my foot in my mouth…

Another question in the original post was how to capture all the audio from the individual apps for export/mix. I don't think this is possible, but keep in mind just a few days ago I was telling somebody that synced up background music apps weren't possible either. I've read many devs asking to do this in the past though, usually to capture the music that's playing through the iPod/iTunes app, and the answer I've always seen is you can't do it. So this background-sync feature will probably be good for inter-app composition, but you'll need to bounce the parts down separately and mix them in another app.

I definitely could be wrong though, that seems to be happening a lot lately.

@Artno man it's not boring at allwe r here because we r mobile music nerds :p and we like to read and talk about that :pBTW why if I export from funkbox it playes a loop much longer than actual loop time?

@iLpd When it's recording, FunkBox plays the loop twice, it doesn't actually record the first pass but it wants to catch any trailing sounds from that first pass and include them in the second part that becomes the recorded loop. So then when you take that final loop and put it somewhere else it doesn't cut off at the end, it loops.

Couple things that could be improved: first, if it's a double time loop (speed switch up), the exported loop is actually 2x the length of the loop, so when it's recording you hear 4x the length. That could be cut in half, I'd just have to handle recording the two speed types differently, which currently I don't.

Second, I could do an offline render instead of the current one you have to listen to, it'd be faster but would wreck the feel of sitting there with a sampler recording your loops one by one. What? You don't want that lame “feel” you say? Well too bad, sonny! Why back in my day, you had to switch floppy discs between takes after sampling both ways uphill…

well for the feel a saving to disc with some floppy graphic could work :pU see I make music on my way to and from work for a simple reason that I don't have much time 🙂anyway I was just curious. It's not so serious problem.

well for the feel a saving to disc with some floppy graphic could work :pU see I make music on my way to and from work for a simple reason that I don't have much time 🙂anyway I was just curious. It's not so serious problem.

I think you can probably almost eliminate the CPU load of having Funkbox, or any other app, in the background if you shutdown any extra threads and, most important, turn off your audio callbacks if your app isn't making any sound.

I have been using Funkbox to test audio copy/paste in SynthTronica btw. Fun app. I love having 7 (and counting) different drum machine apps on my iPad.

@waffletower Hey, yeah both our apps announce their presence with a robot voice, they make a nice pair!

I think you do still have to keep your audio channels up, the backgrounding docs say if you're silent for 10 secs you will then get frozen like a normal backgrounded app. “Silent” means something different for low level CoreAudio music apps compared to higher level AVAudio radio player apps, I found that I could just feed 0's into my callbacks and not get torn down. But, even when I was just feeding those 0's and doing no other processing, if I didn't adjust the latency I had the crackling problem described above. I assumed if I completely removed them, I'd probably be considered “silent” and frozen, which would mean I couldn't react if another app did try to interact with me.

There's a lot of if and maybe and probably up there, which is why I am hesitant to charge into putting the feature in before testing it and trying a few different things. With the latency adjustment I think I found the biggest source of the problem, but now I'm still a little paranoid. Backgrounding your audio app in this way is different from normal iOS backgrounding (and different from backgrounding an audio app that never plays in the background) and the stakes are a little higher so I want to get it right.

Also, wanted to mention that finger's MoDrum/BassLine CoreMIDI setup implementation is really well done. When you are configuring things you can turn different input/outputs from various sources/destinations off and on, the app registers itself as a source and destination, its very nice and elegant and makes sense in a multi-tasking environment. Most apps (including mine) are currently in the “take over the device” mindset where we blast MIDI out to everything and gobble up anything we see. Having an app that works with other apps in the background will require some more work to be a good MIDI citizen in addition to behaving yourself audio-wise.

@Beat &ArtSo if we can't route devices locally on an idevice maybe it could be possible over wifi or bt?I seen in Moog Filtratron settings BT audio ruting option.Could an app with wifi/bt audio input exist?

@iLpD Yes, if I had to come up with some sort of solution, I'd start with trying network/bluetooth type stuff to stream between the apps. Not my area of expertise but my initial impression is it would be hard to do well, and since it wouldn't be a standard it would be harder to get other devs to adapt it. There might be an easier way to do it, or Apple might just randomly drop a better solution on us when we least expect it like they did with CoreMIDI. One step at a time though please, some of us (which is to say, everyone but finger) is still trying to get CoreMIDI right!

An AU/VST type standard from Apple would be the best I think, install instruments/effects into your system and then all apps can access them for audio/midi, but I don't think Apple is going in that direction. They don't even allow plugins to be sold on the Mac App Store.