2017년 5월 21일 일요일

Proposal - SoundMeter component (Used to detect the sound level from the mic)


I have created a SoundMeter component which is used to detects the sound from the mic and returns the sound level in real time.

I have created a demo app as an example to show the SoundMeter component can do (Click here to Download SoundMeter.APK)
Here's a screen shot from the app


What I have found work best is if you plug in a mic to you android device is tends to filter a lot of the background noise out which gives a better and more accurate reading.

Below is a link to a document explaining more about how the component work.

The SoundMeter component will on my appspot by Sunday 15th December.
(Please note I have also developed a filemanager  component which will also be available on the appspot on the above date)

I would really appriciate some feedback on the component?
Please leave comments on the above document. 

--
Great. Looks like my LiveChart detecting accelerometer events here: http://www.youtube.com/watch?v=2wkU3GZVDMU


--
The graph I've used to plot the sound level is just a canvas component with a line drawn on, it's not actually of the SoundMeter component. 

I really like the LiveChart component you have created look really nice.

--
Great work on SoundMeter component. How can I get some sample of AI proyect with the SoundMeter component wotking.

--
This is on my own version of AI at the moment which I am still developing so is not ready for public release. If you want to try something similar Hossien has also added this type of component into AiLiveComplete. I thing he has called the component soundSensor

Here is the link to AiLiveComplete

--
I also built a very quick-and-dirty sound level reading. This should at least point you in the right direction if you want to try to implement it yourself.
warning: I did this super-sloppy in about an hour. NO WARRANTEE! :) https://github.com/marksherman/appinventor-sources/tree/soundmeter

--
I download the latest AI2 (Ai2Offline_07Jun14.zip) and did not have the SoundSensor. 

Mark, I download the all the zip files from github, so I must copy them all to AI2 to get it working? 
Do you have a the full version of AI2 ?

Anyway thanks for you support, i continue investigation this issue.

--
My branch on github represents a complete working version of AI2 with my modification. Only one file was modified, so if you pull my branch into an existing local copy with git it will apply the changes and you can compile and run your instance with them.
How to use these features of git, I'm afraid, is outside the scope do this forum. Luckily GitHub does a great walk through and there are seemingly infinite resources all over the internet.
--
Thank you Mark, I have to study how github is working. Anyway, could you tell me, which file do you have modified to get the quick-and-dirty sound level reading. Thanks-

--
can i get yours AI with sound meter ?
how can we using that from zero

im nebie here

--
Sorry I haven't release my version of  AI with the SoundMeter. There is an Alpha version I will be releasing soon with this in. Please not as it's still in development you won't be able to build a final APK. 

If you're new to AI I would recommend use the standard MIT AI version first before using any other version of AI

--
hope you give me some  announcement when you release ... 

i realy waithing for that sound meter and other tools

--
If you want to be kept up todate on what I am doing and when I will be releasing Mad Robot AI please go to th efollowing link and subscribe to the news updates on my progress http://madrobots.wix.com/themadrobot#!contact-me/c232u 

--
Hi Sir Gareth. I'm a newbie in AI. I'm searching for a program that requires to sense audio on my phone, that's when I found this. I'm using MIT AI 2. I opened your app and it was great! same concept that I was looking for. I opened the documents and seems to confused. I can't seem to find the component that you are using as a audio sensor. Thank you.

--
The soundmeter component I created never got into the official version of MIT AI2 but you can find it available in my extended version of app inventor. You will find a link to it on my website www.themadrobot.talktalk.net there is also documentation on the site explaining how to use the component.

--
Hi Sir Gareth. I can't seem to find the MrAI Companion on the app store. Can you please send me the link? How can I test this on my phone? Thanks.
Is it possible for MIT AI 2 to build a sound meter by using its component? Thank you.

I can't seem to find the MrAI Companion on the app store. Sir, can you please send me the link? How can I test this on my phone? Thanks. 

--
here is the link for the companion App you will need

If you do have any question about Mad Robots AI please use the following forum


--
Last question Sir. When will the apk builder option available? Thank you.

--
I was hoping to have the build server available by now but I have been really busy and haven't found the best way to deploy it yet. Until it is deploy you can post you project on my forum (Link below) and I will happily build the APK for you.

This forum is for people extending App inventor. If you have any more questions I am happy to answer them but please post them on the Mad Robots AI  forum

--
I am very interested in your SoundMeter extension. ive tried it out on your AI site.  Do you have the extension posted somewhere for download or sale?  I attempted to upload my work in progress .aia, but it would not allow an upload.  And AI2 wont accept a file with that component to be uploaded into their system.

Please let me know, I know there are a lot of programmers that would love the chance at using your extension.

--
Hi Timothy I'm in a very dilemma and I know its been a while since you asked, but I was wondering if you were ever able to find a solution or the component itself online. I am able to use his extension on his MadRobot AI, but I cant get it on MIT AI2, nor will MadRobot allow me to import the .aia file. Thank You! 

--
try Gareth's sound extension here Re: [App Inventor Open Source Development] Announcing App Inventor Extension Components
or the sound analysis extension from here MIT App Inventor Extensions

--
Thanks Taifun, that wasn't quite what I was looking for. Gareth's sound extension doesn't measure sound Input volume so much as output on the speakers. I need an extension that measures input on the microphone. The sound analysis extension comes in close, but only measures sound pitch, not volume. Mad Robot has an extension that looks like it would be perfect, but there isn't anything for MIT AI2.

--
I haven't touch AI for nearly 2 years but the I soundmeter component I created a few years ago does give the value from the mic. For more info on this you can check out the docs I wrote  when I released the component it MrAI-Help(Component-SoundMeter)

--
I would like to open Screen2 if the pitch reach 1200HZ.
I search every where on the net, but i can't find how tu use Sound analysis.

Could you help me please?

I thank you in advance for your answer.

--
Sorry to contact you there, I'm a teacher.
Some students made some projects with mad robots. They used mr components, because of multitouch.

But they can't build .apk.
Please, I searched a lot without success.

--
Glad you are getting use from mrai. This is a project i worked on over 2years ago and havent done anything on recently. Unfortunately I never released the build server so it is not possible to build apps with mrai sorry.

My plan was to release my components as extensions for the standard MIT app inventor but I never got round to it.  Currently Extension for app inventor only support non visible component so alot of the things i have done won't be able to be created as extensions until support for native libraries and visible component support is added to MIT App Invertor Extensions. If this support is every added I promise to compile my components at extensions.

--
Thanks a lot for your kind answer.
Well, we will live without the APK, at least for the moment.

You are the only person to have made some mutitouch components.
And the trick to use AppToMarket with level 11 seems to not work anymore. I tried and tried without success.

So no multitouch in APK for the moment.
I'm curious why AI didn't change their server to support multitouch ? Maybe for compatibility reasons...

Thanks a lot for you work, at least, the students can work with multitouch in the companion.

--
I am working with my students of 3ºESO in Spain in something similar. Did you manage to find anyrhging like this in aia format?

--
I gave up, because my students are young, and I need something easy to use.
It would be great if AppInventor would switch to multitouch, but it's not the case.
And I didn't found another AI-like website to do it.

If you ever find something, please I'm very interested.

--
I haven't been following this thread to understand  what you want multiouch for.  But in many cases you can create a component using the App Inventor extension capability, that provides multitouch features.
See the scale detector implemented here:

--
My young students (from 11 to 15 years old) wanted to be able to touch for example several ImageSprite in the same time and be able to run several block in parallel.
For example, the game Pong needs two players to use their bats in the same time.

Maybe I could /need to create an ImageSprite in order to be able to touch on the screen several ones in the same time ?

--
If I were doing this, I'd first try to do it without multitouch.  It might be good enough to just register the sprite touches separately.

Multitouch seems most useful in situations that really need to have simultaneous touches, such as in processing  pinch gestures and rotation gestures.​ If you really decide to go that way, see the scale gesture recognizer in the paper I sent, and also this example:


--
The reason I originally added the Multi touch functionality to my canvas component was so it would allow the user to make games that needed multi touch for there interface such as air hockey where 2 users each control 2 separate paddles (Image sprites) simultaneously on the same canvas to hit an image sprite of a  puck back and forth.

I used the multi touch function myself to make a simple drawing app that I could draw patterns with more than 1 finger at the same time(I think I demonstrated this on one of the opensource hangout a few years ago when I wrote my canvas component).

--
Thanks for your help.
In fact, my young student are programming small games and some of them wants to make games that are played by two players in the same time, like "Pong" and other ones.

They are young (11 to 15 years old) and need the AI Companion to be able to test heavily their work.

Then, the work of Gareth, Mad Robots (AI fork with multitouch components), was the solution : multitouch canevas !
But we need to get .apk of the final work. And then we are stuck because "Mad Robots" doesn't have à server to create .apk.

I'm sure that having this multitouch Canvas and ImageSprites would help lot of persons !
My young student love AI2 !

--
May I suggest a work around?

Modify the game play so that the player paddle only moves to the place where a Canvas Touch Up occurred,
with the choice of player determined by which half of the Canvas was touched (by Y value.)

The Player is forced to relinquish control of the Canvas to move his paddle this way.

You can dress up the paddle move by using a Ball for the paddle, initiating a Clock-driven shrink, transport, and grow in the new location.  Call the game Worm Hole Pong.

Ball bounce angle calculation can be added later.
(Ask if you need a sample.)

--
Good idea, this way, a player must release the the paddle before the other one can use it.
Effectively, it's a very good solution.

But generally, it would be good to have components in canevas so that we can use multitouch to use multiple components in the same time.
AppInventor 2 has yet some time, it should evolve...
Gareth made it in Mad Robots that use AI2, but could not put the server in the mean time to build apk...

For the moment, I will give your solution to my students when it can apply.

There in an "internal war" between my colleagues and I, they all want to make students use scratch.
But AI2 is a lot better for me because we can use tablets and phones, control processes with bluetooth, like driving robots with arduino, and a lot more.
I would help me a lot to have AI2 give multitouch control on multiple components.

--
In case you need it for your class, enclosed is a proof of concept that Pong can be done two player without multi-touch.
And yes, multi-touch would be nice.
--

Sound Meter


https://www.youtube.com/watch?v=zQBjnQvXQBI










Sound Meter is in the 4th set of the Smart Tools collection.

Have you ever suffered from the noise of the neighbors?
SPL(sound pressure level) meter app uses your embedded microphone to measure noise volume in decibels(db), and shows a reference.

REMEMBER! Most smartphone microphones are aligned to human voice (300-3400Hz, 40-60dB). Voice calls do not require high-performance microphones.
Therefore the maximum value is LIMITED by manufacturers, and very loud sound(100+ dB) cannot be recognized. Moto G4 (max.94), Galaxy S6 (85dB), Nexus 5 (82dB), HTC Desire(82dB)...

See 6-7th images. I calibrated major android devices with an actual sound meter (dBA). You can trust the result in routine-noise levels (40-70dB). Please use it as an auxiliary tool.

* Main features:
- Upside down mode
- Level notification
- Line-chart duration
- Material design

* Pro version added features:
- No ads
- Vibrometer
- Statistic menu (line chart)
- CSV file exporting

* Do you want more tools?
download [Sound Meter Pro] and [Smart Tools] package.

For more information, watch YouTube and visit the blog. Thank you.

MrAI-Help(Component-SoundMeter)




Help Reference for

mrSoundMeter Component


About the mrSoundMeter component

The mrSoundMeter component is non visible component  which can be found in the “Sensor” component group on the left hand side of the designer screen.


The comnent is used to detect a sounds picked up from the microphone and returns this a the sound level value. The mic actually picks up a sound level as Amplitude between 0-3auto7 but this isn’t really that user friend so you can set a customize the maximum value which the sound level value is based on meaning that if you want to show the sound as a % the maximum sound level could be set to 100.

Program Block index

Key = Events         Properties         Functions

Slider Appearance



Program Blocks
Sound level Max from mic
Allow you to customize the sound level value returned.

Parameters
The mic actually picks up a sound level as Amplitude between 0-32767. With this property you can customize the max value so that when the soundlevel is returned it is based in the range of 0 to the Max Sound Level set.

Examples
  • If you wanted the volume to be return as a % then Max Sound Level = 100
  • If you wanted to use the sound level to change the RGB color then Max Sound Level = 255


Sound Level from Mic
Return the current sound level value picked up from the mic.
Parameters
Value is based on the Sound Level Max from mic


ConvertSoundLevelTodB(soundLevel)
Return a sound level value to Decibels (dB)



ConvertSoundLevelToAmp(soundLevel)
Return a sound level value to Amplitude



Mic ON
Turn on the mic so the current sound level can be detected




Mic OFF
Turn off the mic to stop detecting sound


Is Mic ON
Returns if the mic is currently listening
Parameters
True - Mic is on
False - Mic is off


MicIsOn(soundLevelFromMic)
Event that will fire every 100 milliseconds while the mic is on
Parameters
soundLevelFromMic
Returns the current sound level