For some extra fun, I added some electronic gadgetry. First of all, when you push the locking book in, it plays the Legend of Zelda "discovered secret" sound (the chimes that play whenever Link solves a puzzle). Then, when you pull open the door, it plays the LoZ "got item" fanfare sound, and a bright light goes on inside the room. This echoes what happens when Link opens a treasure chest. Funnily enough, while most people have no idea what the sounds are, they find them weirdly appropriate. I'm not sure if that is some stored memory, or Nintendo's genius in picking exactly the right sound, or both. Anyway, it's fun to have it there as a geeky in-joke.
So how does it work? The first sound is triggered by the pushing the book in, and the second by the opening of the door. Both use a $7 sound recording module with mic and speaker, and they're powered by 3 AA batteries mounted in a $2 holder.
The sound module was mounted to a board and a big wooden lever triggers the switch on the bookcase. I used the top of a pop bottle to amplify the sound (it makes a huge difference, believe it or not).
The trigger for the second module I designed in SketchUp and 3D printed using a Makerbot Replicator (which I have access to through work). It's basically a little house with a roof and flexible walls that encloses the sound module. When the door opens, it depresses the roof into the switch through an inverted "chimney".
The holes are to allow the sound module to be screwed in place, and the zig-zag sides are to allow compression and springiness. It could of course also be used for the book lock as well, but I kind of like my bulky wooden switch (and it works perfectly), so I left it in place. You can set the switch up in such a way that the sound triggers only when it opens to a certain point.
The creative process of designing something with a 3D printer feels very unusual to someone used to traditional fabrication methods, because you can (almost) completely ignore the "how I am going to make this?" questions, and just design any kind of weird structure you like that will solve the problem you have at hand. I'm not going to pretend for a second that the odd little house is the most elegant solution; it's more a fun little 3D Rube Goldberg-style doodle.