音频格式适用于iOS和Android [英] audio format for iOS and Android

查看:157
本文介绍了音频格式适用于iOS和Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很抱歉,如果我要求过于笼统的问题。

Sorry if I am asking too generic question.

我们是其中记录了音频播放移动设备中的应用程序的开发。此应用程序正在开发Android和iOS的。应用程序将使用设备的麦克风记录音频和储存在服务器中。用户(从机器人和IOS)可以打开该应用程序和播放存储在服务器中的声音。我们使用的声音格式是AAC格式。在iOS系统中其工作的罚款。我们可以录制和播放的AAC文件。

We are in the development of an application which records a plays audio in mobile devices. This application is developing in both android and iOS. The application will record audio using device mic and store it in the server. User (from android and iOS) can open the application and play the sound which is stored in the server. The sound format we have using is AAC format. In iOS its working fine. We can record and play the AAC files.

但是,从机器人(三星S3和山城银河Y),我们无法录制声音AAC格式。但在S3中我们可以发挥的AAC文件。

But from android (Samsung S3 and Sansung Galaxy Y) we cannot record sound in AAC format. But in S3 we can play the AAC file.

我的问题是,它的格式,我们可以对记录和Android的播放(应该从2.3支持杰利贝恩)和iOS选择。它是的MP4?

My question is, which format we can select for recording and playing in Android (should support from 2.3 to Jellybean) and iOS. Is it Mp4?

的一个解决方案,我们有是,在后端侧,我们可以支持的文件转换音频文件为AAC,MP4或3GP和给予基于所述版本移动

One solution we have is, in the backend side we can convert the audio file to AAC, MP4 or 3GP and give the supported files to mobiles based on the versions.

推荐答案

我们最近完成了一个应用程序具有这种功能的两个记录,并从iOS和Android的听,下面是$ C $,我们供大家参考以下。我们依靠我们的互联网服务和服务器转换为可以在这两个平台上很容易发挥mp3格式。

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);
}

您可以找到从M4A转换code到MP3的净易,通过谷歌搜索(跛脚或FAAD像一些实用程序)环顾四周。

You can find out conversion code from m4a to mp3 in .Net easily, look around by googling (lame or faad some utility like that).

希望这有助于。

这篇关于音频格式适用于iOS和Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆