iPhone Programming Lab: Audio + Interaction

Posted on January 12th, 2010 by uri

In this lab we had to make 3 small iPhone Applications to interact with audio and play with the SDK and the Mopho API. Below there is download link and also a description of each app.

All of these apps make use of the MoPho API. They are all inside one single XCode Project, divided into three different Targets. I like the idea of having one separate project for every assignment. It is also very easy to switch between Targets and installing them on the iPhone by opening one single XCode Project.

Apps Icons

Download

Posted on January 12th, 2010 by uri

CLICK HERE TO DOWNLOAD (XCode with the latest SDK required). All apps are included in the same package.

Installation

Posted on January 12th, 2010 by uri

All these three different apps are included in one single XCode Project (that you can download from here).

To install them on your iPhone, open the hw1.xcodeproj with your latest version of the XCode with the SDK 3.1.2. Choose the Target (look at the picture below to find where to change Targets in your XCode). Connect your iPhone and press Build and Go!

Sinewave app Icon

SineWave

Posted on January 12th, 2010 by uri

This is the Sinewave app. It is a very simple app that plays a sinewave at 440 Hz that can be modulated by shaking the device.

Coding this application was quite straightforward thanks to the great tutorial on the Mopho that we had. That tutorial covered mostly part of the implementation of this app.

Sinewave app Icon

FM Synthesis

Posted on January 12th, 2010 by uri

This is the FM Syntehsis app. It is a FM Synthesizer that has two different modes:

  • Automatic: You don't have to press any button to hear the FM Synthesis
  • Manual: You have to press the "Trigger Note!" button to hear the FM Synthesis

To switch between modes just press the switch in the middle of the screen.

You can tweak three different parameters for the FM Synthesis:

  • Modulation Index: How much modulation you want
  • Modulation Freq: The Frequency of the Modulation Sinewave
  • Carrier Freq: The Frequency of the Carrier Sinewave

The Modulation and the Carrier frequencies are attached to different axis of the accelerometer. So by shaking the device you will hear different sounds as well.

The major problems I had while creating this app was to fully understand FM Synth (though Perry Cook says that nobody really understands it!). After I did some research, everything was quite straightforward.

Sinewave app Icon

Delay Line

Posted on January 12th, 2010 by uri

This is the Delay Line app. It is a Delay with two different parameters:

  • Delay Length: The leght in time of the delay to be delayed
  • Delay Factor: For how long you want the delay to be repeated

To change the delay length you have to pinch in the right area of the screen.

To change the delay factor you have to move the knob (to do so, you can put your finger on the knob anb move it left -to decrease- or right -to increase-).

The major issues I had while writing this app was about the Mopho library. Mostly on the Touch callback. I really wanted a Knob working, so I spent some time figuring out how to connect Views and assign Tags to access to them from the Touch Callback. Also for the Pinch I had to figure it out by hand computing the distance between touches. Although it took me some time, I think the Mopho API is extremely useful!

Sinewave app Icon