Baby steps in swift 1: Recording audio and adding filters with swift OR How Udacity rules
This is actually gonna be more of a praise and review of Udacity and their teaching methods than a showcase of my first app. Having tried both conventional programming courses at a technical university, codecademy and lynda.com this is by far the best way of learning programming and an IDE. The three things Udacity do the best is.
- Encourages you to learn how to solve problems rather than just teaching you to write the correct code. They are forcing you to read documentation, google questions by yourself and reading a lot of stack overflow articles. As well as encouraging you to explain code using common English.
- They connect the learnings to real life situations like a job interview, this really motivated me to learn and understand as I’m in less than a year will be in that situation.
- And finally, they remind you to take breaks!
Below is the finished app, the pictures below doesn’t really give it justice as it is actually recording audio, writes it to a file and lets you play it with different filters applied.
When the microphone is tapped a audio recording starts and is saved to a file locally on the users device using the AVAudioFile class.
The Snail and the Hare filter (slow and fast) uses the predefined rate property from the class AVAudioPlayer, rate goes from 0.5 (which is half speed) to 2.0 (that is double the speed). The Chipmunk and DarthVader filter changes the pitch of the recording using the property pitch in the class AVAudioUnitTimePitch, using the values 1000 for ChipMunk and -1000 for DarthVader.