Sunday, January 28, 2007

Hearing aids that don't amplify

One of the great things about having engineers for friends is that they can imagine in tech - a blue sky brainstorming session about filter design makes perfect sense in the right group. So it's David Klempner (UIUC '06) that I've got to thank for the following kick back onto my original SigSys project path, abandoned two years ago.

Simply put: Make hearing aids that don't stink. (Or ones that don't stink for me.)

Since the traditional "why don't we amplify selected frequencies?" method doesn't do much for folks with a hearing profile like mine where the upper ranges are essentially gone (I've heard that mine is the worst kind of hearing loss to make hearing aids for), I'd been trying to come up with ways to interpret a full normal-human-hearing frequency range of sound within my limited frequency range of hearing.

It's like suddenly having the bandwidth of a communications channel halved, but having to transmit the same information. Fortunately, things like the English language are coded with plenty of redundancy, so there's wiggle room that enables me able to understand speech. For more information on this, check out What It Looks Like To Hear Like Mel. Basically, I look like a first-order low pass filter.

The audiograms (graphs) in that post were generated via hearing tests, which mostly involve beeping various frequencies at different volumes into headphones and you indicating which ones you can hear (press a button, raise your hand). It's a sort of primitive way of determining a person's FIR, because as a kid I swore I could hear the little microphone and equipment clicks when they try to test the high frequencies. I couldn't hear the notes, but I heard the tiny pop similar to the one that happens when you turn on a microphone hooked up to a great big speaker (not entirely sure what causes the impulse in the circuit, but the pop is the response of the sound system settling down from it).

Also, the "raise your hand if you hear" is subject to all sorts of experimental problems because people are inconsistent, easily confused, and... ah... cheat. (Hey, I raised my hand when I heard the microphone clicks, because I wanted to be "as hearing as possible.") It would probably be more accurate to measure brain activity (which, as Raymond's first lecture mentioned, also depends on SigSys - the stuff is everywhere). Anyhow, conversation went something like this, with my first chime-in being a laundry list of hearing aid schemas that aren't straight amplification:

David: The obvious thing to try would be outright compressing frequencies downwards; it would make everyone sound weird but you might get more useful information out of it.

Me: A few years back I tried all sorts of funky little things [as alternative hearing aids] - compressing all frequencies down, folding higher frequencies, modulating all frequencies above a certain cutoff downwards...

David:
You were, in fact, both compressing and correcting for the volume and
speed effects, right?

Me: Uh....

So David suggested this:

I'd start with whatever sampling rate your [laptop] hardware supports (presumably there's an LPF there for anti-aliasing purposes), and then compress that down by a factor of two. Or, for that matter, maybe less than two; a 20% compression might give you a noticeable improvement without as much distorting effect. (eg, people's voices still sound human.)


Cool - a starting point for experimentation.

Saturday, January 27, 2007

Worksheets as a math teaching method

Yesterday we did some more things with complex arithmetic, taking a look at how some simple operations result in surprising things. For instance, take 1/j . Multiply both sides of this equation by j/j and you'll get j/j^2, or j/(-1), or -j. So 1/j = -j. Weird, if you're used to conventional real number arithmetic.

Oh. What is j? It is the variable representing the square root of -1. You may know j better as i from your past math courses, but it changed its last name when it immigrated to EEland, since electrical engineers usually reserve i for the variable describing current. It's used in complex numbers, usually written with the variable z, in rectangular form (z = a + bj) or polar form (z = Ae^(j*theta). You can switch between the two by plotting them on a graph and using trig identities. This is a terrible explanatory graphic. All radii (radiuses?) are 1, and the angles are supposed to be pi/4 (45 degrees), 2*pi/3 (120 degrees) and -3*pi/4 (-135 degrees); I'll let you match them up.



Diana handed out some worksheets for us to follow along in class with. There were unsolved equations on one side and blank spots on the other, and we proceeded to go systematically through them in lecture format. I really like this teaching strategy; it gives you a map of where the lecture is going to go, the blanks give you something to participate with while you're filling them in, and afterwards you have a nice record of what you've learned. A few changes I would make, though:

Scrap the lecture and just give us the worksheet. This would probably necessitate the creation of explanatory text around the formulas to deliver the content Diana did in her lecture, but we'd be working in groups at our own pace and free up the professors to wander around like they did in the latter half when we were just chugging on problems. This is how I was taught math in high school, and I absolutely loved it.

Make the worksheet in LaTeX instead of Word. Not a big deal, but the typesetting you get from TeX is typically nicer than MS Equation Editor. It's one of those "it's made already so it's fine, but if I was making a new one..." little things.

For instance...

In other news, I can't do arithmetic any more, and I've forgotten the exponential identities for sine and cosine. I also spent most of the lecture before last (Wednesday) trying to derive the concept of Taylor series from scratch because I'm trying to remember where Euler's identity comes from; it's the same thing that the formulae Ae^(j*theta) = A*sin(theta) + j*A*cos(theta) comes from and we see that ad nauseum in SigSys. I refuse to look it up in the textbook. So far I've been able to derive MacLaurin series, which are Taylor series with a=0, starting from just definitions (...yeah, I went back all the way through calculus and the definition of the derivative; that's why it took the whole lecture). I can feel the rust flaking off my brain.


I wish Blogger did equations. I may switch to Wordpress or something that has a mathML or LaTeX plugin because of it.


For the record, I usually don't listen to lectures; they provide a pleasant background noise while I plug on random problems that catch my fancy. I ought to go to them more often, though; they're a good way for me to make sure I have time set aside for work, and being half-aware of them reassures me that I'm (probably) not missing anything, or that I can ask people about stuff in the lecture afterwards.

I'm not sure whether I would have this severe of a visual learning style if I actually had a functioning auditory pathway, but as it stands it's easier for me to read things than to listen to lectures, which... is, as Eric VanWyk just walked through the lounge and pointed out, probably why I suggested the "scrap lectures and give us worksheets" method above. I do benefit disproportionately from it (mostly because I'm at such a disproportionate disadvantage already in lectures), but from past experience in high school I think it helps hearing people as well. I wonder if there's a way to make textbooks and worksheets better for auditory learners. Hmm.

Wednesday, January 24, 2007

SigSys, piano style

I've seen a variant of this diagram in every SigSys book I've found (a grand total of 3, but... hush).
Basically, signals go into systems, and new signals come out. When they go in on the left side, we usually call them X; the output of a system is usually labeled Y. Y? Dunno. Anyhow, signals can be functions, or they can be discrete or continuous. Discrete functions have values at certain time steps, and that's it; continuous functions have a value at all times.



And then there's this diagram, which you also see a lot. I'm going to be a bad engineer and not label my axes or anything. It's a sketch.
Or in other words, equalizers (this is just a high-pass, you can generalize).




Diana opened class on the first day by playing us music (a signal) and showing us what it sounded like after passing through different filters (systems). First, the signal. (This isn't actually the one Diana played; it's what I had lying around. I don't know what song either is.)

The image quality makes my eyes hurt, but you can click on the picture to see a less-awful version. The green thing on the bottom is called a spectrogram, which is basically "continuous sheet music that's very hard to read." See hackish overlay of notes on top. Both sheet music and spectrograms tell you what frequencies are going at any given time, how long they are going for, and how loud they sound (fortes and accents in the sheet music, bolder colors for louder notes in the spectrograms). Anyway, this is a signal. And now: signals... the filtered versions.



Roughly translated to piano, high pass, low pass, and band pass mean "play the right hand", "play the left hand", and "play only the notes you hit with your thumbs. ("Pass" refers to the frequencies you allow to pass through.)

In reality, it sounds more like this, especially if you have a lower-order filter. They don't actually cut off the frequencies with perfect clean-ness, just more fade 'em out over time. This is why the little diagram of the filters (the red and green picture above) isn't a nice sharp step function, but a sort of funky little curve.


Another cool thing about the sheet music analogy is that the Fourier transform actually makes sense. The transform depends on the orthogonality of sines (which we had to prove in PDEs; I will see if I can dig up my chicken scratch on it) and says that you can split any signal into sine waves - or in other words, frequency components... or in other words, notes. This is a piece of music, but at any moment you can stop and say "hey, look at the keys (frequencies) I'm pressing on the piano" and break the chords down into individual notes. Fourier transforms take a signal in the time domain and transform it to one in the frequency domain, and vice versa. Kind of like saying "Ok, I can look at my music in terms of when I'm playing the notes, or in terms of what notes (frequencies) I play most often."

We also talked about complex arithmetic, which I won't write about now because it's basically "do you remember how to convert between polar and rectangular coordinates?" right now.

What are signals and systems?

It's about signals (streams of data) and what happens to them when they pass through systems (things that transform signals).

This might be more helpful, though.

A list of signals and systems that act upon them

  1. A picture and a photoshop filter.
  2. Music from an electric guitar and the wah pedal that bends the sound on the way to your amp.
  3. The bumps on the road your bike runs over and the dampening effects of the shock absorbers, tires, seats, and tubes that keep your bottom from being rattled sore.
  4. The flame of an erratically sputtering camping stove passing through the thick metal of your dutch oven so that your potatoes experience a slow, steady warmth.
  5. The retinal image you have of an initially dark classroom when someone suddenly flicks the lights on, and the actions taken by your eyes and brain so that you can see again in the blinding, blinding photon flood.
  6. A hungry frog watching for the fast black dot of a fly against the slow, waving background of leaves in the wind.
  7. This is somewhat sketchier: lots of student feedback on the recent occurrences in a course, and the winnowing and distillation process the professor needs to do with this input so they can make long-term corrections to address it.
  8. A piano with broken keys, so that it only plays some of the notes you press down.

Why are you here?

Yeah, I know, I've taken this class already, two years ago.

But I didn't get it then.

And I want to get it now. Behold the power of spiral learning. I'm hoping that another pass will really make things click for me - I've started to see the fuzzy edges of why Signals and Systems is so awesome, but I can't wield its tools with impunity yet.

I'll be posting my notes here. They won't be class notes per se, but random excursions and variations on a theme - my way of jumping off more and exploring around, since I didn't do that the first time through.