istethoscope v2.0
I spent a bit of time over xmas updating my iStethoscope iphone application (which links to The Undercover Scientist book) and adding many of the features requested by users. As usual, for those interested in the gory details, I'll explain how it works here.
The core features of the program remain unchanged, although I optimized the code to make it a little more stable. Please see the entry for version 1.1 and versio n 1.0 for details of how the audio processing works.
In version 2.0 I've added several major new features. The first and most significant is a shake-activated phonocardiogram. This appears if you give your iphone a left-right shake (that's a sharp movement in the x-axis accelerometer). It then replays the last 8 seconds of audio in a loop, while displaying the wave form and animating a grey bar to show which part is currently being played. The waveform is automatically scaled to fit, so eight seconds of quiet sounds will show a nice wobbly waveform, but a single loud noise may cause such a big spike that the rest of the pattern is scaled to nothing. To stop this happening when you've been listening to your heart and then remove the device causing a loud noise, the scaling ignores the last second of audio. So for best results when viewing the waveform corresponding to your heartbeat, hold the mic in place for 8 or more seconds when you can hear a clear sound, then remove and shake within one second. The phonocardiogram is cancelled with a second shake, and recording of audio begins again. Inevitably the resolution and sampling of the waveform is not perfect (there is only room to display 920 spikes out of 352800) so the display should be regarded as an approximation. Not all information can be shown, so the absence of a spike on the display does not mean there is none there. (The animation uses Layers - the waveform is written once into a bitmap called a layer and then that bitmap is redrawn over the new grey rectangle.)
Note that there's an iphone bug which affects all apps - if the iphone goes into standby for more than a minute while the program is running, the accelerometer is switched off. If you find the program does not respond to movements, restart the program and it should work again.
Another major new feature is a new mode: "Accelerometer." I added this mainly for ipod touch users who have no microphone and so can't use the other modes of the program. In "Accelerometer" mode, front-back vibrations (z-axis forces) are mapped to audio tones. A small movement gives a low tone, a bigger movement gives a higher tone. Sensitivity automatically changes according to the average movements, so several seconds of small movements will result in the iphone becoming more sensitive. This mode is more for fun than anything serious - there are too many interfering subsonic vibrations everywhere for you to detect your heart reliably in this mode. Because it uses the accelerometer to make noises, the shake-activated phonocardiogram is deactivated in this mode (the shaking iphone symbol disappears in the corner to tell you this).
The final change to the program is the addition of help images on the first screen (press the undercover scientist) and more hints in the pop up window about making the most from the program. I've done another youtube video below, enjoy! If you need help, leave a comment here and I'll post a reply.
Sam LEFAY (August 7, 2009 7:12 PM):
Peter Bentley (February 8, 2009 5:11 PM):