Making The Fong Phone

The Fong Phone is a synthesizer app created by myself and Andrew Allred to produce drones and soundscapes for electronic noise music. It is my first real mobile app, now available for both Android and iOS

The source is also available from github via the Open GPL V2 license. In this post I want to break down the technology of the Fong Phone a bit and reflect on the experience of getting my first app on the market.

Making the Fong Phone available for both iOS and Android was a no brainer because the fong phone uses Cordova and the source is all pure Java Script. Cordova provides a native wrapper you use to load web apps from the local file system of a phone and present them in a way that makes them appear as native apps.

Cordova (or increasingly ionic) is often used to build cross platform business apps, often for internal use in the enterprise. As such they do not have a great reputation for being beautiful or performant. But the fact is Java Script has been maturing fast as a development platform, as someone who writes a lot of Java Script I really wanted to push the boundaries of what you can get out of a cross platform app and as much as possible avoid native code and stick to pure Java Script.

The Web Audio API was introduced to Java Script with ECMAScript 5. The Web Audio API was one of things that made me sit up and take note of HTML5 as something more than just hype. It exposes the ability to do real time sound processing and audio effect generation in Java Script. This is done without blocking the thread because most of the heavy lifting is done behind the scenes in C with the API exposing pipes and events. I won't go too deep into the details of Web Audio API, but the way you interface with it programitcally is not too dissimilar to a physical mixer board or something like Pure Data. Linux users might think Jack. It's really fun to play with. You can learn all you need to know about the api from mozillas dev site entry. I also wrote a previous post which shows a very primitive demo I did using the Web Audio API. I had most of the idea for this project in my head at that time, but the API was not widely implemented yet; so, I put it on the back burner for a while and waited for HTML5 adoption to spread.

Checking back in 2016 I discovered that the web audio api was almost everywhere except the native web browser for Adroid, which seems to lag disturbingly far behind the rest of the world, but this is where Crosswalk came to the rescue. Crosswalk is a plug-in for cordova which packages the webview into your app. This webview tracks chromium and provides a nice dependable environment to program against with all the latest and greatest html5 features including web audio.

Cordova + crosswalk provides an amazing mobile development platform. It's been said that you can add js to the end of any any word and there's a library for that (as evidenced by poopjs). The Fong Phone leverages many great java script libraries including AngularJS. I really recommend using IonicJS rather than straight cordova which includes Angular from the start. We actually make very minimal use of Angular, it's pretty much just serving as a bulky client side routing system at the moment; though having looked at some of the templating that can be done through AngularJS, I'm interested in using it to clean up some of the code.

I found that writing this as a JavaScript application rather than native code was not at all limiting. I have encountered some audio artifacts when switching tabs, which I believe may be performance related, but they are infrequent and there are still a lot of tweaks that can be done make the code more performant. I think this app is proof that Java Script is capable of far more than boring business forms.

One interesting wall we have hit is that many users have been requesting support Audio Bus. Audio Bus is not something I was previously aware of. It is essentially Jack for iOS and allows mutliple applications to pass sound streams. This definitely seems like an interesting peace of tech, but I am not sure how possible it will be to extend a cordova app to output over Audio Bus. I'm also weary to implement a feature that will be unique to the iOS version.

One of the great things about the Fong Phone and the fact that it's written in Java Script is not only was it easy to make it cross platform for mobile, but it can also be ran on any desktop OS right in the chrome browser. I think this is one of the biggest arguments for keeping a project like this platform independent. I'm really looking forward to creating some forks that are more geared towards the desktop.

It was nice to learn that both iTunes and Google Play are a rewarding way to distribute software. They may not be very foss friendly but they definitely make it easy for you to reach an audience. The review and submission process in both cases was quick and painless. I can see how app markets add a lot of value by handling transactions and creating a trusted centralized source to distribute your software.

At the same time of course they lower the bar of entry creating a more crowded market place and the googs of course gets its 30%. Being un-known developers doing this largely as an experiment and wanting to share something created to scratch a personal itch we decided to price the app at 99 cents. I hope this app will work on most phones, but lets face it it's not like we have a QA department; so at this price hopefully people can try it, give us some feedback, but not be too disappointed if it is buggy on their device. So far feedback has been mostly positive.

Bottom line, a 99 cent app is not too likely to strike Internet gold. In fact, I suspect the gold rush in the app market may be past us, but as a spare time project that I give away for free under the gpl anways, the app store provides a great way to distribute to people who may not be technical enough to download the project source, build and side load it onto their device. This will almost definitely not be my last mobile app, and I look forward to building on this project and leveraging this same stack to do some more interesting projects in the future.