Having problems with advanced sound management

Skip to first unread message


Aug 16, 2019, 3:49:17 AM8/16/19
to MIT App Inventor Forum
Dear forum,

I am trying to create an app that plays specific sound files once a certain location has been detected via GPS.
The sound files can be managed on one screen but the GPS locator is on another screen.

I have problems with the sound management screen. My original idea was to create a lot of sound recorders and players in order to collect the sound files, hovewer I realized that this is not a smart way of programming it as the sound files have to be recorded again once the app was closed.
So I am now trying to write the sound files and save them on the device. This way I can use only one recorder and player saving recources and have the files available on the other scrren. In theory at least.

This is the logic I am following

However, when I click on Play1, I get the error message, that command1.3gp was not found.

Is it because I only simulate the app on my phone?

Thank you for any ideas.

Warm regards


Aug 16, 2019, 5:47:31 AM8/16/19
to MIT App Inventor Forum
try this (note: WRITE permission is needed for the compiled app (APK), not for Companion):

But I would suggest using a wav recorder as the sound quality of the SoundRecorder is really lousy.


Aug 16, 2019, 9:53:25 AM8/16/19
to MIT App Inventor Forum
also it is not a good idea to use the open another screen block together with "Screen1"
see tip 1 here about why and how to switch screens correctly

  1. Use different screens wisely
    Before starting to create another screen, first you should think about is it really necessary? See also Building apps with many screens and SteveJG's post about advantages/disadvantagesbecause in only one screen you also can use vertical arrangements to simulate different screens, just set the arrangements to visible = true/false as needed... See also Martyn_HK's example about how to use Tabs in App Inventor and another example from Cyd

    If you decided to use different screens, then you should switch them correctly, else you will run out of memory after a while...      
    The recommended method of switching screens in App Inventor

  2. App Inventor works best if you use images whose size matches the size you want them to appear on your screen. If you import larger images into your app, your app may run out of system memory. Using Images with App Inventor

    by Italo: First, you need to understand that the file size of an image is not the amount of memory it uses when it's being displayed. The file size is the compressed size, much like a zip or rar file. When viewed, the image needs to be decompressed.
    For example, if your image says its file size is 100 kb, and its dimensions are 1024 x 768, 32 bit color, then that image uses over 3 mb of RAM (not 100 kb!) when you show it on the screen. ((1024 * 768 ) * 32) / 8 = 3,145,728 kb (3 mb)
    Now, this is a mistake most people make when using arrangements as "virtual screens": They set different image components with their images loaded but hidden, instead of having only one image component and changing the picture according to the user's selection or app events, not knowing that apparently the hidden image components are also using the ram, (yes, even though they are invisible!).

  3. Avoid redundancy
    Probably it helps to read chapter 19 - 21 in Dave's book http://www.appinventor.org/book2 to get an idea how to do DRY programming with App Inventor - Don't repeat yourself 

  4. See SteveJG's monster list of tips and tricks

  5. How to overcome the App Inventor project limit of 10 MB

  6. Backup your project frequently

Trying to push the limits of App Inventor! SnippetsTutorials and Extensions from Pura Vida Apps by  Taifun. 


Aug 16, 2019, 10:42:09 AM8/16/19
to mitappinv...@googlegroups.com
Thank you for the sound recorder recommendation.
I tested it on another device and the hint at writing permissions was actually correct. I recieved the following message when trying to record for a second time:


I am running the app in APP companion. 
So it seems there is a file that he tries to overwrite. However, I can not find any sound file with a file browser.
to ensure writing permissions did not solve the problem. The strategy of Body Mind Power to send the sound directly to the player was in an earlier version and it does work but when the app closes the sound is gone and I need it to be available on every startup. Because eventually it will be more than 40 commands.


Aug 16, 2019, 10:56:58 AM8/16/19
to MIT App Inventor Forum
yes, build APK and try

(maybe Companion App is missing permissions)


Aug 16, 2019, 11:13:53 AM8/16/19
to MIT App Inventor Forum
I created an app and installed it on the phone but it resulted in the same 2 error messages.
1. When pressing player the file could not be found
2. When pressing record for a second time it gave a writing error
Maybe somebody has another idea.


Aug 16, 2019, 2:19:10 PM8/16/19
to MIT App Inventor Forum
Here is an example with full path (savedRecording):

open aia, build APK and try ... should work also with Companion and on all Android versions
Reply all
Reply to author
0 new messages