Noise Pollution App | Sound Meter App MIT App Inventor | Sound Level | Noise Sensor MIT App Inventor

Obsidian Soft
16 May 202317:19

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

00:00

🎙️ 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.

05:02

🛠️ 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.

10:02

🔊 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.

15:06

📊 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

A 'Sound Sensor App' is a mobile application that utilizes the device's microphone to measure ambient sound levels in decibels. In the context of the video, the app is designed to not only measure sound intensity but also to inform users about the health risks associated with different noise levels. The script describes the process of creating such an app using MIT App Inventor, including the need for an extension to access the microphone for sound intensity measurement.

💡Decibels

Decibels (dB) are a unit of measurement used to express the intensity of sound. The video script discusses using the sound sensor to measure sound in decibels, which is essential for assessing noise pollution levels. The app being developed will display these measurements to users, allowing them to understand the potential health risks associated with the sound levels they are exposed to.

💡Slider Component

In the script, the 'Slider Component' refers to a user interface element that will be used in the app to visually represent the level of sound or noise. The slider will be updated based on the measured decibel levels, providing a clear and interactive way for users to see the current noise level relative to health risk categories.

💡Health Risk

'Health Risk' in the video pertains to the potential dangers that different noise levels pose to human hearing and overall health. The app will categorize noise levels into risk levels, using color coding and descriptions to inform users about the potential harm of the noise they are exposed to, as illustrated by the script's reference to sound levels similar to an 'airplane or concert' indicating a risk.

💡Noise Pollution

Noise pollution is the unwanted or harmful outdoor sound created by human activities, which can have adverse effects on the quality of life and health of people. The video's main theme revolves around creating an app to measure and display noise pollution levels, helping users to be aware of and mitigate the risks associated with high noise environments.

💡Microphone

The 'Microphone' is the hardware component of a mobile device that captures sound. In the context of the video, it is used by the sound sensor extension in the app to measure the intensity of sound. The script mentions that while the sound recorder component in MIT App Inventor is connected to the microphone, it cannot measure sound intensity, necessitating the use of an extension.

💡Extension

In the video script, an 'Extension' refers to additional software that expands the functionality of the MIT App Inventor platform. Since the base platform does not support direct measurement of sound intensity, the creator mentions downloading and importing a specific extension to enable this feature in the app being developed.

💡A-Weighted Decibels

A-Weighted Decibels (dBA) is a measurement of sound intensity that takes into account the human ear's sensitivity to different frequencies. The script emphasizes using dBA for the app because it is a standard for determining hearing damage and noise pollution levels, which is crucial for assessing the health risks of the measured sound.

💡Procedure

In the context of the video, a 'Procedure' refers to a set of blocks of code within the MIT App Inventor that performs a specific task. The script describes creating a procedure called 'update screen' that takes inputs such as color, sound intensity, and description, and updates the app's interface accordingly to reflect the current noise level and its associated risk.

💡Permission

The term 'Permission' in the script refers to the user's consent required by the app to access certain device features, such as the microphone for recording audio. The video explains that when the app initializes, it needs to request and obtain permission to use the microphone, which is essential for the sound sensor functionality.

💡Screen Timeout

In the video, 'Screen Timeout' refers to the setting on a mobile device that causes the screen to go dark after a period of inactivity. The script advises users to disable or extend the screen timeout when testing the app to ensure that the sound pressure level component continues to function without interruption, as the screen going dark could stop the app from measuring sound levels.

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

play00:00

foreign

play00:01

[Applause]

play00:03

[Music]

play00:06

soft I will show you how to make a sound

play00:09

Sensor app in today's class we will use

play00:12

the sound sensor to measure the sound in

play00:14

decibels and we will also use the slider

play00:16

component to show the level of sound or

play00:19

noise in terms of health risk so in a

play00:22

way we will be measuring noise pollution

play00:24

and showing our results using a nice

play00:27

looking front end

play00:29

let's begin by downloading an extension

play00:31

I don't like using extensions that much

play00:34

as I believe that they take away a large

play00:36

chunk of The Learning Experience the

play00:38

goal of my channel is not just to help

play00:40

you make MIT App Inventor apps but to

play00:43

make you learn to code and prepare you

play00:45

for other languages like Java or python

play00:48

however sometimes extensions become

play00:50

necessary when a feature isn't available

play00:52

in MIT App Inventor at all so what is a

play00:56

sound sensor on a mobile phone yes you

play00:59

guessed it right it is the microphone we

play01:02

have the sound recorder component in MIT

play01:05

App Inventor that is connected to the

play01:07

microphone still unfortunately we can't

play01:09

measure sound intensity with it so this

play01:12

is why we need the extension so let's

play01:14

download the extension first I will give

play01:16

this link in the video description

play01:18

just click here

play01:21

and it will be downloaded to your

play01:23

computer now open up MIT App Inventor

play01:26

and start a new project let's call it

play01:30

noise pollution

play01:34

first of all go down until you reach

play01:37

this part extension and import the

play01:39

extension and choose the extension file

play01:43

the AIX file that you downloaded

play01:47

click on import

play01:50

once it has been imported we need to add

play01:53

a component of this extension so just

play01:56

drag and drop it on to the viewer

play01:58

so it has been added

play02:01

and I am going to change this interval

play02:04

to

play02:06

500. okay

play02:09

so this means it will listen every half

play02:12

a second because this is in milliseconds

play02:14

for screen One Properties

play02:17

make a line horizontal Center and align

play02:19

vertical Center

play02:23

okay and the background color I'm going

play02:27

to make it

play02:28

dark gray

play02:31

make screen orientation portrait

play02:35

and change the title

play02:37

to noise pollution

play02:42

okay

play02:44

now drag a slider

play02:48

from user interface

play02:49

onto the viewer

play02:52

rename

play02:53

sound level bar

play02:57

change the default

play02:59

color left to this blue color color

play03:03

right should stay the same make the

play03:05

width

play03:07

95 percent

play03:10

the max value is

play03:12

150 the minimum value is 1 this is very

play03:16

important we have to disable the this

play03:19

thumb so uncheck thumb enabled because

play03:22

we don't want the thumb to be shown and

play03:24

we don't want it to be edited by the

play03:26

user Changed by the user and the thumb

play03:28

position is at one okay add a label from

play03:32

user interface below this slider

play03:37

rename to

play03:43

decibels label this will show the actual

play03:47

measurement of the decibels

play03:51

make font Bowl font size 22

play03:56

height is

play03:58

15 percent

play04:03

and just remove all the text from it and

play04:07

the text alignment is Center and the

play04:10

text color is white

play04:12

okay now

play04:14

select it and duplicate this component

play04:17

this label by pressing Ctrl C Ctrl V for

play04:20

Windows or command C command V for

play04:24

MacBook

play04:25

rename the second one

play04:28

to

play04:29

sound description

play04:33

lbl this means this will show what

play04:37

this sound means that is is it a risk

play04:42

for humans or not and we're just going

play04:45

to change the font size to 18 a bit

play04:48

smaller okay

play04:51

a simple but efficient screen design is

play04:54

done so let's go to the block section

play04:58

here what I'm going to do is that when

play05:02

the screen is initialized

play05:04

we want to get the permission for

play05:06

recording audio because the sound

play05:09

pressure level extension uses microphone

play05:12

and we need permission for microphone

play05:14

okay

play05:15

so click on screen one and get its

play05:18

initialize event and inside it

play05:21

again go to screen one and get the ask

play05:24

for permission

play05:28

procedure and choose audio from here

play05:31

okay now our sound pressure extension

play05:35

this one measures sound intensity using

play05:38

three types of measurements

play05:41

decibels a weighted decibels and C

play05:44

weighted decibels so we we will use the

play05:46

a weighted decibels as a weighting is a

play05:49

standard for determining hearing damage

play05:51

and noise pollution okay

play05:54

whenever the noise surrounding the

play05:57

mobile phone changes we need to check

play05:59

for the sound pressure level updated

play06:01

event okay so just click on this sound

play06:05

pressure extension

play06:07

and get this event

play06:10

inside it we are first going to show the

play06:14

value of our a weighted decibels inside

play06:17

our decibel labels but we will also

play06:20

round It Off

play06:24

so get the set block

play06:27

set text block and inside here

play06:32

I'm going to do actually a join

play06:37

because I also want to show the unit

play06:39

first one is the actual number but round

play06:42

it off

play06:44

so from mats

play06:48

get the round block

play06:51

and here

play06:55

this is the

play06:56

getter for

play06:59

a weighted decibels

play07:02

okay

play07:04

and

play07:05

here we are going to show in a text

play07:07

block the unit

play07:09

Okay so tap here and press the space bar

play07:15

to give a space

play07:16

and then write d

play07:19

capital B and then in Brackets because

play07:22

it's a weighted

play07:24

so so this is the unit of a weighted

play07:27

decibels okay

play07:29

and next we are going to look at the

play07:31

actual value of the a weighted decibels

play07:34

and do a comparison and update our

play07:36

slider accordingly okay this one

play07:40

and I'm using a chart from Electronics

play07:44

hub

play07:46

this one

play07:48

to decide what is the intensity of sound

play07:51

which is dangerous okay so you can see

play07:53

the color codes and we will be not using

play07:56

the entire chart and we will be

play07:59

simplifying it a bit okay

play08:01

so first of all I am going to make a

play08:04

procedure okay so go to procedures and

play08:08

get this first one and I'm going to add

play08:10

three inputs to it so click on this Cog

play08:14

wheel and drag and drop

play08:18

three inputs so the first input is the

play08:21

color

play08:22

okay

play08:23

second input

play08:25

is the value of the actual

play08:29

sound intensity in decibels a weighted

play08:32

decibels and text is the description for

play08:35

r

play08:37

sound description label and we will be

play08:39

actually inside an if else block we will

play08:41

be calling this procedure again and

play08:42

again and let's call this procedure

play08:44

update screen

play08:48

what will this procedure do first of all

play08:50

it will set the sliders thumb position

play08:59

to the to the value

play09:03

it will

play09:05

set the description

play09:08

so

play09:10

this one

play09:13

to the text

play09:16

okay

play09:18

and

play09:20

it will

play09:23

set the sliders I can actually duplicate

play09:26

this one

play09:27

and change this to

play09:30

color left

play09:32

and this is the color okay so these are

play09:36

the three three things that need to be

play09:37

updated depending upon the actual value

play09:41

of the a weighted decibels okay and we

play09:44

have put this inside a procedure so that

play09:47

we just send the three values to our

play09:49

procedure

play09:51

and it will update it accordingly okay

play09:54

so now I need to add some if else blocks

play10:00

here whenever the sound pressure level

play10:02

is updated so if I go to control I need

play10:05

the third one

play10:07

okay let me organize my code click on

play10:11

cleanup blocks and I need this is one

play10:16

two three I actually need three more

play10:19

else if okay so drag and drop

play10:28

so just one more okay okay you can

play10:32

remove some extra ones

play10:34

if you accidentally add them okay

play10:37

okay so what is the first if

play10:41

the first if is

play10:43

when DBA

play10:45

ited decibels is less than or equal to

play10:48

30. this means it is very quiet in

play10:51

similar to a recording studio so we will

play10:54

call our update screen procedure with

play10:57

all this input Okay so so I'm going to

play11:01

first of all from maths get this equal

play11:05

to block and here I'm going to choose

play11:09

less than equal to and again from maths

play11:12

I'm going to get this block this is

play11:15

30 and here what is this this is a

play11:19

weighted decibel so I just duplicate

play11:21

this and put it here so if

play11:24

DBA a is less than equal to 30 I am

play11:28

going to call my procedures this update

play11:31

screen procedure with what with the

play11:33

color so what is the color I am going to

play11:36

give it a light blue color so if I could

play11:38

click on colors and can get this

play11:42

light blue color to it

play11:45

so an aqua color and what is the value

play11:49

the value is the a weighted decibel so I

play11:52

can duplicate that and what is the text

play11:55

now

play11:56

let's click on here and here I'm going

play11:59

to type in

play12:01

something that can be understood by a

play12:04

user that this is no risk

play12:08

and it is similar to a recording

play12:11

Studio

play12:13

okay now again I can duplicate this

play12:18

condition and choose now instead of less

play12:20

than equal to 30 I'm going to choose 70

play12:23

here and I'm going to call

play12:26

this procedure so just duplicate it and

play12:29

here I'm going to change the color to

play12:34

green

play12:36

and here it is no risk

play12:39

but

play12:40

and normal sounds

play12:46

okay

play12:48

now

play12:51

let me clean up my code again let me

play12:55

take it a bit down because

play12:57

this is getting up

play12:59

a bit

play13:00

jumbled up okay again duplicate

play13:04

bring it down now it's less than equal

play13:07

to 85

play13:10

and I am going to call my procedure

play13:14

I'm going to change this color

play13:17

to a bit

play13:18

dull

play13:21

green

play13:23

okay and here I'm going to say no risk

play13:27

but traffic

play13:29

busy traffic or

play13:33

loud radio okay

play13:36

so again I'm interpreting that chart the

play13:39

electronic sub chart in my own way you

play13:41

can you know make it more detailed and

play13:43

add more information if you want okay

play13:45

again I'm going to duplicate this

play13:48

condition

play13:50

and I'm going to choose one

play13:53

120 here so change it to 120 now

play13:59

this is where the risk is starting so if

play14:02

I duplicate this and bring it here I'm

play14:05

going to change the color to now or

play14:07

range

play14:09

okay and this is a risk

play14:13

and this is a airplane or concert

play14:19

now let's again duplicate and this one

play14:24

is now less than equal to 150 now this

play14:28

is

play14:29

the max value of our slider so I'm going

play14:33

to call

play14:35

my procedure and make this red and this

play14:40

is hearing damage okay

play14:46

and most probably probably if it is so

play14:49

loud this means that this is an

play14:51

explosion

play14:53

okay

play14:54

so now what comes in else it means that

play14:58

now the a weighted decibels is a value

play15:01

that is even greater than 150 so

play15:06

which is kind of

play15:08

technically impossible and unrealistic

play15:11

but still we have to consider that

play15:13

situation and we're just going to call

play15:16

this

play15:17

update screen procedure again and I'm

play15:20

going to change the color to even a

play15:22

darker shade of red but instead of

play15:25

sending it the actual value because

play15:27

remember a slider's maximum value is

play15:30

150. so what we're going to do is we are

play15:33

going to send it the max value of our

play15:36

slider so if I click on my sound level

play15:39

bar

play15:40

I can get its max value and I'm just

play15:44

going to tell it that okay just fill it

play15:47

up completely okay

play15:49

and

play15:51

a text is that

play15:54

it is extremely high risk I mean I can't

play15:58

think of anything which is louder than

play16:00

an explosion so I'm just going to call

play16:03

it

play16:04

extremely

play16:06

High

play16:08

risk okay

play16:13

also please change this to get text

play16:17

because I just noticed that they were

play16:19

both get value here so this should be

play16:23

get text okay

play16:25

the sound description label okay and

play16:28

another important thing is that when

play16:31

you're testing the app using the

play16:32

companion or by installing it on your

play16:35

devices make sure that you turn off your

play16:39

screen timeout because every time the

play16:42

screen will time out

play16:44

the sound pressure level component will

play16:47

stop working so make sure that you

play16:50

either turn off screen timeout or make

play16:52

it a long period of time after which it

play16:55

times out okay so I hope you will have

play16:58

fun making this cool app and checking

play16:59

out the sound around you too to see

play17:02

whether it is a risk or not please like

play17:04

my video and please share it with your

play17:06

friends and family and if you haven't

play17:08

subscribed to my channel kindly do so so

play17:10

that you don't miss any of the great

play17:12

projects that I have planned for you

play17:14

thank you for watching my video have a

play17:16

good day and goodbye

Rate This

5.0 / 5 (0 votes)

Связанные теги
Sound SensorApp InventorNoise PollutionHealth RiskDecibelsMicrophoneMobile AppCoding TutorialExtension UseUser InterfaceDIY Project
Вам нужно краткое изложение на английском?