record wave file on android and play on iOS

I want my app to able to record sound file in wav format and able to share that sound file.

I am able to do it on both iOS and Android. However, when I share the sound file from Android to iOS or from iOS to Android, the sound file can not play without any error (just can’t hear any sound). It works on iOS to iOS or Android to Android.

What can I do to fix it?

Hi @boscotwcheung,

You probably can’t do this with a direct “share” of the same recorded file. Android records audio in the 3GP format, which cannot be played back using Corona’s “audio” library, but rather only with the “media” library functions. So, you will basically need to detect the platform and use different methods for playback.

Hope this helps,

Brent

tried to check the platform, but doesn’t help…

here is what I did:

  • I record the sound on Kindle Fire device by calling media.newRecording(path) and media.startRecording()
  • And I share the sound file to my iPad (I tried to download the sound file to my mac, it can be played in quicktime)
  • I play the sound file on iPad using media.playSound(filename, path, soundCompletedEvent), I think this should be what you means as the sound file is record from Android device.

I can’t hear anything from my iPad and didn’t see any error message from xcode console. The soundCompletedEvent call back didn’t fired.

I am using corona build 2013.1210

Thanks for help,
Alex

I did some test. No matter I use media.playsound or audio.play on iOS, I can not play any 3qp file which record from Android device.

Is there any method I could record audio file in wav format in both iOS and Android? or how could I do so that I could share audio file which record from Android but play on iOS or record from iOS but play on Android?

Thanks

Alex

Hi Alex,

You likely can’t do a direct share of the file between platforms. If you record on Android (in .3gp), the file may have some issues on iOS, even if you use the media library playback there (however, the media library playback should work fine on Android). You may have better luck recording the file on iOS and then playing it on Android, but you’d need to test it to make sure.

May I inquire your use case with this? Do you plan to upload the sound to a server and have it available for download to users on all platforms?

Thanks,

Brent

Hi Brent,

Yes, I upload the sound to a server and able for other user to download it. I found no solution to record the sound file in wav format in Corona SDK.

I finally convert the sound file to wav from web server and allow user to download it.

Thanks,

Alex

Hi @boscotwcheung,

You probably can’t do this with a direct “share” of the same recorded file. Android records audio in the 3GP format, which cannot be played back using Corona’s “audio” library, but rather only with the “media” library functions. So, you will basically need to detect the platform and use different methods for playback.

Hope this helps,

Brent

tried to check the platform, but doesn’t help…

here is what I did:

  • I record the sound on Kindle Fire device by calling media.newRecording(path) and media.startRecording()
  • And I share the sound file to my iPad (I tried to download the sound file to my mac, it can be played in quicktime)
  • I play the sound file on iPad using media.playSound(filename, path, soundCompletedEvent), I think this should be what you means as the sound file is record from Android device.

I can’t hear anything from my iPad and didn’t see any error message from xcode console. The soundCompletedEvent call back didn’t fired.

I am using corona build 2013.1210

Thanks for help,
Alex

I did some test. No matter I use media.playsound or audio.play on iOS, I can not play any 3qp file which record from Android device.

Is there any method I could record audio file in wav format in both iOS and Android? or how could I do so that I could share audio file which record from Android but play on iOS or record from iOS but play on Android?

Thanks

Alex

Hi Alex,

You likely can’t do a direct share of the file between platforms. If you record on Android (in .3gp), the file may have some issues on iOS, even if you use the media library playback there (however, the media library playback should work fine on Android). You may have better luck recording the file on iOS and then playing it on Android, but you’d need to test it to make sure.

May I inquire your use case with this? Do you plan to upload the sound to a server and have it available for download to users on all platforms?

Thanks,

Brent

Hi Brent,

Yes, I upload the sound to a server and able for other user to download it. I found no solution to record the sound file in wav format in Corona SDK.

I finally convert the sound file to wav from web server and allow user to download it.

Thanks,

Alex