John Harding - Insert Catchy Title Here

Insert witty phrase/saying here.

Saturday, August 09, 2014

Unplanned upgrade of my Y6 frame

I'm going a bit out of order here, as I still haven't written up the build for either my MultiWii Quad or original build of the 3DR Y6.  But this one is more interesting.

I'd flown my Y6 a good number of times, even several in quite windy conditions at Emerald Isle, NC.  Had never had any problems with lack of control or anything.  Last weekend, I finally got around to adding LED strips to the legs to help with orientation, including a 12V regulator (I usually fly with a 4S pack and the LEDs aren't intended for that high voltage).  While I was at it, I hooked up an additional JST connector to my power distribution board to power my gimbal.

After all that, I did a quick test flight in my backyard and everything appeared to be working properly.  So after work, I stopped by the park to try a real flight with some space to maneuver.  I was in a bit of a rush, so didn't connect my tablet or wait for GPS lock, just intending to fly around a bit in Stabilize mode.  

I took off and everything was working fine for about 20 seconds or so.  Then it started flying away.  I tried turning it around to head back towards me, but it kept flying in the same direction.  I pretty quickly ran out of space and crashed into a fence.  The carnage was pretty impressive:

  • Broke all 6 props
  • Bent both mounting plates for the gimbal as well as the RC connector (though it still works)
  • APM and GPS sheared off the mounting plates
  • Broke a bunch of the nylon screws for the landing gear and lost a spacer
  • Broke all the standoffs for the GPS/accessory plate
  • Cracked the carbon fiber base plate and it broke in half
They don't appear to sell replacement parts for the 2013 Y6 frame anymore, so I ordered a 2014 frame kit.  Just swapped out the base and top plates, though - pretty sure the legs are the same and there didn't seem to be much interesting with the new APM or accessory mounting plates.

As to what went wrong, I'm still not clear.  I don't have any experience troubleshooting APM logs so will need to figure that out.  My guess is something to do with the compass - in retrospect, it was behaving as if it was in Simple or Super Simple mode, but I don't even have that configured as an option right now.

Update: Replaced the top and bottom plates with new ones from the 2014 frame kit and it's back in the air.

Sunday, August 19, 2012

Digital Music Workflow

I wanted to work through some problems in my music workflow so I figured I'd write up an extended version of a short previous post that had a few notes.  Hopefully this is useful to someone.


My primary goal is to be able to easily access all my music on a variety of different devices - iPhones, Sonos, cloud-based music services, etc.  Second to this is preserving quality as much as possible.  


My digital music comes from a few different sources:


The bulk of my music comes from CD rips - it's the most practical & consistent way to get high-quality source material.  I rip CDs using Exact Audio Copy (EAC) and encode to FLAC - this way, I can get this music into any format I want (mp3, aac, wma) without worrying about loss of quality.  All the CDs end up in a FLAC folder organized as
CD Rips\AlbumArtist\AlbumName\## TrackName.flac
The folder organization is just for convenience - the embedded metadata is what everything keys off of.  There are a few tricky cases with this method of organization:

Various Artists

Compilations get handled one of two ways.  If there is no obvious artist for the album as a whole (e.g. movie soundtracks, Christmas music collections), it goes under "Various Artists" with the FLAC "album artist" field also set to "Various Artists."  When there is an artist for the album (e.g. DJ Mix CDs), it goes under that artist.  In either case, the "artist" field for individual tracks gets set to the artist for that track.

Multi-Disc Albums

Multi-Disc albums get treated as a single album - so all discs go into the same folder and have the same album name (rather than use album names like "The Wall (Disc One)" and "The Wall (Disc Two)."  When doing this, you need to make sure the "discnumber" and "totaldiscs" metadata fields get set accurately.

iTunes Store

Some of our music is purchased from iTunes.  I used to avoid purchasing anything from iTunes when music was encrypted, as it meant it could only be played on Apple devices.  Now that everything is unencrypted, we buy music from iTunes a bit more often - mostly singles.  On disk, I leave this the way iTunes organizes it:
iTunes Media\Music\TrackArtist\AlbumName\## TrackName.m4a
It's a bit annoying that iTunes uses the track artist instead of album artist on the filesystem, but since everything uses the metadata, it doesn't cause problems in practice.

Amazon Music Store

We also have some music from the Amazon music store - mostly singles from before iTunes got rid of DRM.  I manually put this stuff into the same structure as I use for CD rips, since I seem to get a wide range of file naming conventions from Amazon downloads:
Amazon Music\AlbumArtist\AlbumName\## TrackName.mp3
Since I buy so little from Amazon, I haven't bothered to automate any of this.


I've got a few odds and ends from other sources, which go in the same structure as CD rips and Amazon, but with a different root:
Other\AlbumArtist\AlbumName\## TrackName.mp3


I stated the primary goal was to get all this music playable on all my devices. Those basically fall into a few categories:


Since the only way to get music onto iThings is via iTunes, I need to get all this stuff loaded into iTunes.  Music from the iTunes Store, Amazon Music Store, and Other are all pretty easy - just point iTunes at the right folder and you're done.  Since iThings don't support FLAC, though, I had to get the CD rips into a different form for iTunes.  This is the job of the ConvertLibrary tool mentioned in my previous post.  I'll write up a separate post on that, but basically what it does is synchronize a music collection in different formats, resulting in
Converted CDs\AlbumArtist\AlbumName\## TrackName.mp3
I currently sync into mp3 but have been meaning to re-generate my library to AAC, since it's more space-efficient and I've been running out of space on my iThings.


I set up a Sonos system in our house a while back, since we have in-wall speakers in a number of different rooms.  The Sonos needs to play music off the network, so I point it at a NAS (Network Attached Storage) on our home network.  A batch job runs every day that ensures the NAS has a current copy of all the music Source folders from above.  I could point the NAS at the individual folders on my home PC, but it's good to have a copy on the NAS anyway.

Google Play Music and Amazon Cloud Player

I don't really use either of these that much but have been tinkering with them a bit.  I set these up basically the same as iTunes - point them at the folders for each Source.  I have Google Play Music set to use the Converted CDs folder instead of the original FLAC rips, though since Google Play Music limits storage by songs instead of size, I suppose I should use the FLAC folder instead (though they'll convert to 320Kbps mp3). 

To Do

A bunch of stuff still doesn't work quite the way I want.  Most notably, there's no synchronization of playlists across devices.  It looks like Sonos has some support for reading iTunes' playlists out of your iTunes library, but since my Sonos uses a different set of files, I think I'll need to do something else.

Many steps are still manual that should be automated:
  • When I rip a new CD, I have to manually run the ConvertLibrary tool to generate an iTunes-friendly copy; I need to update ConvertLibrary to monitor the folder and run automatically.
  • When any new music is added, I have to manually update the NAS copy for the Sonos (or wait for the batch job to run); similar to the first point, this should monitor the folders for changes.
  • I don't have a good system for getting appropriate album art.  Any recommendations?
  • My NAS uses FAT, which means it can't handle Unicode characters in filenames - either need to restrict character set for filenames or figure something else out.

Saturday, October 29, 2011

Synchronizing music library in multiple formats

Getting a new Sonos player motivated me to clean up some problems in my CD ripping workflow.  First, some background:

I decided a while back to rip all my CDs to FLAC.  The need for specific formats and bitrates are dictated by the device(s) you're trying to use, and with everything in FLAC, I can just re-encode my entire collection to a new format and/or bitrate whenever I want.

I use EAC for ripping.  Works fine.

I wrote my own tool, which I should publish sometime, to handle mirroring a music collection.  Conversion is handled by standard command line tools (e.g. lame) with config scripts that control the rules.  What's been a nagging problem for quite some time is The Compilation Problem.

It's remarkably hard to find good write-ups on the "right" way to handle compilations, so for the sake of future searchers, here you go:

  • Set the artist on individual tracks to be the actual track artist.  So this will be a different artist for every track on a Soundtrack or DJ compilation
  • Set the album artist ("ALBUM ARTIST" tag in FLAC/Vorbis or "TPE2" in id3v2) to something fixed for the album - "Various Artists" in the case of a soundtrack or the name of the DJ for compilation CDs.
  • Ensure you set the "TCMP" tag to 1 in the id3v2 tag - this is what flags the tracks as part of a compilation.  iTunes will then pick these up and merge into one album, using the Album Artist field.

Sunday, June 07, 2009

First android app

I frequently worry that I forgot to close my garage door. When this happens, I can either drive back home just to check, or assume that I closed it and try to move on with my life. While there are much better solutions to this problem, I decided to solve it by writing an Android app.

The app periodically takes a picture using the camera in the phone, and uploads it to a site where the picture can be viewed. At first, this was just a single location on my personal server, but for release, I created a simple Google AppEngine application to receive, list, and display the images.

Please post any thoughts/feedback in the comments. Some things I'll probably add:
  • Configurable # of recent images to be stored
  • Automatic generation of time-lapse video
  • Permissions/protection on the posted images
Other weird stuff:
  • It asks for permission to read the phone state - this is used to get the device's IMEI as a unique identifier. I'm sure there are better solutions, and you can just manually set an identifier in the settings. Problem will go away when I add permissions.
  • Dealing with the camera is a pain in the butt. The emulator camera doesn't behave at all like the real hardware. Currently, I re-initialize the camera after every picture, which is probably bad. Focus is flaky. And sometimes it ends up with a blank image, due to race conditions which I need to fix. Blah blah blah.
  • It's ugly. I know.

Saturday, April 04, 2009

Adult-proofing big wheels

One of my favorite annual San Francisco events is Bring Your Own Big Wheel, a big wheel "race" down a steep, winding road (Vermont St in SF's Potrero Hill neighborhood). Last year, my friend Dave and I rode in the race, and learned some lessons about how badly a stock Big Wheel handles aggressive riding by an adult. Fortunately, some simple modifications and reinforcement can make a dramatic difference.

Mod #1: Remove the pedals
Pedaling a big wheel as an adult is just not effective - you're better off pushing with your feet. In fact, the pedals are most likely just going to smack you in the shins. For the SF course, they're even more of a liability, as the pedals will hit the ground on sharp turns and lift the front wheel up in the air, eliminating what little steering you had.
Instead, I recommend just putting a bolt through the front wheel, with a cap nut on the other end. Unfortunately, I didn't write down the proper length and size, but it shouldn't be hard to find them. I put washers on either side of each prong of the fork, and used loc-tite on the cap nut to make sure it holds together.

Mod #2: Tighter steering
The handlebar setup for big wheels is just not meant for aggressive steering - the plastic buckles easily, and the screw attaching the handlebars to the fork starts tearing up the plastic. The end result looks like this:

In an emergency, you can just wedge something in the gap between fork and handlebar (we used torn strips of cardboard during the race last year), but that's not going to last.

What I ended up doing was picking up a pair of L brackets like these, to effectively stiffen up the fork. Go for thin ones, since there's not a lot of wiggle room between the fork and handlebars. First, attach the L brackets to the fork as shown here.

A few notes on this:
  • It's unlikely you'll be able to remove the fork from the main body of the big wheel with the L brackets on.
  • Depending on where you originally screwed in the handlebars, you can try to re-use the original holes in the fork. Make sure you use shorter screws, though - not the long ones that come with the big wheel.
  • I recommend putting a screw in all four sides.
Then, slide the handlebars on top of the L brackets. Depending on shape and fit, you may have to squeeze the brackets together to fit the handlebars over them. Push the handlebars down as far as you can - down to the heads of the screws holding the brackets to the fork. Use the original, long screws to attach the handlebars to the L brackets, ideally using the original holes in the handlebars. The screws will extend into the opening in the handlebars - my next step is to cut a block of wood to fit this gap, which will hold the screws in place.

The L brackets should pick up most of the pressure for turning the handlebars, such that the handlebar screws are just there to keep the handlebars from sliding up off the bracket. However, I found that putting a second pair of screws in helps it hold a bit tighter. I recommend drilling small pilot holes for the extra screws - 3/32" for use with #10 screws.

Unfortunately, my street isn't really steep enough to stress-test this new setup, so I'll have to wait until next week to see how it holds up.

Saturday, November 08, 2008

Subtitles on AppleTV and iPhone

I've been trying to keep an eye on the various discussions around getting AppleTV and the iPhone to display subtitles - some of the content in the iTunes store has subtitles, but Apple has no published documentation about how to add your own. It's kind of a pain to track, as there are a lot of older articles discussing burning subtitles into the video itself. This has the nice advantage of working directly off the bitmap subtitles ripped from DVDs, but makes it awkward to share a single video file between AppleTV and iPhone. It also means you can't turn them off, and if you use the zoom feature on the iPhone, you've got to be extra careful where you position them.

There are a few mentions of the fact that the subtitle tracks are basically just standard 3GP timed text tracks, but with the 'hdlr' atom handler_type set to 'sbtl' intsead of 'text'. MP4Box has support for 3GP timed text:
mp4box -add subtitle_track.ttxt video.mp4
They use their own file format for the timed text source, but can covert from SRT or SUB.

What's bizarre is that quicktime, AppleTV, and iTunes all behave slightly differently and are more or less sensitive to different aspects.

File Extensiontext vs. stblSet LanguageQuicktimeiPhoneAppleTV
m4vtextNoDisplayed, regardless of subtitle/caption settingIgnoredIgnored
m4vtextlang=enDisplayed, regardless of subtitle/caption setting. Different font than without language set.IgnoredIgnored
mp4sbtlNoIgnoredDisplayed, with subtitle control. Language shows as "undetermined"Ignored
m4vsbtlNoDisplayed, with subtitle control. Text not sized appropriately.Displayed, with subtitle control. Language shows as "undetermined"Not displayed. Can bring up Subtitle menu, but language shows as a second "Off" item, with both checked. Selecting has no effect.
mp4sbtllang=enIgnoredDisplayed, with subtitle control. Language shows as "English"Ignored
m4vsbtllang=enDisplayed, with subtitle control. Text not sized appropriately.Displayed, with subtitle control. Language shows as "English"Displayed, with subtitle control. Language shows as "English"

Quicktime only works with .m4v file extension, does not require a language to be set, and handles 'text' differently than 'sbtl'
AppleTV only works with .m4v file extension, requires a language to be set, and only works with 'sbtl'
iPhone works with both .mp4 and .m4v file extensions, does not require a language to be set, and only works with 'sbtl'

I think what's happening with Quicktime is that it's attempting to use positioning information, of which I haven't specified any. Will look at that next to see if it's possible to make something that plays properly in all 3 cases.

Note: The still frames for the text/m4v files show the caption on the iPhone, even though it doesn't display during playback. I assume this is because iTunes generates the still frame.

The linked post indicates that you need to change the alternate_group in the subtitle's tkhd atom from 0x0000 to 0x0002. My testing did not show any change in handling with or without this modification in Quicktime, AppleTV, iPhone (firmware 2.1), or iPod Touch (firmware 2.1)

I had to force a software update on my AppleTV to get it to handle the files properly, even though I was already on Take 2. The symptom was that holding the "play" button would blank the screen. It worked fine after update.

Things work slightly better if you convert the SRT file to ttxt first:
mp4box -ttxt
It appears that if you just add an SRT file to a video, mp4box makes the text box for the subtitles the same size as the video. So apparently, iPhone and AppleTV ignore the placement, while Quicktime respects it. So what you need to do is:
  • Convert from SRT to ttxt as listed
  • Modify the <TextStreamHeader> element in the resulting ttxt file: width=[width of video] height=[20% of video height] translation_x=0 translation_y=[video height - height]
Quicktime appears to disregard the font size, and instead adjusts the font based on the height of the displayed text area - enough to fit 2 lines of text. This means the amount of text you can fit is basically a function of the width of the text display.

Saturday, August 16, 2008

Tokyo Food Roundup

Kimberly and I have been in Tokyo this week, where I've been visiting with our Tokyo engineering team. We were both a bit apprehensive about the eating situation, as we have somewhat "selective" taste in food (I don't eat vegetables and very little fish, Kimberly doesn't eat mammals). In San Francisco, we're well-served by Yelp, which lets us avoid any bad food experiences, but unfortunately, they don't cover Tokyo. So, I figured I'd review some of our food experiences:

7-eleven has been a staple of our Tokyo eating, especially for breakfast. After careful, scientific experimentation, we've determined that the best combination is 1 Starbucks Espresso Milano coffee drink and 2 halfway-covered-in-chocolate donuts per person. Kimberly was also a big fan of the shrimp rice ball (triangle of rice with a shrimp inside, all wrapped in seaweed), which was versatile enough to cover all mealtimes.
We've checked out some AM-PMs as well, but they just don't compare.

Mochi Cream
Mochi Cream appears to be relatively new (at least their web site is). They display their various flavored-filling mochi balls much like a high-end chocolate shop, and serve them frozen so you have to wait for them to thaw. The outer shell appears to be that of a standard mochi ball, but the inside is filled with flavored creams. Our favorite was the raspberry, though the chocolate banana was also quite tasty. There's one in the east-west passage at Akihabara station, and apparently also Tokyu plaza just west of Shibuya station.
I don't think this would do well in the US though - not nearly enough sugar. Also a bit pricey at 200+ Yen per ball.

Can't find a good link/map for this one, in Shimo-kitazawa. Both the restaurant (an izakaya) and neighborhood are fantastic. Laid back, not as crowded/touristy as the neighborhoods inside the Yamanote line, and just a really great vibe. Head south from the station, and take a right at Mister Donut - should be a wall of shrubs along the right hand side of the narrow street.
The restaurant itself was packed and very lively. In nearly a week and a half in Tokyo, this was the only place we went that had us take off our shoes. They do have an English menu ("eego-menu"), which is always comforting - the fried shrimp from the "favorites" list on the back of the menu was fantastic.

Mister Donut
Speaking of Mister Donut, we checked one out in Shinjuku one evening - very disappointing. Far too chewey - almost a bit stale. We tried a green one, thinking it would be green tea, but ended up convinced that it was a seaweed donut. Blech.

Tokyu Food Show
In the basement underneath Shibuya station is the Tokyu Food Show - envision an entire floor of a deparment store devoted to take-out food. Sadly, it's apparently inappropriate to eat there, so you can't really sample as you go. For some reason, we didn't take pictures, but it's just absolutely overwhelming. There was a dessert place with a name like "Origines Cicao" or something that had a crazy delicious raspberry chocolate cake. Mmm..
One thing that was really impressive was the care they take in packing up your food, particularly the desserts. They put spacers into the box to hold everything in place, and then add disposable freezer packs to keep everything cold.

Beard Papa's
Went to the one at Shibuya station. Meh - tastes about the same as at home, but no flavored fillings and no chocolate covered puffs.

More to come...