Connecting AVAudioSourceNode to AVAudioSinkNode does not work
outputNode
drives the audio processing graph when AVAudioEngine
is configured normally ("online"). outputNode
pulls audio from its input node, which pulls audio from its input node(s), etc. When you connect sineNode
and sink
to each other without making a connection to outputNode
, there is nothing attached to an output bus of sink
or an input bus of outputNode
, and therefore when the hardware asks for audio from outputNode
it has nowhere to get it.
If I understand correctly I think you can accomplish what you'd like to do by getting rid of sink
, connecting sineNode
to outputNode
, and running AVAudioEngine
in manual rendering mode. In manual rendering mode you pass a manual render block to receive audio (similar to AVAudioSinkNode
) and drive the graph manually by calling renderOffline(_:to:).
Can I send sound buffers received using AVAudioSinkNode to be rendered in real-time using AVAudioSourceNode?
The way to do this in real time is to use Audio Unit callbacks (the buffers of which can be as small as a few milliseconds). They will almost always be the same size (except maybe at device power state changes), so just save each one, process it as needed, and have it ready for the next output, a few mS later. Or use a circular/ring fifo/buffer. The RemoteIO Audio Unit in iOS has synchronized I/O.
Related Topics
Could Not Find an Overload for '-' That Accepts The Supplied Arguments
Osx/Swift: Call a Function When Internet Connection Is Established/Restored
Swiching Between 2 Diferent Nsviewcontrollers with Data
Updating Existing Constraints Does Not Work, Wrong Use of .Active Property
Uisearchcontroller Hiding Status Bar on iOS 11 Swift 4
Access Environment Variable Inside Global Function - Swiftui + Coredata
How to Add Skspritenode in a Loop
Multi-Users Chat Room Data Structure in Firebase Database
How to Make an Ellipse/Circular UIimage with Transparent Background
Touch Sprite, Make It Jump Up Then Fall Down Again(Repeat as Many Times as Spritenode Is Tapped.)
Mkpolyline Broken When Using Type Satelliteflyover
How to Constrain Second Nsviewcontroller Minimum Size in Os X App
Can't Update Label from Other Class in Swift
How to Download Datas from Multiple Url in Concurrency Mode
Swift: How to Continuously Send an Action from a Nstextfield
Programmatic Beginrefreshing() on iOS11 Has Problems with Largetitles Mode