How to rename the file saved with sound recorder

1,290 views
Skip to first unread message
Assigned to halatmi...@gmail.com by taifu...@gmail.com

Enora Nedelec

unread,
Aug 9, 2015, 11:29:03 AM8/9/15
to MIT App Inventor Forum

Is there a way to change the file name and the folder of the sounds saved with Sound recorder directly within the app?

(It seems that the sound recorder can only save in Mydocument/Recordings/ and that the component "choose" the filename)

Taifun

unread,
Aug 9, 2015, 11:59:08 AM8/9/15
to mitappinv...@googlegroups.com
what about using the new SavedRecording property?

and as you already know, hovering with the mouse over a block gives you some help text...

Taifun

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

Enora Nedelec

unread,
Aug 9, 2015, 12:39:32 PM8/9/15
to mitappinv...@googlegroups.com
Thanks Taifun, I've seen this block but I have some struggle with the kind of format I should use to specify the path. I've tried /myfolder/ and also file:///mnt/sdcard/myfolder but both give an error. 


Also when should I specify the path? Before starting the recording or when I press the "stop" button? (Ideally I would need a new path/folder for each item in my DB)

Taifun

unread,
Aug 9, 2015, 12:49:34 PM8/9/15
to MIT App Inventor Forum
which error do you get? 
try a complete path including filename and extension file:///mnt/sdcard/myFolder/mySound.3gp
I would specify the path before starting the recording...

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

Enora Nedelec

unread,
Aug 9, 2015, 1:00:08 PM8/9/15
to mitappinv...@googlegroups.com

Thanks for your help Taifun!


Here is the error I get: 

cannot start recording: /file:/mnt/sdca/myfolder/..... :open failed
ENOENT (no such file or directory )


But the directory exists (I have other files saved there and retrieve without error by the file component), I just wonder what format for the path should I provide for the sound recorder


Hal Abelson

unread,
Aug 9, 2015, 3:29:00 PM8/9/15
to MIT App Inventor Forum
Taifun:  Thanks for catching this.  I'll fix the documentation.

Enora:
Start by doing a test on your phone.  Set the value of SoundRecorder.SavedRecording to the empty string, record something, and
 look at the value of the "sound" variable in the When SoundRecorder.AfterSoundRecorded event.
For example, when I tried this on my phone, I got the result:

/storage/emulated/0/My Documents/Recordings/app_inventor_1439147856542.3gp

That will give you a hint as to the correct form of the file name.   Now do another recording, but first set the SoundRecorder.SavedRecording property to a file name of the same form.
I used
/storage/emulated/0/My Documents/Recordings/xxx.3gp
and that seemed to work.


I haven't played around enough to see what the exact conditions of file names are. 


Enora Nedelec

unread,
Aug 10, 2015, 12:56:58 AM8/10/15
to MIT App Inventor Forum
 Hal you set me to the right track, thanks! Here is the best way  I found (so far) to save all the audio associated with an item in my DB in a separate folder. 

1) first create the folder by saving an "empty" canvas
2) use the SavedRecording block to change the folder and the name of the audio 
3) start recording, stop recording
4) save the file name and the folder in a variable that will be saved in the Db. 








Reply all
Reply to author
Forward
0 new messages