{"id":5571,"date":"2025-01-01T04:16:00","date_gmt":"2025-01-01T04:16:00","guid":{"rendered":"https:\/\/obsidiansofteducation.com\/?page_id=5571"},"modified":"2025-01-01T04:16:03","modified_gmt":"2025-01-01T04:16:03","slug":"noise-pollution-app-in-mit-app-inventor-mit-app-inventor-sound-sensor","status":"publish","type":"page","link":"http:\/\/obsidiansofteducation.com\/index.php\/noise-pollution-app-in-mit-app-inventor-mit-app-inventor-sound-sensor\/","title":{"rendered":"Noise Pollution App in MIT App Inventor &#8211; MIT App Inventor Sound Sensor"},"content":{"rendered":"\n<p>Hello friends and welcome to Obsidian Soft,<\/p>\n\n\n\n<p>I will show you how to make a sound sensor app in this tutorial. 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.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/snake20game207.png\" alt=\"\" style=\"width:645px;height:auto\"\/><\/figure>\n\n\n\n<p>Let&#8217;s begin by downloading an extension. I don\u2019t like using extensions that much as I believe 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.<\/p>\n\n\n\n<p>However,&nbsp; sometimes extensions become necessary when a feature isn\u2019t 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\u2019t measure sound intensity with it so this is why we need the extension. so, let&#8217;s download the extension first.&nbsp;<\/p>\n\n\n\n<p><a href=\"https:\/\/gldias.github.io\/extensions\/SoundPressureLevel\/SoundPressureLevel.html\" target=\"_blank\" rel=\"noopener\">https:\/\/gldias.github.io\/extensions\/SoundPressureLevel\/SoundPressureLevel.html<\/a><\/p>\n\n\n\n<p>Now open up MIT App Inventor, start a new project, and call it NoisePollution.<\/p>\n\n\n\n<p>Upload the sound pressure extension that you downloaded earlier by going to extensions and importing it from your computer.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"1024\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-26-750x1024.png\" alt=\"\" class=\"wp-image-5577\" style=\"width:560px;height:auto\" srcset=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-26-750x1024.png 750w, http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-26-220x300.png 220w, http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-26-768x1049.png 768w, http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-26.png 820w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\n\n\n\n<p>Now, add a component of this extension by dragging it to the viewer. For its properties, make ListenIntervalMilliseconds equal to 500. This means that it will listen every half a second.<\/p>\n\n\n\n<p>For screen1 properties, make the background black and align horizontal and align vertical both center. Make screen orientation portrait and change the title to Noise Pollution.<\/p>\n\n\n\n<p>Drag a slider from the <strong>User Interface<\/strong>. Rename to soundLvlBar. Make colorLeft dark blue.<\/p>\n\n\n\n<p>Color right should stay default.<\/p>\n\n\n\n<p>Width: 95%<\/p>\n\n\n\n<p>Max value: 150<\/p>\n\n\n\n<p>Min Value: 1<\/p>\n\n\n\n<p>Uncheck thumb enabled as we don\u2019t want the slider to be changed by the user.<\/p>\n\n\n\n<p>And thumb position should be 1.<\/p>\n\n\n\n<p>Add a label from <strong>User Interface<\/strong>. Rename to decibelsLbl. Make font bold, font size 22.&nbsp;<\/p>\n\n\n\n<p>Make the height: 15%,<\/p>\n\n\n\n<p>text alignment: center,&nbsp;<\/p>\n\n\n\n<p>and text color: white.<\/p>\n\n\n\n<p>Duplicate decibelsLbl (Ctrl + C and Ctrl V for Windows OR Command C + Command V for MacOS). Rename to soundDescLbl. Make font size 18.<\/p>\n\n\n\n<p>Our simple but efficient screen design is done.<\/p>\n\n\n\n<p>Let\u2019s go to the blocks section.<\/p>\n\n\n\n<p>We need the microphone permission for using the sound pressure extension so when screen1 is initialized, ask for permission for audio.<\/p>\n\n\n\n<p>Get&nbsp; screen1. Initialize. Inside it, put screen 1.AskFor Permission block and choose Audio.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1022\" height=\"240\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-23.png\" alt=\"\" class=\"wp-image-5573\" srcset=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-23.png 1022w, http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-23-300x70.png 300w, http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-23-768x180.png 768w\" sizes=\"auto, (max-width: 1022px) 100vw, 1022px\" \/><\/figure>\n\n\n\n<p>Now, our sound pressure extension measures sound intensity using three types of measurements: Decibels, aWeightedDecibels, and cWeightedDecibels. We will use aWeightedDecibelsDecibels as A-weighting is the standard for determining hearing damage and noise pollution.<\/p>\n\n\n\n<p>Whenever the noise surrounding the mobile phone changes, we need to check for the sound pressure level updated event to get that event from the sound pressure component. Inside it, we will first show the value of aWeightedDecibels in decibelsLbl but we will also round it off so use a round block from maths.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"189\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-24-1024x189.png\" alt=\"\" class=\"wp-image-5574\" srcset=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-24-1024x189.png 1024w, http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-24-300x56.png 300w, http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-24-768x142.png 768w, http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-24.png 1254w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>And next, we are going to look at the actual value of A-weighted decibels and do a comparison and update our slider accordingly. I am using this chart that I got from <a href=\"https:\/\/www.electronicshub.org\/noise-level-decibels-chart\/\" target=\"_blank\" rel=\"noopener\">https:\/\/www.electronicshub.org\/noise-level-decibels-chart\/<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"622\" height=\"700\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/decibel.png\" alt=\"\" class=\"wp-image-5580\" srcset=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/decibel.png 622w, http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/decibel-267x300.png 267w\" sizes=\"auto, (max-width: 622px) 100vw, 622px\" \/><\/figure>\n\n\n\n<p>First, I am going to make a procedure that takes in three inputs: the actual value for our slider, the color for the slider\u2019s left-hand side, and the description of the sound.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"808\" height=\"252\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-25.png\" alt=\"\" class=\"wp-image-5575\" srcset=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-25.png 808w, http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-25-300x94.png 300w, http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-25-768x240.png 768w\" sizes=\"auto, (max-width: 808px) 100vw, 808px\" \/><\/figure>\n\n\n\n<p>You can add inputs by clicking on cogwheel for the procedure and dragging and dropping.&nbsp;<\/p>\n\n\n\n<p>From controls get the if\/else if\/if i.e. the third type of if block. I am going to add 3 more else ifs by clicking on the cogwheel.<\/p>\n\n\n\n<p>The first condition is when dbA is &lt;= 30. This means it is very quiet and similar to a recording studio so we will call our updateScreen procedure with all this input.&nbsp; Similarly, we will do the remaining.<\/p>\n\n\n\n<p>&lt;=70 No Risk &#8211; Normal sounds<\/p>\n\n\n\n<p>&lt;=85 No Risk &#8211; Loud Radio and busy Traffic<\/p>\n\n\n\n<p>&lt;=120 Risk &#8211; Concert or Airplane (orange color)<\/p>\n\n\n\n<p>&lt;=150 Hearing Damage &#8211; Concert (red&nbsp; color)<\/p>\n\n\n\n<p>And else means greater than 150 so we will put the thumb position manually at max value for the slider and update the color to dark red and soundDescLbl to Extremely High Risk.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"670\" height=\"1024\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-28-670x1024.png\" alt=\"\" class=\"wp-image-5578\" srcset=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-28-670x1024.png 670w, http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-28-196x300.png 196w, http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-28-768x1174.png 768w, http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-28-1005x1536.png 1005w, http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/01\/image-28.png 1047w\" sizes=\"auto, (max-width: 670px) 100vw, 670px\" \/><\/figure>\n\n\n\n<p>So we are done. I hope you will have fun making this cool app and checking out the sound around to see whether it is a risk. The app uses an extension so it will not work on an iPhone. Also, the sound pressure level component stops working if the screen times out for your device so either turn off screen timeout or give it a longer interval, such as 5 minutes.<\/p>\n\n\n\n<p>You can also download aia file for this project.<\/p>\n\n\n\n<p><a href=\"https:\/\/drive.google.com\/file\/d\/1vtpmDBPdFE8mZwn6PvHNOWrj_qMb25yo\/view?usp=share_link\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>NoisePollution Project File<\/strong><\/a><\/p>\n\n\n\n<p>If you like my tutorials, please consider supporting me:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><a href=\"https:\/\/obsidiansoft.gumroad.com\/l\/cxdft\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"372\" height=\"196\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/donate-button-1.png\" alt=\"\" class=\"wp-image-5381\" style=\"width:257px;height:auto\" srcset=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/donate-button-1.png 372w, http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/donate-button-1-300x158.png 300w\" sizes=\"auto, (max-width: 372px) 100vw, 372px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p>And, you can also have a look at the video tutorial here.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-rich is-provider-embed-handler wp-block-embed-embed-handler wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<p class=\"responsive-video-wrap clr\"><iframe loading=\"lazy\" title=\"Noise Pollution App | Sound Meter App MIT App Inventor | Sound Level | Noise Sensor MIT App Inventor\" width=\"1200\" height=\"675\" src=\"https:\/\/www.youtube.com\/embed\/_M40XWcqMH4?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<\/div><\/figure>\n\n\n\n<p>Please like my video and share it with your friends and family. Also, subscribe to my channel and press the bell icon so you don\u2019t miss any of the great projects I have planned for you.&nbsp;<\/p>\n\n\n\n<p><a href=\"https:\/\/www.youtube.com\/c\/obsidiansofteducation\" target=\"_blank\" rel=\"noopener\">https:\/\/www.youtube.com\/c\/obsidiansofteducation<\/a><\/p>\n\n\n\n<p>Please like my Facebook page and Instagram page for more educational resources and tips.<\/p>\n\n\n\n<p><strong>Facebook:<\/strong>&nbsp;<strong><a href=\"https:\/\/www.facebook.com\/ObsidianSoft\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.facebook.com\/ObsidianSoft\/<\/a><\/strong><\/p>\n\n\n\n<p><strong>Instagram:<\/strong>&nbsp;<a href=\"https:\/\/www.instagram.com\/obsidiansoftapps\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>https:\/\/www.instagram.com\/obsidiansoftapps\/<\/strong><\/a><\/p>\n\n\n\n<p><strong>Pinterest:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-rich is-provider-pinterest wp-block-embed-pinterest\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"oceanwp-oembed-wrap clr\"><iframe loading=\"lazy\" title=\"Obsidian Soft\" src=\"https:\/\/assets.pinterest.com\/ext\/embed.html?grid=obsidiansoft&#038;src=oembed\" height=\"900\" width=\"450\" frameborder=\"0\" scrolling=\"no\" ><\/iframe><\/div>\n<\/div><\/figure>\n\n\n\n<p>For links to free educational apps, have a look at the&nbsp;<a href=\"https:\/\/obsidiansofteducation.com\/index.php\/mobile-apps\/\" target=\"_blank\" rel=\"noreferrer noopener\">educational apps page<\/a><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello friends and welcome to Obsidian Soft, I will show you how to make a sound sensor app in this tutorial. 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, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-5571","page","type-page","status-publish","hentry","entry"],"_links":{"self":[{"href":"http:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages\/5571","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/comments?post=5571"}],"version-history":[{"count":1,"href":"http:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages\/5571\/revisions"}],"predecessor-version":[{"id":5588,"href":"http:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages\/5571\/revisions\/5588"}],"wp:attachment":[{"href":"http:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/media?parent=5571"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}