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!

Learning Core Audio

CocoaConf Boston

I went to CocoaConf Boston this past weekend. I feel very fortunate to have been able to attend this event. I won a ticket to the conference and I had a lot of help just being able to get there.

This was a life-changing weekend for me. I spent a day doing the Core Audio workshop with Chris Adamson. This workshop was one of the first times that I got into the flow with programming.

Don’t get me wrong. I really like to code. I have just noticed over the last few years that I wasn’t getting the same “high” I was getting when I understood concepts before. I would spend a while debugging a huge project and when I got it debugged and working I never felt like “Yes! I got it to work! I am amazing!” I always just felt like, “Okay, that’s done. On to the next thing.” While the project isn’t working I feel miserable and unhappy because I didn’t get it perfect yet. I started to feel like a masochist because I was going through all the pain but never got the emotional payoff at the end.

This past weekend was different. When I grasped concepts with Core Audio that I hadn’t known before I felt my mind expand. The sky opened and the rapture came. I was so high off of learning this code that I could not sleep for almost a week. I was completely wired.

I want to briefly explain my interest in Core Audio. One of my self-appointed titles is “High Priestess of Audio Programming.” I am not saying that because I think that I know more than most experts on the topic. Far from it. I am a beginner and I have a lot to learn.

I love sound. I want to fully understand it and get as close to merging with it as I possibly can. The best analogy I can come up with is that for me learning audio programming is like a hard core Christian learning Aramaic so that they can read the Bible in the original language. They want to get the direct words and meanings without being passed through the filter of a translator who might have their own agenda.

I know giving myself that title is probably flaky and arrogant. I will probably have to drop it at some point in the near future but I would love it if I can keep it with people knowing the reason behind it.

I was exposed to a lot of ideas this past weekend. I was exposed to the idea of writing a book and speaking at conferences. I got distracted by a lot of shiny objects and I got seduced by the idea that I am where I will probably be in a few years, but I am not there quite yet.

My goal is to be a hard-core, bit eating programmer. I want to master the hardest things I can find. I want to get as close to the metal as I can. I want to be the person who writes a language or a framework that everyone uses. I want to be Linus Torvalds or Ada Lovelace. I do not want to be the token female programmer who got hired for diversity reasons.

Woman Programmers vs Women Who Code

I may or may not have complained about this already (probably have), but I am annoyed by the recent women’s programming outreach programs. I like the idea in theory, but all of them are along the lines of, “Here! We can teach you Ruby in three weeks and you are now a programmer! Yay!”

You can’t master programming in three weeks. Sorry, but no. I don’t like things where you type in one line of code then lots of magical voodoo happens. I love C for heaven’s sake! I want to learn some Assembler and kernel programming. I want to learn more Linux and shell scripting and regular expressions. At some point in the future I want to learn the math that is being done by my computer for DSP so that I can understand the language of sound.

I wish that these programs would focus on longer-term goals. I wish that they would tell women, “Hey, this stuff is hard. Take 2-3 years and really focus on understanding difficult concepts.” Support them when they think they aren’t good enough because they don’t understand something the first time. No one does. I usually have to expose myself to something about three times before I begin to process it. I can seriously feel my brain rewiring when I am learning a new skill. It takes time. Throwing someone into a week-long workshop to train them to be a code monkey doesn’t count.

My First Real App

That being said, I am laying out my plans for my app. I know that it is one thing to say I want to be a hard-core programming geek, it is another to actually be one.

I want to make a synthesizer. I want to program custom audio units and put together a huge, complex graph of audio effects. I am not there yet!

I am trying to come up with a project that will take about two months to complete that is impressive enough to get me my first job. I need to make the scope small enough that I can get it done in a reasonable amount of time but also impressive enough to capture someone’s attention.

My plan is to make an app that is a sound recorder. When the user pushes the record button a modal view pops up that has a user interface that shows audio level metering and the amount of time being recorded. If you look at Logic, when you begin recording there is a green bar that shows the amount of time being recorded. I want it to look like that. This user interface is the most difficult part of my project and it will be done last.

After the user records their voice and dismisses the modal view they will be able to play their voice back with some effects. I have two sliders, one that controls pitch and one that controls speed. I also have three buttons that will be mapped to various audio unit effects. I am thinking about having a distortion unit, a reverb unit, and I need to determine the last one. I am going to look through the audio unit properties header file for something that looks like it will fit into the rest of the project.

I started getting all confused and turned around. Where do I start? How do I store my data? How do I make my user interface? There is a level meter parameter in Audio Queues, how do I map that to an animation? Do I need to learn Core Animation?

I spoke to my teacher Eric Knapp. He was imminently practical. He told me to start at the beginning. Make an app that records a sound. The next step is to play it back. Then go from there. When he puts it that way…

Systems, apps, and games need to start simple and then get more complex. You need to make sure that the simple things work first and then you add complexity. You can’t immediately set out to create a complex system or else it will fail.

Finally, after I get everything coded I want to try to design the user interface. I have a degree in video production and graphic design. I have not used these skills in a very long time because I honestly don’t want to be a designer as a living. I am a fairly sensitive person and when you are doing something creative you will deal with rejection a lot. I don’t love design enough to persevere through the vast amounts of rejection my work will probably receive. I know that design is a matter of taste and that if someone doesn’t like my work it doesn’t necessarily indicate that I am bad at what I do.

I do know enough about design that I can hopefully make my project look like I didn’t ship it with developer art.

I will keep updating my progress on this application. My biggest enemy is lack of focus. I keep hearing from a lot of different places that whatever I happen to be working on at any given point is wrong. I start worrying about hedging my bets and learning a few “safety skills” in case this whole iOS thing does not work out.

I can’t do that anymore. I have to put all of my effort behind one thing and have faith that it will work out. Doing a few things badly is worse than doing one thing really well.

Moving forward. Not looking back.

If An Audio Framework Falls Online, Does it Still Make Sound?

About a week ago I finished my first programming book ever. I finished reading and coding the projects in “Learning Core Audio” by Chris Adamson. I wanted to get that done before this past weekend. I attended CocoaConf in Boston solely because Chris was going to be there and do a full day workshop on Core Audio. I will talk more about my experiences in another post.

One of the last chapters was about OpenAL. OpenAL is a framework that allows the user to create three-dimensional sound. One of the few links hardcoded into the book was for their site, OpenAL.org. I wanted to get the programming guide to read later, so I went to the site. It was down. I checked it a few days later, same thing.

I emailed Chris to ask him if this was a known issue. The book is a few years old, which is forever in programmer years. He wasn’t aware of it being down.

We began to look into this issue. We knew it was down and it had been for a while.

So I did some digging into OpenAL and what the hell is going on with it.

It looks like it began as an open source project. It was embraced, extended, and taken over by a company called Creative Labs back about five years ago. Their last update on OpenAL was version 2.1. OpenAL is now a proprietary technology owned by Creative Labs.

For some reason a few years ago they stopped doing any work on it and they have killed it off. They cut off all links to developers using it and stopped updating OpenAL.org. It is still owned by Creative so no one can go in and purchase the domain, but it looks very much like what happens when a large company buys a patent for something that they want to sit on to prevent anyone else from implementing it.

Correction: I have since been told that APIs are not copyrightable. Anyone is free to write their own implements of the OpenAL spec. If you want to go and make your own variation on OpenAL as Apple has you are free to do so.

My limited experience with programming frameworks and languages is that once they are abandoned they eventually go away. Apple might still have that implemented within their framework, but if the platform isn’t going forward then it might change.

Also, did slightly more digging and there is a different industry standard: FMOD.

This is not open source. It is owned by Firelight Technologies, but it is still being supported and maintained. It is multi-platform and there is a programmer API that is free to mess around with but they ask that you pay them a license fee if you plan to make money off it.

There seems to be a flourishing developer community in gaming forums, so that is one place to look if one were inclined to do 3D audio programming. I think it is just a bunch of C and C++, so you drag, drop, and include it in your project.

I don’t know if this would replace OpenAL within the Apple frameworks, but I don’t have high hopes for OpenAL. I am just very happy to know that it didn’t leave a vacuum. I was concerned that 3D audio was being abandoned totally and that would be a tragedy. I know there are a limited number of audio nerds out there in the world, but I am one of them. I aspire to accomplish some awesome stuff with audio and I am stoked to know that this possibility isn’t closed to me quite yet.

Because it Also Needs to Be Said

Yesterday I got immersed in a conversation on App.net about this incident. A female designer working for a Ruby shop in Ohio was sexually assaulted while drunk at a conference by her boss.

This is causing a lot of discussion about whether or not we have a community of “brogrammers” who feel this behavior is appropriate. I have spoken to several female developers who have had it with the community and are planning to leave because of the experiences they have had.

I want to add my two cents in here.

I have no doubt that this woman was assaulted. I have been assaulted many times (I prefer not to get into the details at this point) and the way she describes her feelings and why she behaved the way she did is consistent with every story I have heard from a real assault victim.

Now, I want to point out that a lot of people did the right thing in this situation. A co-worker noticed that things had gotten out of control and came over to diffuse the situation. Justine reported the behavior. The HR department determined that what happened was inappropriate and they let go of the person who did so.

THIS DOES NOT USUALLY HAPPEN!!

Most assaults that happen are not done by people in public. Had this assault happened in a more private place where others didn’t observe it, I would like to think that the business still would have done the right thing, but the odds are it would have been easier to ignore.

I have been to a half dozen conferences over the last year. I am actually going to another one next week in Boston. I am traveling by train by myself. I have never made a trip by myself before. After hearing these stories it does cross my mind that I am vulnerable. I enjoy going to the bar after the conference and chatting with my fellow attendees. I know that the possibility exists that someone might drug my drink and I would wake up in a room other than my own. I don’t think that is very likely, but I think about it.

I was at a conference in June where there was a lot of alcohol. The party moved to a weird old building on campus in Madison where I and people I had met a few hours ago wandered around drunk after coming in from the rain. I had an amazing time that night, but I knew there was always the chance that something could have happened to me.

I think my risk of being attacked is small enough that I do the things I was to do with my life. I accept that the possibility exists that someone might try to do something to me. I make sure to only spend time around people that do not make me uncomfortable. If someone starts to make me uncomfortable, I leave that situation.

At my last conference, Madison Ruby, I had a person attach himself to me at the end of the conference. After knowing him for all of an hour he acted like he owned me. When I tried to leave him to be around other people he came over and told me that I had “really shitty body language” because he couldn’t read why I had left him.

A friend and classmate noticed this douchebag’s behavior and asked me if I needed help. I said yes, I did. So any time this guy tried to be near me my friend would pointedly insert himself between the two of us. When the guy would be verbally possessive of me my friend would interject himself in the conversation and mess up the guy’s game.

I think what he did was awesome. It really does not take very much to support another person who is being made to feel uncomfortable and do things to make them feel safer. Everyone should do this.

The takeaway I want to interject here is that I feel being a woman who is in programming, engineering, name-male-dominated-field here, is like being a character in a horror movie. Everyone has that thought of watching the blond virgin wandering into the dark alley and you yell at the screen “Don’t go in there!! It isn’t safe!”

No one is (or should be) saying that the woman being murdered by the serial killer in the dark alley had it coming for doing something stupid. No one should say it’s okay for the killer to kill anyone for making a really dumb choice. Even if you put the onus on the serial killer for being 100% in the wrong, the blond is dead.

With Justine, she got about the best result that anyone can hope for when reporting an assault. That didn’t change the fact that she was permanently damaged from the experience.

You need to be more careful.

I wish I did not live in a world where I have to say that, but I do. Don’t close yourself off to every person at any conference, job, or whatever. But do listen to your gut and monitor your relationships to make sure things do not go too far.

Long before this reached the assault stage Justine could have left. She could have said things were too intense and she could have gone home. She tried to stick it out and show it didn’t bother her. That was a mistake.

Again, I am not saying that I think she deserved this or that she is wrong. I am simply stating that bad situations have inertia. They will continue to get bad until an outside force acts upon it to make it stop. If you nip them in the bud early then things are less likely to escalate.

You have control over your body and what happens to you. You do not need to cede your right to control your body to anyone that you do not want. You can leave. You can scream. You have choices. These choices get more and more limited the longer you wait. If something makes you uncomfortable, leave. You will not get anything out of trying to stick out a bad situation.

Stay safe. Be vigilant. Help others who look like they are in distress. Have a buddy to watch your back.

Chasing the Dragon

I am slightly concerned about my future at this point in time.

I am on my (hopefully) last semester of school. I am taking an iOS class, a JavaScript class, and a Java Class.

Each of these classes offers a different future.

JavaScript offers the future of doing web development. Web development is still very huge. Any business worth its salt has a website. Many people are developing apps for the web and using things like Phonegap to use JavaScript to create both iOS apps and Android apps.

Speaking of Android, those apps are written in Java. We currently have a mobile development degree geared towards Android where you take Java and Android development classes. Android is taking over a large portion of the market and Java is still very highly in demand at large companies in the Madison area who specialize in health care.

I feel I am at a crossroads. I know that the point of the programs at school is to make me as marketable as possible. I know enough different things that I should be able to get an entry level job somewhere doing one of these things.

7 of Cups

So many choices, but until you pick one, it’s all vaporware.

I feel paralyzed by choice.

I feel very much like this Zen Pencil’s quote. I know this might cost me a few jobs, but I do Tarot card readings and I am constantly fighting with the philosophy of this card.

The basic meaning of both of these references is the idea of choice. You have limitless possibilities, but once you take one step towards achieving one of these possible futures the other ones vanish.

You must make a choice. You might make the wrong choice. If you do, all other possibilities disappear. You could be the next Steve Jobs or you could make a bad choice and be no one.

I feel like I am supposed to keep my options open. I know I should do my homework like a good girl, keep as many choices open as I can, and look for whatever opportunity presents itself.

I can’t do that right now.

I want to learn Core Audio.

My first degree was in Journalism. I was a newscaster at a community radio station for three years. The first time I placed the headphones on my ears and heard my voice through the headphones over the air I knew my life had changed.

Over the years I lost my affection for news, but never for audio. I went back to school to learn audio engineering. I loved working with it. Things did not work out and I decided to go back to school to learn programming. I figured I made a bad bet on a disappearing technology and it was time to grow up and learn a real skill.

About a year ago I learned about Core Audio. I sort of knew that the programs I used for audio engineering were written in code, but it never really occurred to me that I could acquire the skills to write one of my own.

I am at a quandary. I love audio. I feel working with audio is my calling. I have felt that way for nearly two decades. So far my gut has not paid off.

How many levels of abstraction do I need to get to before I reach the right one? I feel like I keep doubling down on a bad bet assuming that it eventually has to turn around for me.

I feel wary. Everyone tells me if I master this one skill that I can write my own ticket and make a lot of money. I have heard this before. It has never paid off.

How many times do I believe what I hear before realizing that it is wrong?

I can’t ignore my gut. It tells me to keep moving forward. I am ignoring my classwork to learn audio programming. My rational brain tells me to learn Java and get a nice 40-hour-a-week healthcare job with two weeks of vacation and try to have a normal life. My gut tells me to keep moving forward with audio programming. Guess which one I am listening to.

Audio Queues and Audio Units

I am working on doing a Core Audio project for two of my classes this semester. I was supposed to do an internship, but nothing panned out. I am also supposed to work on creating an app to put on the Apple App store for my Professional iOS development class.

Currently I am working my way through the book. I am trying to get all the way through before October 23. I won a ticket to CocoaConf (thanks guys!) and before the conference Chris Adamson is doing a workshop on Core Audio. I would like to get through the books once before I go to his workshop. I know part of the point of the workshop is to learn Core Audio but I would like to be prepared and get as much out of that experience as possible.

Initially I was going to do a synthesizer app. I met a person at a CocoaHeads meeting who has been programming them for the last 15-20 years. He and I met up for coffee and he showed me his code. He also told me he has been working on his synth for four years. I tend to bite of more than I can chew. I have reassessed my project to try and accomplish something a little more achievable.

I am now focusing on creating an app that records your voice and plays it back. After I get it to that point I can add a levels meter and maybe some effects.

The first half of the Core Audio book goes over some audio basics and talks about how to create a recorder using audio queues. Perfect! I can take the command line programs as a starting point and integrate them into an iPhone app that has a user interface.

However, from past experiences, I have found it is a good idea to continue learning things before prematurely ending. I am glad that I did this.

The middle of the book is about audio units. Audio units allow you to do things that queues do not. If my plan was to just create a recorder that plays back queues would have been sufficient. Since I want to add effects to my app, I will need to utilize audio units.

So my progress is that I am about halfway through the book. I have found some working space and I am able to focus on plowing through the book. I really want to focus on just doing this, but I have other classes I need to work on as well. I have not worked on my JavaScript class for a week and we have a group project in the iOS development class that I have let slide. I am not even going to get into my Java class!

I think tomorrow and this weekend should be spent on some of these other things. I know I need to focus on Core Audio, but I can’t just drop the rest of the balls I am juggling. I am learning to delegate my activities and to make sure I don’t let anything slide for too long.

I also would like to start adding some small audio projects to my GitHub account. I need to figure out what will be indicative that I know how to do this without putting anything too valuable up on there. I think the former will be harder to pull off than the latter.