Thursday, October 15, 2009

Recording Audio on a Mac

There must be a better way. I wanted to find a native "Mac way" to record sound on my Macbook. The only free way I found was to use iMovie:

Take a video using the button, add it to the project, and do Share->Export to Quicktime. Export the sound to .aiff, .au or .wav.

Isn't there a "Sound Recorder" function, or am I still thinking in Windows?

Thursday, September 24, 2009

Speech recognition for language learning

Last week I took a two-day mini course on how to use the Japanese open source spoken language recognition system Julius.

It can do both online and offline speech recognition, even over a network, out of the box. For example, if I say "かわいいね!” into the microphone, the words are printed to the screen. Neat, huh?

However, compatible acoustic models (basically, a mapping of wave signals to linguistic phonemes) only exist for Japanese. Meaning I can't do any English speech recognition with it.

So, what could I, a Japanese language beginner possibly do with such a system?

One idea is to jump on the iPhone development wagon and use it for language learning. Here was the scenario from this evening:

Kenzo heads to the 100 yen store to buy some dish detergent. He goes to the register to pay, placing his 105 yen on the counter. The clerk asks him something in Japanese. Kenzo flails around, says "euhhh... eto....", trying to convey "Je ne comprends pas, je ne parle pas japonais!"

Finally the clerk gives up and hands him his dish detergent and receipt. Kenzo walks out with his merchandise, confused. Repeat, every day he buys something from the store.

So, what did the clerk say? After a number of awkward experiences, Kenzo figures he's being asked if he needs plastic bag or not. But sometimes he says "いいえ” (No), and the guy gives him a bag anyway! What's going on?

If only his iPhone could transcribe what the clerk was saying, so Kenzo could parse out the words in written form. It's always a lot easier written down, right?

Well, here's what the clerk said:

"シールでよろしいですか?” - shiiru de yoroshii desu ka

Meaning "Is a seal ok?", referring to the little sticker they put on items in lieu of a plastic bag.

... Man, why'd I buy this Japanese cell phone with TV when I could've bought an iPhone. Bah.

Tuesday, September 22, 2009

Installing OpenCV on Mac OS X, with Python Bindings

It's my first time developing on OS X, so I thought I'd document the process to get started using vision algorithms on a Mac.

Platform: OS X Version 10.5.8

1. Install XCode from the Mac OS X install CD.

2. Download and install MacPorts, a command-line tool to install software and deal with dependencies for you. (For some reason I received a "Could not find specified message for index 16" error when trying to install the version for Snow Leopard, so I installed the version for Leopard instead.)

Don't forget to run sudo port selfupdate once it's installed.

3. Install OpenCV by running the command sudo port install open cv . This installs OpenCV 1.0, which is fine for me, because that's what the Python bindings (next) are tested on.

4. Download ctypes-opencv source and demo files. Once that's done, navigate to the ctypes-opencv directory and install using sudo python setup.py install

5. Open your ~/.profile (created when installing MacPorts) and add the following line:
export DYLD_FALLBACK_LIBRARY_PATH=/opt/local/lib

Save and close it, then restart your terminal window for the .profile to be loaded.

6. Try one of the ctypes-opencv demos to check if it works: python houghlines.py

Running the camshift demo, using the integrated MacBook iSight webcam:



That's me thinking "Oh, OpenCV installation. Can start my research now?"

Tuesday, March 24, 2009

For Ada Lovelace Day: My Mom, The Cobol Cowboy

In honour of Ada Lovelace day, we're to blog about the unsung heroes in the field of technology; specifically, those wonder women who are our role models, but just don't get enough credit!

Well, Mom, you are really amazing.

Delia L.

My momma graduated at the age of 20 with a Mathematics degree from Ateneo University, Philippines. She was a smart cookie who taught FORTRAN and BASIC to fellow college students as a T.A.

At the youthful age of 24, she moved away from her family, friends, and sunny tropical home to freezing cold Calgary, Alberta, then Regina, Saskatchwan, Canada. She worked as a consultant programmer and systems analyst there. I don't know much about this time in her life, but I bet it was cool seeing all that snow, the downside being... all that snow.

Luckily, in 1981, she got hired at Teledyne in California as a Senior Analyst/Programmer. She managed to wrangle her boyfriend to move across the world to be with her, and they got married. Hi Dad!

And then she had me. I had a lot of fun as a kid. We went to Disneyland like a billion times. Unfazed by my bouts of febrile seizures and chronic bronchitis, she continued to work as a developer for the government as well as at Honda, often as the sole designer, developer and maintainer on programming projects.

At some point she gave birth to my brother. At home. In her bed. (Ouch?) So, now she had to deal with a mischievous boy ironically named Christian and his jealous big sister who got in trouble at school sometimes.

Unfortunately, life as an immigrant in the US is hard. We moved to Canada, the land of open arms, and Mom had *another* kid, giving him a doubly-biblical name of Abel Jacob, probably hoping it would give him twice the changes of being a good boy.

At the same time, she busted her hump at Telus as a Systems Specialist and project lead and made big bucks. Mom really brought home the bacon, so to speak, even though she doesn't eat pork anymore. We had a huge half a million dollar home with a bridge in it. And she still managed to work, part-time or telecommuting, whatever had to be done, to raise us rambunctious kids right.

We went on tons of trips around the world, including to Austria to see the 1999 eclipse, though we didn't appreciate it at the time.

My mom is a 29-year veteran of Cobol, knows UNIX way better than I do, has mad skillz in database systems I've never even heard of, and even programmed in ASSEMBLER for 2 whole years. That is hard core.

She speaks 3 languages fluently. Her English is better than mine (how come you know more vocabulary than me, Mom?) along with perfect Tagalog and Fookien.

We always thought she was a little nuts, constantly getting suckered into Amway and other pyramid schemes, clicks flashing ads on the internets, and wearing green socks with a red skirt. But now that I'm facing the imminent challenge of starting a family and continuing with a career in technology, I can't help but admire her intelligence, courage and determination.

My mom is a super woman.

Edit: She even corrected my spelling mistake. Oops, thanks proof-reader!

Monday, December 29, 2008

Mobile experiment

For the next month, I'm replacing my laptop with this Google "Dream" phone, aka G1, aka gPhone. That's right, the Dell has gone byebye.

In this swaperoo, I'll be testing the limits of this tiny but powerful phone running Android. As the design on the back of my g1 indicates, I'm running the dev version of the G1, meaning that when I find that it cannot perform to the standards of my Dell Inspiron, I can write a program to fix it.

Current shortcomings already include:
1. Android development environment.
Talk about meta. When I think of something to write, I'd like to code it up right away. On my phone. It's been suggested that a full compiler would be too cpu intensive. A workaround could include an web interface to code and compile online.
2. A way to upload photos from a better camera. My laptop used to serve as my portal for uploading photos from my Canon Rebel or Elph. Still have to figure out a workaround - perhaps a double-ended mini-usb cable to plug from camera to phone? I wonder if Picasa could then get an auto-resizer to work on my g1. (Yoohoo, Picasa folks!)
3. Blogging. Woo, I've already overcome this hurdle. I'm using the Blogger email feature which supports attaching photos, and saving as a draft while offline. (At first I thought an app interface would be useful, but gmail comes to the rescue once again!)

Which brings me to my other point. Without a data plan, I'm limited to finding wifi spots for most mobile apps to work.

4. Android market offline apps. Just how many apps can I install, then amuse myself with on a bus while offline? 

This baby will also be put to the true test of mobile: backpacking. Travelling in a foreign country where I don't speak the language will surely generate more need-based apps.

Speaking of which, I could never get the Wordmate stardict app to work...

Thursday, December 25, 2008

Posting from my gPhone

Testing mobile blogging. Happy holidays from Santa Monica, CA!

Wednesday, November 05, 2008

Elections 2008

So, I'm American. And I have a camera. And I have no shame.

Today was my first presidential election, and I was gonna document it. For those of you who wonder how elections work, here you go!

Step 1. Go to your local church.



Step 2. Say hi to the friendly campaigners 102ft from the voting station.







Step 3. Do a little dance because you came at 1:30pm, after the lunch rush. No lineup!


Step 4. Wander up to a random expectant-looking person, cross your fingers that you're registered, and sign your name.




Step 5. Gather your materials: one scantron-looking voting ballot.

Step 6. Head to polling station and insert ballot into voting device.

Step 7. Flip open the voting booklet, and choose a presidential duo by marking the hole with a black dot.



Step 8. Vote No on Prop 8.



Step 9. Once finished voting on other various items, such as a high speed train from San Fran to LA, take one last picture for good measure. Fold ballot closed.


Step 10. Tear off voting receipt from ballot, and Insert Here, face down. OMG which end first?!



Step 11. Retrieve "I Voted" sticker, valid for a free red, white and blue Krispy Creme, Starbucks, or sex toy of choice!

Step 12. Don't forget your souvenir "What On Earth am I Here For?" Trinitarian water bottle on your way out!



Well, I hope this has been enlightening for you. Go Team America!