DSP help

Discussion in 'Programmer's Corner' started by michaelmadalina, May 13, 2013.

  1. michaelmadalina

    Thread Starter New Member

    Nov 30, 2012
    Hello all,

    I'm working on a project and could use some help, okay a lot of help...

    This is a MATLAB project, which I have limited experience in.

    "You live in a bachelor pad, with the only ambient noise being usually some low frequency hum (could be from a ceiling fan). You want to control the lights in your bedroom using a whistle controller. If you whistle once, the lights can turn on, and if you whistle twice, the lights can go off. You can take this to even greater complexity. You can use a patented whistle to dim the lights (whistle controlled light dimmer).
    The only relevant question is, what distinguishes a whistle from a low frequency background hum? And, how would your *device* operate then?"

    So far i have WAV files of both a whistle and a fan hum, and using audacity i combined the two into a single file.

    The way i was thinking this works is we set up some sort of threshold frequency some how and if that threshold is reached within a specified amount of time the light will turn off or on??

    Any and all help greatly appreciated, TIA!
  2. ActivePower

    Active Member

    Mar 15, 2012
    1. The background hum could be reduced using a highpass filter of appropriate frequency (IIR/FIR). Filter your input sound stream with a set of filter coefficients.

    2. Since you mention MATLAB, you can use the built-in Filter Design toolbox (fdatool) to construct a digital filter after analyzing the sound stream (if you have one) and vary the cutoff accordingly. Then use the 'filter' command to filter your data stream.

    2. If you are analyzing in real-time, you could either capture streams periodically, write them to a file and analyze them for the high-frequency component (whistle) or you could loop endlessly (although that could be taxing).