wish: record sound lib

Cor

Active Member
Licensed User
Longtime User
wish: record sound lib

I don't know if it is possible, but if sound is detected above a level

do something?

grCor
 

Cor

Active Member
Licensed User
Longtime User
Just a minute ago i got an update of my phone htc magic to android 2.2.1

My chord program also works on 2.2.1 :)

Tested the voice recognition, works great, now only needed a lib:sign0060:

grCor
 

peacemaker

Expert
Licensed User
Longtime User
Any progress ? :)
Was anyone making such needed lib ?
 

Highwinder

Active Member
Licensed User
Longtime User
Thanks, but...

Thanks for the link, Erel.

However, the library does not provide monitoring of MIC levels.

Still a big hole here. Anyone out there got what it takes to put together a fully-functional Microphone monitoring and recording lib?

:sign0163:
 

Highwinder

Active Member
Licensed User
Longtime User
If you can provide me some Java code/snippet of what you are looking for, I will happily add it to the Library.

Somewhere of google, as I don't know what i should be looking for.

XverhelstX

Unfortuantely, I don't know Java, so all I can do is explain the functionality of what I'd like to see in a B4A lib for Microphone.

To elaborate:

1. It must be able to monitor the levels the microphone is recieving. It must be able to do this without having to be writing to a file (just "listening").

2. It must be able to trigger an event when level variables are met (ie, trigger an event when level goes above or below MIC input level variables).

3. So something like this would be possible (forgive me, I'm a VB guy and still relatively new to B4A, so pardon the syntax butchering):

Microphone1.Listen
Do while Microphone1.Listening
If Microphone1.Level >= 50, then
Microphone1.StartRecording(filenamewhatever)
End If

If Microphone1.Level <= 25 then
Microphone1.StopRecording
Microphone1.StopListening
End If
Loop

Something to this effect (above). Produce such a library, and you'll be everyone's hero, starting with me. This would enable us to write apps that can use sound to trigger events.
 

Highwinder

Active Member
Licensed User
Longtime User
Clue

XverhelstX,

Here's something I found online in terms of a clue for microphone level monitoring:

Hi, I am working on an application that plays sounds when you reach a certain amount of volume on your microphone (the player must blow into the microphone to a certain level).

To listen to the sound, i simply use the following: Ti.Media.startMicrophoneMonitor(); timermicro = setInterval(function(){ avg = Ti.Media.averageMicrophonePower; }, 200);

However, it seems that as soon as i create a sound with the command : Ti.Media.createSound({url:'sounds/mysound.mp3'}); the screen starts to freeze (the application doesn't crash, but it doesn't respond anymore)

If I create the sound first, the screen freezes the same way as soon as I start the microphone monitoring...

I tried to change the AUDIO_SESSION_MODE but it doesn't help with my problem...

Has anyone got an idea ?

----------

Actually, I found a solution by myself. To make it work, you have to record the sound at the same time that you monitor sound.

Hope this will help anyone.


Can you somehow make a "MicMonitor" library based on this information? Or steer me in tghe direction of being able to do what this person describes in this above quote?

Thanks!

Highwinder
 

Highwinder

Active Member
Licensed User
Longtime User
tip

From what I'm seeing, this info might help. It seems that such functionality may require something along the lines of:

getMaxAmplitude ()

and

getAudioSourceMax ()


Would this be of any help?

Thanks,

Highwinder
 

moster67

Expert
Licensed User
Longtime User
What you are asking for seems to be already included in the AudioRecorder-library:

Basic4android - AudioRecorder

From help-file:

AudioMaxAmplitude As Int [read only]

Gets the maximum amplitude.

AudioSourceMax As Int [read only]

Gets the maximum value for audio sources.



see also this post from SO:

java - Current volume level of the Microphone input - Stack Overflow

where it says:

You would have to set a Timer when the audio stream starts capturing and get the level of volume however frequently you wanted using getMaxAmplitude or getAudioSourceMax

To me it seems like you have everything you need or am I wrong?
 
Top