AVFoundation

I began work on my Core Audio app yesterday. I had a whirlwind of activity the last week or so and yesterday was my first day to really sit down and work on my app.

One of the things that was invaluable to me to learn was how to translate a command-line application to an iOS application. Instead of creating a user data struct, you take those parameters and set them as properties. The methods then get placed in the View Controller instead of the main method.

With those vital pieces of information and a lot of sample code, I figured I was off. I knew I needed to figure out how to set up the recorder, so I looked at examples of how to do this. I had an example for audio queues and audio units.

Things turned out to be more difficult than I anticipated.

There was a lot of code that was either hard-coded for the command line or looked for parameters that were not going to be available on an iOS device.

I spent a few hours trying to cram a square peg into a round hole. It was a little frustrating and I started to feel discouraged. My “glow” from the conference was starting to wear off and I began to realize why every talks about how incredibly hard this stuff is.

I decided to attempt another approach. I knew that AVFoundation was created a while back to make things easier for people who want to do relatively simple things. I wanted the recording process to be easy because I don’t plan to do any processing with it until playback.

I found a tutorial on AVFoundation.

I spent the rest of the day working though this tutorial. This was some of the best time I spent on this project.

AVFoundation was designed to work with an iOS device. It was the right tool to use for the recorder. I could have spent a week wrestling with trying to make a different framework behave the way I wanted to. At that point I probably would have asked the Core Audio mailing list or Stack Overflow and everyone would have been like, “Dude. Just use AVFoundation.”

I think it is always worthwhile to explore the simplest way of accomplishing a task. It was possible that the tutorial would not have helped me find a solution, but I think that dedicating a few hours to looking down a path that might work is a wise way to proceed with something you have not done before.

I did not do any work on my app today. I had class this afternoon. I find it difficult to focus on learning something new if I know I am going to leave in a few hours. Instead I spent my time this morning doing a multithreading tutorial.

During class this week we talked about Core Data. I also saw a talk at CocoaConf Boston about Core Data that made me feel like a complete idiot. So I looked at Safari Books Online and I found a rough cut of “Learning Core Data for iOS” by Tim Roadley. It is a whole book about Core Data where you work through a large and complex program that showcases the capabilities of Core Data.

Core Data is hard, but having a large tutorial where I can read about something, type out code, and not have to make any of my own intuitive leaps is about as much as I can do on days I have to leave the house.

I am hoping to improve my toolbox to learn how to do hard stuff. I also want to figure out if Core Data is a good way to store and process audio data.

I have created a more realistic timeline of when I hope to finish my app. I am going to take the next two months to work on it. I am going to spend that time polishing my skills with debugging tools, instruments, version control…

Goal for the end of the year is to have a nice app to show prospective employers.

Further updates tomorrow!