Tag: audio

Android和iOS有什么共同的audio格式编码器?

此外,logging必须跨设备共享(可能在服务器上存储/处理)。 除了通用的格式之外,我希望你的build议是正确的比特率/configuration等。 我正在录制语音,我希望获得最小的空间,但对人们logging的内容(或多或less地是WhatsApp的工作方式)有很好的/正确的理解,所以他们彼此了解,并且文件足够轻以便在慢速连接中传播得相对较快。 我已经去了这个Android图表 ,但我对iOS(未来发展)知之甚less。

Swift 3 LPCM录音机| 错误:kAudioFileInvalidPacketOffsetError

下面的录音机只能第一次工作,如果您再次尝试录音,则会在尝试AudioFileWritePackets时发出错误“kAudioFileInvalidPacketOffsetError”。 任何想法为什么发生这种情况? 先谢谢你 存储库位于这里 录音机 import UIKit import CoreAudio import AudioToolbox class SpeechRecorder: NSObject { static let sharedInstance = SpeechRecorder() // MARK:- properties @objc enum Status: Int { case ready case busy case error } internal struct RecordState { var format: AudioStreamBasicDescription var queue: UnsafeMutablePointer<AudioQueueRef?> var buffers: [AudioQueueBufferRef?] var file: AudioFileID? var currentPacket: Int64 var […]

在Swift 2.0中更改AVAudioPlayer的rate var时发生声音失真

我正在制作一个简单的audio播放应用程序。 它有大约10个audio文件,每个文件的正常播放速度为100次/分钟。 用户可以在调用play()函数之前input一个速度variables(70到140 bpm之间),该速度variables被赋予(速度/ 100)到AVAudioPlayer速率var。 @IBAction func playPause(sender: AnyObject) { if !isPlaying { let audioPath = NSBundle.mainBundle().pathForResource(selectedTrack, ofType: "mp3") do { try player = AVAudioPlayer(contentsOfURL: NSURL(fileURLWithPath: audioPath!)) player.enableRate = true player.rate = Float(tempo) / 100 player.play() isPlaying = !isPlaying } catch { print ("play error") } } } 以audio正常速度播放(100b.pm)的效果非常好。 但是,通过改变速度甚至每单一bpm单位,播放听起来真的很差。 速度转换听起来准确(即降低速度变化导致audio变慢,反之亦然),并且音调听起来像保持(尽pipe在持续音符中有点“摇晃”),但音质似乎受到主要方面的负面影响。 我也许会期望这个更为剧烈的利率变动(利率<50%或利率> 200%),但即使在99%和101%的情况下也是非常明显的。 我正在使用44k / […]

为什么我们只使用aurioTouch项目中的第一个缓冲区

我正在调查aurioTouch2示例代码。 我注意到,当我们分析audio数据时,我们只使用这个数据的第一个缓冲区,而不使用其他的缓冲区。 在void FFTBufferManager::GrabAudioData(AudioBufferList *inBL)函数中: UInt32 bytesToCopy = min(inBL->mBuffers[0].mDataByteSize, mAudioBufferSize – mAudioBufferCurrentIndex * sizeof(Float32)); memcpy(mAudioBuffer+mAudioBufferCurrentIndex, inBL->mBuffers[0].mData, bytesToCopy); function static OSStatus PerformThru( void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData) if (THIS->displayMode == aurioTouchDisplayModeOscilloscopeWaveform) { AudioConverterConvertComplexBuffer(THIS->audioConverter, inNumberFrames, ioData, THIS->drawABL); SInt8 *data_ptr = (SInt8 *)(THIS->drawABL->mBuffers[0].mData); } 问题是为什么我们忽略inBL-> mBuffers 1 .mData中的数据?

使用OpenAL在iOS上进行离线audio录制

我正在使用openAL以特定的时间间隔播放声音样本,我想将其导出到文件(无论是caf或aac或其他)。 我怎样才能用OpenAL做到这一点,而不通过扬声器/耳机实时播放我的样品?

iOS上的Phonegap 3.5媒体插件错误“无法使用AvAudioRecorder开始录制”

我正在尝试让用户在Phonegap应用程序中录制audio文件。 它在Android上运行良好,但在iOS上,当录制开始时,出现以下错误: “无法使用AvAudioRecorder开始录制”。 我使用.wav文件名,我首先创build文件,我已经按照我find的所有说明,我不断收到错误。 这是一段代码: theFileSystem.root.getFile(filename,{create:true},function(fileEntry){ mediaFileURL = fileEntry.toURL(); console.log('Created file ' + mediaFileURL); mediaRec = new Media(mediaFileURL, function(){ //console.log('Media File created'); }, function(err){ alert('Error creating the media file: ' + err.message); console.log(mediaFileURL); for(k in err){ console.log(k + ': ' + err[k]); } stopRecordingFile(); }); mediaRec.startRecord(); },function(err){ alert("Error setting audio file"); }); 我看到控制台消息“Created file …”,所以文件成功创build。 […]

如何在合并audio和video时循环audio

我正在按照此代码合并audio和video文件。 它工作很好。 假设audio长度是5秒,video长度是20秒。 虽然我在导出的video中合并了这些文件,但5秒后没有声音。 这是显而易见的,因为我的audio长度是5秒。 但在整个video会话中是否可以运行audio循环? var finalVideoURL = NSURL() var finalVideoName = String() func mergeAudio&VideoFiles(videoUrl:NSURL, audioUrl:NSURL){ let mixComposition : AVMutableComposition = AVMutableComposition() var mutableCompositionVideoTrack : [AVMutableCompositionTrack] = [] var mutableCompositionAudioTrack : [AVMutableCompositionTrack] = [] let totalVideoCompositionInstruction : AVMutableVideoCompositionInstruction = AVMutableVideoCompositionInstruction() //start merge let aVideoAsset : AVAsset = AVAsset(url: videoUrl as URL) let aAudioAsset : […]

从服务器目标C或Swift下载文件

我怎样才能从我的服务器下载audio文件到用户的手机在应用程序中使用? 当我去到网站链接,JSON代码就像这样 [{"name":"Lets Party","path":"http:\/\/domain.us\/\/\/audios\/\/Lets Party.wav"}, {"name":"Let You Know","path":"http:\/\/domain.us\/\/\/audios\/\/Let You Know.wav"}, {"name":"OMG","path":"http:\/\/domain.us\/\/\/audios\/\/OMG.wav"}] 我试图得到的JSON和转换它在Swift中,但是崩溃了我的应用程序。 但是当我把博客JSON,它完美的作品,没有崩溃。 我怎么能在Swift或Objective-C中做到这一点? 编辑:我现在得到一个错误消息。 当前代码: let urlPath = "http://www.domain.us/" let url = NSURL(string: urlPath) let session = NSURLSession.sharedSession() let task = session.dataTaskWithURL(url, completionHandler: {data, response, error -> Void in if error != nil { println(error) } else { let jsonResult = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, […]

在iOS Swift中检测设备上正在播放的音轨

我正在创build一个情绪跟踪应用程序,除其他外,应该使用有关用户所听歌曲的信息。 具体来说,我感兴趣的是在正在播放曲目时,从locking的屏幕视图中提取标题。 我search了interwebs,并没有find使用Swift访问这些数据的解决scheme。 谁能帮忙?

audio播放locking屏幕控件不在iPhone上显示

我正在使用iOS 10.2在我的实际iPhone 6s设备上进行testing。 我正在播放stream式audio,并且能够播放/暂停audio,跳过曲目等。我还启用了背景模式,并在后台播放audio,并正常播放列表。 我遇到的唯一问题是获取locking屏幕控件来显示。 没有任何显示… 在我的MainViewController的viewDidLoad(),当我的应用程序启动时,我把这个… func setupAudioSession(){ UIApplication.shared.beginReceivingRemoteControlEvents() do { try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback, with: AVAudioSessionCategoryOptions.mixWithOthers) self.becomeFirstResponder() do { try AVAudioSession.sharedInstance().setActive(true) print("AVAudioSession is Active") } catch let error as NSError { print(error.localizedDescription) } } catch let error as NSError { print(error.localizedDescription) } } 然后在我开始播放audio后在我的AudioPlayer类中调用… func setupLockScreen(){ let commandCenter = MPRemoteCommandCenter.shared() commandCenter.nextTrackCommand.isEnabled = true commandCenter.nextTrackCommand.addTarget(self, action:#selector(skipTrack)) […]