Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Is it possible to save audio once recorded?

I see how to start recording via the microphone and how to do playback, but what about saving the audio? Can I use the filesystem api for that? Or is there a way to save to iTunes?

— asked March 27th 2010 by Alex Grande
  • audio
  • sound
0 Comments

2 Answers

  • This took me a while to figure out (sans documentation). Just change the example code for recording to this:

    file = recording.stop();    
    
    var f = Ti.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'recording.wav');
    if (f.exists()) {f.deleteFile();}
    f.write(file.toBlob);
    

    That will save the recording to your "Documents" directory.

    — answered March 28th 2010 by Mark Burggraf
    permalink
    0 Comments
  • Great toBlob worked for me. Why is this always called a "file" when used in examples? it's not the same as a File object, there no exists() or read() method. Confusing!

    Thanks again.

    — answered May 27th 2011 by Marc Wickens
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.