0

I have an application that depends on recording all sounds and analyses it and notify me when it records a specific tone.

So this app consuming battery power as it works all time to detect the sound tone wanted.

I need an idea to prevent this problem please.

Thanks in advance.

1 Answers1

0

It appears that you are not allowing the processor to drop into a quiescent low power state. To allow the processor to conserve power, you need to have the processor idle as much as possible. If you are continuously sampling, this isn't going to happen. My answer here can give you some background.

I suggest you do the following:

  1. Find out what is the minimum fidelity you can use and still identify the tones you want. To say this differently, determine the maximum sampling interval. For example, you may find that you can get by with sampling every quarter second and still identify the tone you want. This will allow the processor to drop into an energy conservation state.
  2. Make sure you are using interrupts and not polling, i.e. use something like usleep(). So to check every .25 sec, you'll use something like while( running ){ sampleTone(); usleep(250000); }.
  3. Check your sound sampling device's capabilities. It may have the ability to do something more sophisticated that will further minimize the number of samples/sec you need. For example, it may allow you to send the samples directly to disk or memory without requiring the CPU to wake up.
Community
  • 1
  • 1
Taylor Kidd
  • 1,463
  • 1
  • 9
  • 11