audioqueueservices

Recording audio output only from speaker of iphone excluding microphone

ⅰ亾dé卋堺 提交于 2019-12-12 00:03:06
问题 I am trying to record the sound from iPhone speaker. I am able to do that, but I am unable to avoid mic input in the recorded output. Tried with sample code available in different websites with no luck. The sample which I used does the recording with audio units. I need to know if there is any property for audio unit to set the mic input volume to zero. Above that I came to from other posts that Audio Queue services can do the thing for me. Can any one redirect me with sample code for the

AudioDataPacketCount returns ValueUnknown

微笑、不失礼 提交于 2019-12-11 07:36:16
问题 I'm playing an AAC ( kAudioFormatMPEG4AAC ) file using iOS' Audio Queue Services. It's playing fine, so my code works. Now I'm looking into seek functionality. For this I need the total number of audio packets. When my property-listener-proc receives a kAudioFileStreamProperty_ReadyToProducePackets I do: UInt64 totalPackets; UInt32 size = sizeof(totalPackets); OSStatus status; status = AudioFileStreamGetProperty(inAudioFileStream, kAudioFileStreamProperty_AudioDataPacketCount,

How to send a message to self in a C function in obj-C?

痞子三分冷 提交于 2019-12-11 03:38:32
问题 I have a C function(a callback function in Audio Queue Services) and I want to send message to self. How to do that? If I type in [self message], there is an error: Use of undeclared identifier 'self' 回答1: You don't perform objc messages in realtime callbacks, such as audio. The reason for this is that objc messaging is not constant time, and may lock, resulting in missed deadlines, resulting in audio dropouts. Static or dynamic ( virtual ) C++ calls and C function calls are of course

Audioqueue callback not being called

爷,独闯天下 提交于 2019-12-10 21:07:28
问题 So, basically I want to play some audio files (mp3 and caf mostly). But the callback never gets called. Only when I call them to prime the queue. Here's my data struct: struct AQPlayerState { CAStreamBasicDescription mDataFormat; AudioQueueRef mQueue; AudioQueueBufferRef mBuffers[kBufferNum]; AudioFileID mAudioFile; UInt32 bufferByteSize; SInt64 mCurrentPacket; UInt32 mNumPacketsToRead; AudioStreamPacketDescription *mPacketDescs; bool mIsRunning; }; Here's my callback function: static void

AudioFileReadPacketData returns -50 when passed valid file

你。 提交于 2019-12-06 10:41:49
问题 I've spent some time attempting to debug this on my own but I can't seem to get the AudioFileReadPacketData to correctly read the passed in data. This is based almost directly off of the Apple AudioQueueServices Guide . class SVNPlayer: SVNPlayback { var queue: AudioQueueRef? var audioFormat: AudioStreamBasicDescription! var playbackFile: AudioFileID? var packetDesc: AudioStreamPacketDescription! var isDone = false var packetPosition: Int64 = 0 var numPacketsToRead = UInt32() private let

Audio Queue is playing too fast when the buffer size is small

僤鯓⒐⒋嵵緔 提交于 2019-12-05 09:10:40
I am able to stream and play m4a files using Audio File Services + Audio Queue Services. Bitrate information of the file is not available to the Audio Queue because of file type. After downloading the all of the audio packets I feed them to the player. When I choose a buffer size around 32768 or 16384 since callbacks are called less often and and each buffer size is big, it seems it is playing almost at regular speed. Problem is sometimes I have to play small files as well but when I choose a small buffer size -512 or 1024 or 2048 up to 8192- audio plays really fast and with occasional

Streaming audio from microphone in iPhone using Xamarin

谁都会走 提交于 2019-12-04 19:21:32
Recording with AudioQueue and Monotouch static sound demonstrates how to get audio via an iPhone's microphone into an AudioQueue using Xamarin.iOS. My question is: how do I keep the microphone continuously recording? I basically want to keep the microphone on for as long as the app is open, and continuously capture the audio stream (note that I do not want to save the stream to file). Inside a long-running while-loop? This should work: https://github.com/sami1971/SimplyMobile/blob/master/iOS/SimplyMobile.Media/Audio/AudioStream.cs Initialize and use Start() on application start and then call

AudioFileReadPacketData returns -50 when passed valid file

喜夏-厌秋 提交于 2019-12-04 17:10:47
I've spent some time attempting to debug this on my own but I can't seem to get the AudioFileReadPacketData to correctly read the passed in data. This is based almost directly off of the Apple AudioQueueServices Guide . class SVNPlayer: SVNPlayback { var queue: AudioQueueRef? var audioFormat: AudioStreamBasicDescription! var playbackFile: AudioFileID? var packetDesc: AudioStreamPacketDescription! var isDone = false var packetPosition: Int64 = 0 var numPacketsToRead = UInt32() private let callback: AudioQueueOutputCallback = { aqData, inAQ, inBuffer in guard let userData = aqData else { return

Playback and Recording simultaneously using Core Audio in iOS

寵の児 提交于 2019-12-04 11:31:39
问题 I need to play and record simultaneously using Core Audio. I really do not want to use AVFoundation API (AVAudioPlayer + AVAudioRecorder) to do this as I am making a music app and cannot have any latency issues. I've looked at the following source code from Apple: aurioTouch MixerHost I've already looked into the following posts: iOS: Sample code for simultaneous record and playback Record and play audio Simultaneously I am still not clear on how I can do playback and record the same thing

Reading audio buffer data with AudioQueue

荒凉一梦 提交于 2019-12-04 01:27:33
问题 I am attempting to read audio data via AudioQueue. When I do so, I can verify that the bit depth of the file is 16-bit. But when I get the actual sample data, I'm only seeing values from -128 to 128. But I'm also seeing suspicious looking interleaved data, which makes me pretty sure that I'm just not reading the data correctly. So to begin with, I can verify that the source file is 44100, 16-bit, mono wav file. My buffer is allocated thusly: char *buffer= NULL; buffer = malloc(BUFFER_SIZE);