Sorry if I am asking too generic question.
We are in the process of developing an application which records and plays audio on mobile devices. This application is be
We recently completed one app with this kind of functionality recording from both and listening from both iOS and Android, below is code we used for your reference.We relied on our webservice and server for conversion to .mp3 format which can be easily played in both platform.
//iPhone side code. records m4a file format (small in size)
NSDictionary *recordSettings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt: kAudioFormatMPEG4AAC], AVFormatIDKey,
[NSNumber numberWithFloat:16000.0], AVSampleRateKey,
[NSNumber numberWithInt: 1], AVNumberOfChannelsKey,
nil];
NSError *error = nil;
audioRecorder = [[AVAudioRecorder alloc] initWithURL:soundFileURL settings:recordSettings error:&error];
if (error)
NSLog(@"error: %@", [error localizedDescription]);
else
[audioRecorder prepareToRecord];
//Android side code. (records mp4 format and it works straight away by giving mp3 extension.)
MediaRecorder recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
recorder.setAudioEncodingBitRate(256);
recorder.setAudioChannels(1);
recorder.setAudioSamplingRate(44100);
recorder.setOutputFile(getFilename());
try {
recorder.prepare();
recorder.start();
myCount=new MyCount(thirtysec, onesecond);
myCount.start();
recordingDone=true;
count=0;
handler.sendEmptyMessage(0);
if(progressDialog.isShowing())
progressDialog.dismiss();
} catch (IllegalStateException e) {
e.printStackTrace();
StringWriter strTrace = new StringWriter();
e.printStackTrace(new PrintWriter(strTrace));
CrashReportActivity.appendLog(
"\nEXCEPTION : \n" + strTrace.toString() + "\n",
Comment.this);
} catch (IOException e) {
e.printStackTrace();
StringWriter strTrace = new StringWriter();
e.printStackTrace(new PrintWriter(strTrace));
CrashReportActivity.appendLog(
"\nEXCEPTION : \n" + strTrace.toString() + "\n",
Comment.this);
}
You can find out conversion code from m4a to mp3 in .Net easily, look around by googling (lame or faad some utility like that).
Hope this helps.