Tag: audio

iPhone通过电话播放声音

在通话过程中,我想播放一个声音文件,以便另一端的人可以清楚地听到。 我知道有可能在线上播放声音,但我无法弄清楚如何同时切断麦克风,因此线路另一侧的人不会听到环境噪音。 有人知道如何做到这一点? 或者有任何提示,我可以find信息?

AVAudioEngine多AVAudioInputNodes不完美同步播放

我一直在试图使用AVAudioEngine安排多个audio文件以完美的同步播放,但是当听输出时,input节点之间似乎有一个非常小的延迟。 audio引擎使用以下图表实现: // //AVAudioPlayerNode1 –> //AVAudioPlayerNode2 –> //AVAudioPlayerNode3 –> AVAudioMixerNode –> AVAudioUnitVarispeed —> AvAudioOutputNode //AVAudioPlayerNode4 –> | //AVAudioPlayerNode5 –> AudioTap // | //AVAudioPCMBuffers // 我正在使用下面的代码来加载样本,并在同一时间安排它们: – (void)scheduleInitialAudioBlock:(SBScheduledAudioBlock *)block { for (int i = 0; i < 5; i++) { NSString *path = [self assetPathForChannel:i trackItem:block.trackItem]; //this fetches the right audio file path to be played […]

iOS:在LockScreen中显示当前播放的曲目信息?

从iOS 5开始,我们可以访问MPNowPlayingInfoCenter ,在多任务栏上的锁屏和多媒体控件中显示信息。 我有一个播放本地audio文件的应用程序。 我想用MPNowPlayingInfoCenter在锁屏上显示像艺术家的名字,专辑和艺术品的MPNowPlayingInfoCenter ,但唯一的方法(据我所知)是使用MPMusicPlayerController并获得nowPlayingItem …问题是, MPMusicPlayerController仅用于播放iPod音乐,不用于本地存储的文件。 有没有办法在iOS 5中解决这个问题?

使用AVAudioPlayer播放声音后恢复背景audio

我正在寻找一种方法来恢复我的应用程序使用AVAudioPlayer播放自己的声音后,由另一个应用程序播放的audio。 现在,如果我正在听音乐并启动应用程序,它会暂停音乐,播放我的声音,但不会恢复背景音乐。 这是我正在做什么来产生声音播放: myChime = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"chime" ofType:@"mp3"]] error:nil]; myChime.delegate = self; [myChime play]; // Here I am looking to resume the audio that the system was playing before my application played its sound. I have seen many applications do this such as, GPS apps that speak a voice direction and […]

AVAudioPlayer – 按顺序播放多个audio文件

我想用AVAudioPlayer按顺序播放多个MP3文件。 我试了一下,然后在播放第一首MP3后停下来。 但是,如果我进入debugging器,它工作正常..任何想法? 我在某处读AVAudioPlayer在后台播放audio..我如何防止它做到这一点? 沃什

确定核心audioAudioBuffer中的帧数

我正在尝试访问iPhone / iPad上的audio文件的原始数据。 我有下面的代码,这是我需要的path基本开始。 但是,我有一个AudioBuffer后,我很难做什么。 AVAssetReader *assetReader = [AVAssetReader assetReaderWithAsset:urlAsset error:nil]; AVAssetReaderTrackOutput *assetReaderOutput = [AVAssetReaderTrackOutput assetReaderTrackOutputWithTrack:[[urlAsset tracks] objectAtIndex:0] outputSettings:nil]; [assetReader addOutput:assetReaderOutput]; [assetReader startReading]; CMSampleBufferRef ref; NSArray *outputs = assetReader.outputs; AVAssetReaderOutput *output = [outputs objectAtIndex:0]; int y = 0; while (ref = [output copyNextSampleBuffer]) { AudioBufferList audioBufferList; CMBlockBufferRef blockBuffer; CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer(ref, NULL, &audioBufferList, sizeof(audioBufferList), NULL, NULL, 0, […]

iOS:如何检测音乐是否在任何背景音乐应用程序中播放?

目前我的游戏正确处理了在内置的iPod应用程序中播放音乐时禁用自己的BGM,但是当潘多拉(Pandora)等应用程序正在播放音乐时,它无法检测到。 目前,在我的applicationDidBecomeActive方法中,我检查[[MPMusicPlayerController iPodMusicPlayer] playbackState]来判断音乐是否在播放。 这是什么等同于检查像潘多拉这样的应用程序是否在后台播放audio?

AVAudioEngine播放多声道audio

简单的问题。 如何使用AVAudioEngine播放多声道audio文件(> 2声道),以便在默认的双声道输出(耳机/扬声器)上听到所有声道。 以下代码(删除错误检查提交)播放文件的第一个两个渠道,但我只能听到耳机插入时听到。 AVAudioFile *file = [[AVAudioFile alloc] initForReading:[[NSBundle mainBundle] URLForResource:@"nums6ch" withExtension:@"wav"] error:nil]; AVAudioEngine *engine = [[AVAudioEngine alloc] init]; AVAudioPlayerNode *player = [[AVAudioPlayerNode alloc] init]; AVAudioMixerNode *mixer = [[AVAudioMixerNode alloc] init]; [engine attachNode:player]; [engine attachNode:mixer]; AVAudioFormat *processingFormat = [[AVAudioFormat alloc] initWithCommonFormat:AVAudioPCMFormatFloat32 sampleRate:file.processingFormat.streamDescription->mSampleRate channels:2 interleaved:false]; [engine connect:player to:mixer format:processingFormat]; [engine connect:mixer to:engine.outputNode format:processingFormat]; [engine startAndReturnError:nil]; […]

在快速按下xcode的时候播放声音的最佳方法是什么?

我有一个音板,它只是一个约8个button的屏幕。 每个单独的button都会有自己的声音,按下button后会播放。有几种方法可以播放声音,比如使用SystemSound或者AVAudioPlayer系统的声音到目前为止似乎有最快的响应时间,avaudioplayer非常慢,它如果用户非常快地按下button,不能跟上,我创造了一个audio播放器,每个声音都很混乱。 这是如何即时播放声音的.h文件 @interface MainScreenViewController : UIViewController <AVAudioPlayerDelegate, UITabBarControllerDelegate> { AVAudioPlayer *player; CFURLRef keNURL; SystemSoundID keNObject; //KE LOUD CFURLRef keLURL; SystemSoundID keLObject; //GE NORMAL CFURLRef geNURL; SystemSoundID geNObject; //GE LOUD CFURLRef geLURL; SystemSoundID geLObject; //NA NORMAL CFURLRef naNURL; SystemSoundID naNObject; //NA LOUD CFURLRef naLURL; SystemSoundID naLObject; //RA CFURLRef raURL; SystemSoundID raObject; //DAGGA CLICK CFURLRef daCURL; […]

录制audioiOS

如何使用iOS录制audio? 不是来自麦克风的input录音,但我希望能够捕捉/logging我的应用程序中当前播放的audio? 所以,例如,我开始录制会话,以及任何只在我的应用程序中播放的声音,我想将其logging到文件中? 我已经做了这方面的研究,但我混淆了什么使用,因为它看起来像混音audio框架可能会导致问题? 我只是想要能够捕捉和保存我的应用程序中的audio播放。