Noise Pollution App | Sound Meter App MIT App Inventor | Sound Level | Noise Sensor MIT App Inventor
Summary
TLDRIn this tutorial, the instructor guides viewers on creating a 'Noise Pollution' app using MIT App Inventor. The app leverages the phone's microphone as a sound sensor to measure decibel levels and assess noise pollution risks. It features a slider to represent sound intensity and a label to display decibel measurements. The tutorial covers downloading the necessary extension, setting up the app's interface, and coding the logic to update the UI based on sound levels, using color-coded indicators to signify different noise risk levels.
Takeaways
- 🎓 The video is a tutorial on creating a sound sensor app to measure noise levels in decibels and assess the health risks associated with different noise levels.
- 🔍 The app will utilize the sound sensor, essentially the phone's microphone, to measure sound intensity, which is not possible with the standard sound recorder component in MIT App Inventor.
- 📲 An extension is required for the sound sensor functionality, which is downloaded from a provided link and imported into a new MIT App Inventor project named 'noise pollution'.
- ⏱ The sound sensor extension is set to listen for sound every half second, as configured by the interval property.
- 📊 The app's user interface includes a slider, named 'sound level bar', to visually represent the sound level, with a disabled thumb to prevent user editing.
- 📝 A label, 'decibels label', displays the actual decibel measurement, and another label, 'sound description', provides information about the health risk associated with the sound level.
- 🛠️ The app requests audio recording permission upon initialization, which is necessary for microphone access.
- 📈 The app uses A-weighted decibels, a standard for assessing hearing damage and noise pollution, measured by the sound pressure level extension.
- 🌈 The app categorizes sound levels into different risk levels using color coding and descriptions, based on a simplified interpretation of a chart from Electronics Hub.
- 🔧 A custom procedure, 'update screen', is used to dynamically update the slider's position, color, and the sound description label based on the measured decibel level.
- ⚠️ The tutorial advises to disable screen timeout when testing the app to ensure continuous operation of the sound pressure level component.
Q & A
What is the main purpose of the app being discussed in the script?
-The main purpose of the app is to measure noise pollution using a sound sensor and display the sound level in decibels along with health risk information.
Why does the instructor prefer not to use extensions in MIT App Inventor?
-The instructor prefers not to use extensions because they believe that they can take away from the learning experience, as the goal is not just to make apps but to learn to code and prepare for other languages.
What is the sound sensor on a mobile phone?
-The sound sensor on a mobile phone is the microphone, which is used to measure sound intensity with the help of an extension since the sound recorder component alone cannot do this.
What is the interval set for the sound sensor in the app?
-The interval for the sound sensor is set to 500 milliseconds, meaning it will listen for sound every half second.
What is the significance of the slider component in the app?
-The slider component is used to visually represent the level of sound or noise in terms of health risk, with the thumb position indicating the current sound intensity.
What are the three types of sound measurements provided by the sound pressure extension?
-The sound pressure extension provides measurements in decibels, A-weighted decibels, and C-weighted decibels, with A-weighted decibels being used for determining hearing damage and noise pollution.
Why is it necessary to get permission for recording audio when using the app?
-Permission for recording audio is necessary because the sound pressure level extension uses the microphone to measure sound intensity.
How does the app handle the display of the decibel measurement?
-The app rounds off the A-weighted decibel value and displays it along with the unit 'dB(A)' in the decibels label for clarity.
What is the procedure used to update the app's screen based on the sound intensity?
-The procedure called 'update screen' is used to set the slider's thumb position, update the sound description label, and change the color of the slider based on the A-weighted decibel value.
How does the app categorize different sound intensities in terms of health risk?
-The app uses a simplified version of a chart from Electronics Hub, categorizing sound intensities into different risk levels such as no risk, normal sounds, busy traffic, loud radio, airplane or concert, and hearing damage.
What is the maximum value of the slider in the app and why is it set to this value?
-The maximum value of the slider is set to 150, which corresponds to the highest sound intensity level considered safe before reaching the risk of hearing damage.
Why is it important to disable the thumb on the slider?
-The thumb is disabled to prevent users from editing the slider's value, as the app is meant to automatically display the sound intensity level based on the microphone's input.
What is a potential issue to be aware of when testing the app on a device?
-When testing the app, it is important to turn off the screen timeout because the sound pressure level component may stop working when the screen times out.
Outlines
🎙️ Building a Noise Pollution App
This paragraph introduces a tutorial on creating a sound sensor app to measure noise pollution in decibels using MIT App Inventor. The app will utilize a sound sensor extension to gather data from the phone's microphone, a slider to represent sound levels, and a label to display decibel measurements. The focus is on learning to code and preparing for other programming languages. The tutorial begins with downloading and importing a necessary extension, setting up the app's interface, and configuring initial properties.
🛠️ Setting Up the App Interface
The second paragraph details the process of setting up the app's user interface. It involves adding a slider and labels to the screen, configuring their properties such as color, size, and alignment, and disabling user interaction with the slider. The goal is to create a simple yet efficient screen design that will visually represent the sound levels and their potential health risks.
🔊 Implementing Sound Measurement Logic
In this paragraph, the script explains how to implement the logic for measuring sound levels. It involves obtaining microphone permissions, using the sound pressure extension to measure sound intensity in A-weighted decibels, and updating the app's interface based on the sound levels. A procedure called 'update screen' is created to handle the display of sound intensity, color coding, and risk descriptions based on predefined decibel ranges.
📊 Configuring Sound Level Risk Assessment
The final paragraph discusses configuring the app to assess the risk associated with different sound levels. It uses a simplified version of a sound intensity chart to categorize sounds into risk levels and update the app's interface accordingly. The tutorial also includes handling extreme sound levels beyond the slider's maximum value and provides a tip for testing the app to ensure the sound sensor remains active.
Mindmap
Keywords
💡Sound Sensor App
💡Decibels
💡Slider Component
💡Health Risk
💡Noise Pollution
💡Microphone
💡Extension
💡A-Weighted Decibels
💡Procedure
💡Permission
💡Screen Timeout
Highlights
Introduction to creating a sound sensor app to measure decibels and assess noise pollution.
Utilization of the sound sensor to measure sound intensity and the slider component for health risk visualization.
Explanation of the necessity for an extension when native features are unavailable in MIT App Inventor.
The sound sensor on a mobile phone is essentially the microphone, which is used for sound intensity measurement.
Instructions on downloading and importing the sound sensor extension for the project.
Setting up the project 'noise pollution' and configuring the screen properties for the app.
Adding and configuring the sound sensor component from the extension to the project.
Incorporating a slider to represent sound level and its configuration for the app's user interface.
Creating labels to display decibel measurements and sound descriptions for user understanding.
The importance of obtaining microphone permissions for the app to function correctly.
Using A-weighted decibels as a standard for assessing hearing damage and noise pollution.
Implementation of the sound pressure level updated event to dynamically measure and display sound intensity.
Developing a procedure to update the UI based on the sound intensity measured.
Using conditional logic to categorize sound intensity levels and update the app's UI accordingly.
Guidance on testing the app effectively by managing screen timeout settings.
Encouragement for viewers to like, share, and subscribe for more educational content.
Transcripts
foreign
[Applause]
[Music]
soft I will show you how to make a sound
Sensor app in today's class we will use
the sound sensor to measure the sound in
decibels and we will also use the slider
component to show the level of sound or
noise in terms of health risk so in a
way we will be measuring noise pollution
and showing our results using a nice
looking front end
let's begin by downloading an extension
I don't like using extensions that much
as I believe that they take away a large
chunk of The Learning Experience the
goal of my channel is not just to help
you make MIT App Inventor apps but to
make you learn to code and prepare you
for other languages like Java or python
however sometimes extensions become
necessary when a feature isn't available
in MIT App Inventor at all so what is a
sound sensor on a mobile phone yes you
guessed it right it is the microphone we
have the sound recorder component in MIT
App Inventor that is connected to the
microphone still unfortunately we can't
measure sound intensity with it so this
is why we need the extension so let's
download the extension first I will give
this link in the video description
just click here
and it will be downloaded to your
computer now open up MIT App Inventor
and start a new project let's call it
noise pollution
first of all go down until you reach
this part extension and import the
extension and choose the extension file
the AIX file that you downloaded
click on import
once it has been imported we need to add
a component of this extension so just
drag and drop it on to the viewer
so it has been added
and I am going to change this interval
to
500. okay
so this means it will listen every half
a second because this is in milliseconds
for screen One Properties
make a line horizontal Center and align
vertical Center
okay and the background color I'm going
to make it
dark gray
make screen orientation portrait
and change the title
to noise pollution
okay
now drag a slider
from user interface
onto the viewer
rename
sound level bar
change the default
color left to this blue color color
right should stay the same make the
width
95 percent
the max value is
150 the minimum value is 1 this is very
important we have to disable the this
thumb so uncheck thumb enabled because
we don't want the thumb to be shown and
we don't want it to be edited by the
user Changed by the user and the thumb
position is at one okay add a label from
user interface below this slider
rename to
decibels label this will show the actual
measurement of the decibels
make font Bowl font size 22
height is
15 percent
and just remove all the text from it and
the text alignment is Center and the
text color is white
okay now
select it and duplicate this component
this label by pressing Ctrl C Ctrl V for
Windows or command C command V for
MacBook
rename the second one
to
sound description
lbl this means this will show what
this sound means that is is it a risk
for humans or not and we're just going
to change the font size to 18 a bit
smaller okay
a simple but efficient screen design is
done so let's go to the block section
here what I'm going to do is that when
the screen is initialized
we want to get the permission for
recording audio because the sound
pressure level extension uses microphone
and we need permission for microphone
okay
so click on screen one and get its
initialize event and inside it
again go to screen one and get the ask
for permission
procedure and choose audio from here
okay now our sound pressure extension
this one measures sound intensity using
three types of measurements
decibels a weighted decibels and C
weighted decibels so we we will use the
a weighted decibels as a weighting is a
standard for determining hearing damage
and noise pollution okay
whenever the noise surrounding the
mobile phone changes we need to check
for the sound pressure level updated
event okay so just click on this sound
pressure extension
and get this event
inside it we are first going to show the
value of our a weighted decibels inside
our decibel labels but we will also
round It Off
so get the set block
set text block and inside here
I'm going to do actually a join
because I also want to show the unit
first one is the actual number but round
it off
so from mats
get the round block
and here
this is the
getter for
a weighted decibels
okay
and
here we are going to show in a text
block the unit
Okay so tap here and press the space bar
to give a space
and then write d
capital B and then in Brackets because
it's a weighted
so so this is the unit of a weighted
decibels okay
and next we are going to look at the
actual value of the a weighted decibels
and do a comparison and update our
slider accordingly okay this one
and I'm using a chart from Electronics
hub
this one
to decide what is the intensity of sound
which is dangerous okay so you can see
the color codes and we will be not using
the entire chart and we will be
simplifying it a bit okay
so first of all I am going to make a
procedure okay so go to procedures and
get this first one and I'm going to add
three inputs to it so click on this Cog
wheel and drag and drop
three inputs so the first input is the
color
okay
second input
is the value of the actual
sound intensity in decibels a weighted
decibels and text is the description for
r
sound description label and we will be
actually inside an if else block we will
be calling this procedure again and
again and let's call this procedure
update screen
what will this procedure do first of all
it will set the sliders thumb position
to the to the value
it will
set the description
so
this one
to the text
okay
and
it will
set the sliders I can actually duplicate
this one
and change this to
color left
and this is the color okay so these are
the three three things that need to be
updated depending upon the actual value
of the a weighted decibels okay and we
have put this inside a procedure so that
we just send the three values to our
procedure
and it will update it accordingly okay
so now I need to add some if else blocks
here whenever the sound pressure level
is updated so if I go to control I need
the third one
okay let me organize my code click on
cleanup blocks and I need this is one
two three I actually need three more
else if okay so drag and drop
so just one more okay okay you can
remove some extra ones
if you accidentally add them okay
okay so what is the first if
the first if is
when DBA
ited decibels is less than or equal to
30. this means it is very quiet in
similar to a recording studio so we will
call our update screen procedure with
all this input Okay so so I'm going to
first of all from maths get this equal
to block and here I'm going to choose
less than equal to and again from maths
I'm going to get this block this is
30 and here what is this this is a
weighted decibel so I just duplicate
this and put it here so if
DBA a is less than equal to 30 I am
going to call my procedures this update
screen procedure with what with the
color so what is the color I am going to
give it a light blue color so if I could
click on colors and can get this
light blue color to it
so an aqua color and what is the value
the value is the a weighted decibel so I
can duplicate that and what is the text
now
let's click on here and here I'm going
to type in
something that can be understood by a
user that this is no risk
and it is similar to a recording
Studio
okay now again I can duplicate this
condition and choose now instead of less
than equal to 30 I'm going to choose 70
here and I'm going to call
this procedure so just duplicate it and
here I'm going to change the color to
green
and here it is no risk
but
and normal sounds
okay
now
let me clean up my code again let me
take it a bit down because
this is getting up
a bit
jumbled up okay again duplicate
bring it down now it's less than equal
to 85
and I am going to call my procedure
I'm going to change this color
to a bit
dull
green
okay and here I'm going to say no risk
but traffic
busy traffic or
loud radio okay
so again I'm interpreting that chart the
electronic sub chart in my own way you
can you know make it more detailed and
add more information if you want okay
again I'm going to duplicate this
condition
and I'm going to choose one
120 here so change it to 120 now
this is where the risk is starting so if
I duplicate this and bring it here I'm
going to change the color to now or
range
okay and this is a risk
and this is a airplane or concert
now let's again duplicate and this one
is now less than equal to 150 now this
is
the max value of our slider so I'm going
to call
my procedure and make this red and this
is hearing damage okay
and most probably probably if it is so
loud this means that this is an
explosion
okay
so now what comes in else it means that
now the a weighted decibels is a value
that is even greater than 150 so
which is kind of
technically impossible and unrealistic
but still we have to consider that
situation and we're just going to call
this
update screen procedure again and I'm
going to change the color to even a
darker shade of red but instead of
sending it the actual value because
remember a slider's maximum value is
150. so what we're going to do is we are
going to send it the max value of our
slider so if I click on my sound level
bar
I can get its max value and I'm just
going to tell it that okay just fill it
up completely okay
and
a text is that
it is extremely high risk I mean I can't
think of anything which is louder than
an explosion so I'm just going to call
it
extremely
High
risk okay
also please change this to get text
because I just noticed that they were
both get value here so this should be
get text okay
the sound description label okay and
another important thing is that when
you're testing the app using the
companion or by installing it on your
devices make sure that you turn off your
screen timeout because every time the
screen will time out
the sound pressure level component will
stop working so make sure that you
either turn off screen timeout or make
it a long period of time after which it
times out okay so I hope you will have
fun making this cool app and checking
out the sound around you too to see
whether it is a risk or not please like
my video and please share it with your
friends and family and if you haven't
subscribed to my channel kindly do so so
that you don't miss any of the great
projects that I have planned for you
thank you for watching my video have a
good day and goodbye
Посмотреть больше похожих видео
Cara Membuat Tetris sederhana untuk pemula di Mit App inventor GRATIS 2024 | programmer pemula
NEW Bose Quietcomfort VS Quietcomfort 45 | The ONE Reason To Upgrade!
🔥📱 Flutter x Firebase CRUD Masterclass • Create / Read / Update / Delete
Xcode Tutorial - Step by Step for Beginners
【Unityゲーム作成講座2】アドベンチャーゲームの作り方#12(サウンドシステム①)【ゆっくり解説】
Getting Started with React Native: Install Node.js, Create Your First App, and Pair with Expo Go
5.0 / 5 (0 votes)