core-audio

Converting audio to CAF format for playback on iPhone using OpenAL

浪子不回头ぞ 提交于 2019-11-28 02:32:44
I am using the SoundEngine sample code from Apple in the CrashLanding sample to play back multiple audio files. Using the sample caf files included with CrashLanding everything works fine but when I try and use my own samplesconverted to CAF using afconvert all I get is a stony silence ;) Does anyone have settings for afconvert that will produce a CAF file capable of being played back through OpenAL? Dave Verwer afconvert -f caff -d LEI16@44100 -c 1 in.wav out.caf References: Apple's Multimedia Programming Guide: Using Audio: Preferred Audio Formats in iOS afconvert(1) man page (use afconvert

ios - combine/concatenate multiple audio files

久未见 提交于 2019-11-28 02:23:05
问题 I have a bunch of audio files (mp3, aac, whatever) and I want to concatenate them into 1 audio file. Has anyone done this before? 回答1: I have done this. To do the concatenation you first need to load the audio files into AVAssets. Specifically, you'll want to use a subclass of AVAsset called AVURLAssets, which can load up your URL: Loading AVAsset. You can then add each AVAsset into a AVMutableComposition, which is designed to contain multiple AVAssets . Once you've gotten it loaded into

Callback function of output unit of audio graph - can't read data

北战南征 提交于 2019-11-28 02:02:08
问题 I am trying to capture the input data stream to the output unit in an audio graph so I can write it to a file. I have registered an input callback function for the output unit (default output) after creating the graph like so: AudioComponent comp = AudioComponentFindNext (NULL, &cd); if (comp == NULL) { printf ("can't get output unit"); exit (-1); } CheckError (AudioComponentInstanceNew(comp, &player->outputUnit), "Couldn't open component for outputUnit"); // outputUnit is of type AudioUnit /

AVPlayer playback of single channel audio stereo->mono

独自空忆成欢 提交于 2019-11-28 01:39:21
问题 In my iPad/iPhone App I'm playing back a video using AVPlayer. The video file has a stereo audio track but I need to playback only one channel of this track in mono. Deployment target is iOS 6. How can I achieve this? Thanks a lot for your help. 回答1: I now finally found an answer to this question - at least for deployment on iOS 6. You can easily add an MTAudioProcessingTap to your existing AVPlayer item and copy the selected channels samples to the other channel during your process callback

how to get Audio Device UID to pass into NSSound's setPlaybackDeviceIdentifier:

梦想与她 提交于 2019-11-27 22:34:13
问题 How can i get audio device UID (USB speaker) to pass into NSSound's setPlaybackDeviceIdentifier: method Thanks 回答1: To avoid the deprecated AudioHardwareGetProperty and AudioDeviceGetProperty calls replace them with something like this: AudioObjectPropertyAddress propertyAddress; AudioObjectID *deviceIDs; UInt32 propertySize; NSInteger numDevices; propertyAddress.mSelector = kAudioHardwarePropertyDevices; propertyAddress.mScope = kAudioObjectPropertyScopeGlobal; propertyAddress.mElement =

Write Audio To Disk From IO Unit

半世苍凉 提交于 2019-11-27 20:16:50
Rewriting this question to be a little more succient. My problem is that I cant successfully write an audio file to disk from a remote IO Unit. The steps I took were to Open an mp3 file and extract its audio to buffers. I set up an asbd to use with my graph based on the properties of the graph. I setup and run my graph looping the extracted audio and sound successfully comes out the speaker! What I'm having difficulty with is taking the audio samples from the remote IO callback and writing them to an audio file on disk which I am using ExtAudioFileWriteASync for. The audio file does get

How to set an title of the currently playing audio in iPhone lock screen?

微笑、不失礼 提交于 2019-11-27 18:38:11
When you play a music, the music title is shown below the time in the lock screen. I have also seen how TuneIn radio does that by showing the name of the currently playing radio station. How do you do that? Read the documentation: MPNowPlayingInfoCenter And here is an example code that will work on iOS 5 and it will not crash on older versions of iOS. Class playingInfoCenter = NSClassFromString(@"MPNowPlayingInfoCenter"); if (playingInfoCenter) { MPNowPlayingInfoCenter *center = [MPNowPlayingInfoCenter defaultCenter]; NSDictionary *songInfo = [NSDictionary dictionaryWithObjectsAndKeys: @"Some

How to seek within an audio track using avassetreader?

风流意气都作罢 提交于 2019-11-27 16:55:56
问题 I'm familiar with how to stream audio data from the ipod library using AVAssetReader, but I'm at a loss as to how to seek within the track. e.g. start playback at the halfway point, etc. Starting from the beginning and then sequentially getting successive samples is easy, but surely there must be a way to have random access? 回答1: AVAssetReader has a property, timeRange, which determines the time range of the asset from which media data will be read. @property(nonatomic) CMTimeRange timeRange

Determine Number of Frames in a Core Audio AudioBuffer

妖精的绣舞 提交于 2019-11-27 16:51:39
问题 I am trying to access the raw data for an audio file on the iPhone/iPad. I have the following code which is a basic start down the path I need. However I am stumped at what to do once I have an AudioBuffer. AVAssetReader *assetReader = [AVAssetReader assetReaderWithAsset:urlAsset error:nil]; AVAssetReaderTrackOutput *assetReaderOutput = [AVAssetReaderTrackOutput assetReaderTrackOutputWithTrack:[[urlAsset tracks] objectAtIndex:0] outputSettings:nil]; [assetReader addOutput:assetReaderOutput];

iOS: Using Bluetooth audio output (kAudioSessionProperty_OverrideCategoryEnableBluetoothInput) AudioSession

荒凉一梦 提交于 2019-11-27 16:44:11
问题 I have several questions to the CoreAudio AudioSession framework related to several Bluetooth tasks and I hope someone can help me with these issues or at least can confirm my latest findings. The usecase is a navigation app that wants to connect with a bluetooth enabled radio which supports both, HFP and A2DP. I have read the whole AudioSession Programming Guidelines but I have still some open issues especially using audio output through Bluetooth. Bluetooth HFP audio output