Help! How can I save a sound file from "SoundRecorder1" into my phone

1,369 views
Skip to first unread message

escombralls

unread,
Aug 11, 2016, 5:53:22 PM8/11/16
to MIT App Inventor Forum
Hello everybody, 


I have an issue when trying to save the recorded sound to a file (within SD or internal memory). I have search within this and other forums, but I haven't found any answer...

I describe my isseu: I am using SoundRecorder1 to record some external sound. That works fine, and I can play it with SoundRecorder1.AfterSoundRecorded and getting the sound into the Player.Source. Now I need to save that sound into a file, in order to upload it to an external server (using FTP extension from Taifu).

However, I don't understand where the sound file is saved... I have tried with tinyDB but it seems that the file is not created (at least, the FTP extension AfterUpload "response" is "/storage/sdcard0/sound_FILE: open failed...")

I attach a screenshot of the main blocks I've created to save that file (and upload to FTP)...

I've started with AI2 only some days ago, so I don't know all the functions, so any help would be great!


Best regards,



Screenshot - 11_08_2016 , 23_45_41.png

escombralls

unread,
Aug 11, 2016, 6:17:22 PM8/11/16
to MIT App Inventor Forum
Hi again,


Good news, I've found the audio files location: "SD/My Documents/Recordings" !!! That's a first step, so the app is really saving those files.

However, the filename code is strange to me (see attached screenshot from my mobile).
Is there any way to save those files with another name? Or to know which is the name that AI2 has used, in order to pick later and send it to the FTP server?


Kind regards,
 
Screenshot_2016-08-12-00-12-51.png

Taifun

unread,
Aug 11, 2016, 7:09:29 PM8/11/16
to MIT App Inventor Forum
How to use the Sound Recorder

as you can see, it helps a lot to use Do it...
see also tip 4 here 

Top 5 Tips: How to learn App Inventor

Taifun

Taifun

unread,
Aug 11, 2016, 7:13:02 PM8/11/16
to MIT App Inventor Forum
use your global variable varFILENAME to get the filename


A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook   http://www.appinventor.org/book2 ... the links are at the bottom of the Web page.  The book 'teaches' users how to program with AI2 blocks.
There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro  and the aia files for the projects in the book are here:  http://www.appinventor.org/bookFiles  
How to do a lot of basic things with App Inventor are described here:  http://www.appinventor.org/content/howDoYou/eventHandling  .

Also do the tutorials http://appinventor.mit.edu/explore/ai2/tutorials.html to learn the basics of App Inventor, then try something and follow the
You will not find a tutorial, which does exactly what you are looking for. But doing the tutorials (not only reading a little bit) help you to understand, how things are working. This is important and this is the first step to do.

Taifun

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



escombralls

unread,
Aug 12, 2016, 4:07:27 AM8/12/16
to MIT App Inventor Forum
Thanks Taifun for your awesome answer !! I will try it this morning, 
I didn't know the "do it" functionality, it's perfect to test the blocks process!
I'll keep you updated.

escombralls

escombralls

unread,
Aug 12, 2016, 4:48:33 PM8/12/16
to MIT App Inventor Forum
Hello again,

I confirm that the solution of getting the filename with the global variable works perfectly!!
The sound file has been recorder in: "/storage/sdcard0/My Documents/Recordings".
I can now send it directly to my ftp server, great!

Thanks again Taifun for your support!

 
Reply all
Reply to author
Forward
0 new messages