Apple CoreAudio on iOS: synthesis to Reverb2 AudioUnit to RemoteIO - core-audio

I've successfully been synthesizing 16-bit linear PCM and outputing it to the RemoteIO AudioUnit. Now I'm trying to add a Reverb2 Audio Unit prior to outputing to RemoteIO. I'm creating an AudioGraph and setting the callback to the Reverb Unit, but I'm not getting any sound.
How do I setup the graph and properly format the Reverb2 and RemoteIO units?

For a basic setup like :
A -> Reverb -> RIO
You need to make sure both AudioStreamBasicDescriptions of the output of A and input of RIO are set to the Reverbs AudioStreamBasicDescriptions. I found the Reverb Audio Unit doesn't support changing formats.

Related

Can you insert an audio unit in a microphone and speaker stream?

I am reading about Audio Units on OSX, but it's not totally clear to me what an Audio Unit is.
I would like to insert custom audio processing in any stream that is being captured from a microphone or played by any application.
Is it possible to implement the custom audio processing as an Audio Unit which is automatically inserted into any capture or render streams on the machine?
If so, are there any good examples in the public domain that I can take a look at?

How to capture from WDM Streaming audio sources (Realtek HD Audio)

I'm trying to use various audio sources in DirectShow and I have these capture devices in my system which I think are quite common (provided by chipset drivers):
Realtek HD Audio Line input
Realtek HD Audio Stereo input
Realtek HD Audio Mic input
They look like capture sources, expose analog input and 24-bit pcm output, and can connect the output to other filters (renderer etc).
But the return code from IMediaFilter::Run of the capture filter is ERROR_BAD_COMMAND which does not say much. I tried it in my program and also in GraphStudioNext which did not reveal any extra information.
Is it possible to use these for capture and how?
Update
For instance, I tried this graph with mic input (actually connected and working). In this setup, the graph does not start (ERROR_BAD_COMMAND) but with the other source, it would start.
This is the same device but different drivers. The one that works is from the category "Audio capture sources" the one that does not "WDM Streaming Capture Devices".
The easiest way to check the device with GraphStudioNext is to build a recording graph with the PCM audio input device itself, AVI Mux filter and File Writer filter connected as this (with default media types):
You hit Run and the recording graph produces non-empty file via Filter Writer in the location prompted during graph building.
--
So now I realized your question is a bit different. You see filters corresponding to your audio input device both under
Audio Capture Sources -- CLSID_AudioInputDeviceCategory
WDM Streaming Capture Devices -- AM_KSCATEGORY_CAPTURE
And the question is that the first filter works and the other does not.
A similar filter from AM_KSCATEGORY_CAPTURE seems to be connecting into topology, but attempt to run triggers ERROR_BAD_COMMAND.
First of all, these are indeed different filters. Even though underlying hardware might be the same, the "frontend" filters are different. The wrapper that "works" is Audio Capture Filter backed by WDM device. In the other case it is Generic WDM Filter Proxy which behavior is, generally speaking, undefined. The filter is not documented and, I am guessing, it does not receive sufficient initialization or does not implement required behavior otherwise, so this proxy is not and is not supposed to be interchangeable with Audio Capture Filter proxy.

Native Audio in OSX

Basically my question is: if I have some raw LPCM data (NOT AN AUDIO FILE) that I want to play how would I go about writing that data to playable audio buffers and then beginning playback in C/C++? I realize that C might not be possible but my understanding is that the whole OS X native audio system is based on C++ so I don't think I should have to use objective C. I have dealt with AudioQueue services but I have not been able to find a method to directly write audio data to an AudioQueueBuffer. Any help is appreciated.

Error while saving captured audio using AVAssetWriterInput

We are developing an audio recording application for 10.7.5 and above.
We are using AVCaptureAudioDataOutput to capture audio and data is written using AVAssetWriterInput.
Properties set to the AVAssetWriterInput as below:
AVFormatIDKey : kAudioFormatMPEG4AAC
AVSampleRateKey : This values is taken from device using below code
AudioStreamBasicDescription streanDesc;
UInt32 propSize = sizeof(AudioStreamBasicDescription);
AudioDeviceGetProperty(mInputDevice, 0, YES, kAudioDevicePropertyStreamFormat, &propSize,&streanDesc);
AVNumberOfChannelsKey : This is taken from AudioStreamBasicDescription.
AVEncoderBitRateKey : This is hardcoded to 96000.
This works fine for most of the audio device except for USB mic of sample rate 32khz and iSight device with sample rate 48khz.
When we use these two devices as input audio device, while writing audio data we are getting the following error -
Error Domain=AVFoundationErrorDomain Code=-11821 "Cannot Decode" UserInfo=0x279470 {NSLocalizedFailureReason=The media data could not be decoded. It may be damaged., NSUnderlyingError=0x292370 "The operation couldn’t be completed. (OSStatus error 560226676.)", NSLocalizedDescription=Cannot Decode}".
However in case of USB mic if we hardcode the AVSampleRateKey to 44100 it works perfectly fine but does not work for iSight device.
What is correct value to be provided for AVSampleRateKey? Can any one help me to resolve this issue.

Mac capture HD video via Firewirre

Kodak Playsport camera HDMI output to Canopus ADVC HD50. (works okay for iMovie)
Need source code for a simple program similar to Apples' "MyRecorder" tutorial that demonstrates video capture, and then a report of what resolution it is.
Currently my program reports: "The operation couldn’t be completed. (OSStatus error -8961.)". Make sure that the formats of all video outputs are properly configured."
The answer for me is to purchase Calibrated {Q}'s XD Decode codec.

Resources