noiseAlert app isn't working on my phone - android

I want to do some app that will take level of noise, i try to use this example
NoiseAlert, there are sources and apk. I run that app but there are not any changes in nosemeter. What may it be ? I use LG optimus one 2.3.3

The only class you need is the SoundMeter class that records sound. You use getAmplitude() to know the current external noise. Get the amplitude every 500 ms. Print this values in LogCat.
Then put on some music at a loud volume and see if the amplitude values jump. If it does not it could be a device specific problem

Related

Android microphone sensitivity change after phone call

My application is measuring volume of captured audio as a function of samples absolute amplitude.
I've noticed and unexpected behavior in android.media.AudioRecord of Android SDK. Let's assume following flow:
Application is launched
Audio volume is being measured
Phone call is answered/dialed
Audio volume is being measured
The noise around the microphone is produced by TV with constant volume setting. Values measured for point 2 are in range [55-65] and values measured for point 4 are in range [15-25] (please see the audio visualization for 2. and 4. below).
I understand that there must be some volume adjustment going on when phone call occurs. Is it possible to monitor those adjustments or to get rid of them?
I've tried AutomaticGainControl but it is not supported on my Nexus 5 and I do not want to use it since the target devices might not support it as well.
Update
This volume adjustment is happening not only after phone call. I've just noticed the same behavior when phone was just lying on the table measuring volume.
In regard to resources that your app is sharing with other apps (the microphone in this matter) - you should always treat them carefully and assume there configuration may change during a phone call or other usage like switching to another app that's using the microphone.
Instead of trying to monitor for changes in gain , which may require root or other elevated privileges - I would take another approach and do the following:
Save the mic sensitivity level to a configuration file (shared_prefs) in your recording activity when the user is recording . do the same if the user changes it of course during usage of your app.
In the onResume proc of your recording activity - load the mic sensitivity level value and set it before continuing to record (How to adjust microphone sensitivity while recording audio in android - Solved)
If there is a phone call that throws your app to the background and takes control of the mic, once it's finished - your app will return to the foreground and retain the mic sensitivity level for further recording.
Hope this helps.

Recognizing a non-word sound on android

Background:
I started working out at the gym.
Currently, I'm working only on triceps.
I determine to myself some sets that I have to do every time I'm at the gym.
As you might know, the fitness appliance that works on triceps look like some iron rods connected to weights that I have to lift up.
So, I thought that I'll log it in my Android phone,
So I'll really know what I did and what I didn't.
So, I would have to create an .Xml file which record what I really did. But if I'll put the number manually, I'll lose all the point, So...
Question:
I need, somehow, to recognize the weights-unhand sound. When I unhand from the rod, the weight falling and making some sound (I guess you know the sound, like a small Boom).
Is there any way to recognize it?
You cannot expect the algorithm here, anyway I can help you get started.
Similar question here
You can start by recording your "small boom" sound. You can run FFT on these clips and extract the magnitude of the same. You can store this value as a hash and compare it with the live sound.
for additional details check here, here and here

How to detect blow in android device microphone

How can I detect when the user blows into the device microphone? This would then be used to trigger some action by the app.
The job of detecting when a user blows into the microphone is separable into two parts: (1) taking input from the microphone and (2) listening for a blowing sound.
The noise/sound of someone blowing into the mic is made up of low-frequency sounds. We’ll use a low pass filter to reduce the high frequency sounds coming in on the mic; when the level of the filtered signal spikes we’ll know someone’s blowing into the mic.
Source:
http://mobileorchard.com/tutorial-detecting-when-a-user-blows-into-the-mic/
EDIT
And here is some small SoundMeter class for Android:
http://code.google.com/p/android-labs/source/browse/trunk/NoiseAlert/src/com/google/android/noisealert/SoundMeter.java?r=2
I would make and FFT and compare the spectrum with that of more sensible sounds. The blow will likely resemble white noise. Before seeing the spectrums of blow, speech and white noise, I have no idea how to tell one from another.

Android fine volume control

I want to fine tune the volume of the current media file playing.
So there are two applications here, the mediaplayer application, that could be the default Music application, and my application, where I want to tune the volume.
What I do now is to use setStreamVolume, but the index only goes from the max volume to 0, and that's 15 levels only (at least in the emulator).
What I want is to fine tune it in for example, 100 or 200 levels.
Is that possible?
Thanks!
I just searched around for a bit and it seems like this isn't possible using the android API.
I think Fine Volume Control is what you want. It provides 100 levels of adjustment. You can get it in market

Microphone input

I'm trying to build a gadget that detects pistol shots using Android. It's a part of a training aid for pistol shooters that tells how the shots are distributed in time and I use a HTC Tattoo for testing.
I use the MediaRecorder and its getMaxAmplitude method to get the highest amplitude during the last 1/100 s but it does not work as expected; speech gives me values from getMaxAmplitude in the range from 0 to about 25000 while the pistol shots (or shouting!) only reaches about 15000. With a sampling frequency of 8kHz there should be some samples with considerably high level.
Anyone who knows how these things work? Are there filters that are applied before registering the max amplitude. If so, is it hardware or software?
Thanks,
/George
It seems there's an AGC (Automatic Gain Control) filter in place. You should also be able to identify the shot by its frequency characteristics. I would expect it to show up across most of the audible spectrum, but get a spectrum analyzer (there are a few on the app market, like SpectralView) and try identifying the event by its frequency "signature" and amplitude. If you clap your hands what do you get for max amplitude? You could also try covering the phone with something to muffle the sound like a few layers of cloth
It seems like AGC is in the media recorder. When I use AudioRecord I can detect shots using the amplitude even though it sometimes reacts on sounds other than shots. This is not a problem since the shooter usually doesn't make any other noise while shooting.
But I will do some FFT too to get it perfect :-)
Sounds like you figured out your agc problem. One further suggestion: I'm not sure the FFT is the right tool for the job. You might have better detection and lower CPU use with a sliding power estimator.
e.g.
signal => square => moving average => peak detection
All of the above can be implemented very efficiently using fixed point math, which fits well with mobile android platforms.
You can find more info by searching for "Parseval's Theorem" and "CIC filter" (cascaded integrator comb)
Sorry for the late response; I didn't see this question until I started searching for a different problem...
I have started an application to do what I think you're attempting. It's an audio-based lap timer (button to start/stop recording, and loud audio noises for lap setting). It' not finished, but might provide you with a decent base to get started.
Right now, it allows you to monitor the signal volume coming from the mic, and set the ambient noise amount. It's also using the new BSD license, so feel free to check out the code here: http://code.google.com/p/audio-timer/. It's set up to use the 1.5 API to include as many devices as possible.
It's not finished, in that it has two main issues:
The audio capture doesn't currently work for emulated devices because of the unsupported frequency requested
The timer functionality doesn't work yet - was focusing on getting the audio capture first.
I'm looking into the frequency support, but Android doesn't seem to have a way to find out which frequencies are supported without trial and error per-device.
I also have on my local dev machine some extra code to create a layout for the listview items to display "lap" information. Got sidetracked by the frequency problem though. But since the display and audio capture are pretty much done, using the system time to fill in the display values for timing information should be relatively straightforward, and then it shouldn't be too difficult to add the ability to export the data table to a CSV on the SD card.
Let me know if you want to join this project, or if you have any questions.

Categories

Resources