Understanding Audio Nodes - Playing and Recording Audio - Audio Mixing and Effect Processing - Working with MIDI and Samplers Agenda What will I learn?
Read and write audio files in all Core Audio supported formats - Play and record audio using files and buffers - Dynamically configure audio processing blocks - Perform audio tap processing - Perform Stereo and 3D mixing off audio signals - MIDI playback and control over sampler instruments AVAudioEngine Core Audio for Mortals
be created - AVAudioOutputNode: system output, cannot be created - AVAudioMixerNode: mixes multiple inputs to a single output -Nodes are connected via their input and output busses - Most nodes have one input and one output - AVAudioMixerNode has multiple inputs and one output - Busses have an associated audio format Nodes AVAudioNode
(Player) Processing Node (Mixer) -Nodes are connected to form an active chain - Source Node Destination Node = Active Chain - Establishes and active render thread
(Player) Processing Node (Mixer) X -Nodes are connected to form an active chain - Source Node Destination Node = Active Chain - Establishes and active render thread
-Automatically decodes when reading, encodes when writing - Does not support sample rate conversion -File has both a file format and a processing format - fileFormat: on-disk format - processingFormat: uncompressed, in-memory format - Both are instances of AVAudioFormat Audio Files AVAudioFile
Provides access to sample rate, channel count, interleaving, etc. - Wrapper over Core Audio AudioStreamBasicDescription -Core Audio uses a “Standard” format for both platforms - Noninterleaved linear PCM, 32-bit floating point samples - Canonical formats are deprecated! -Additionally supports “Common” formats - AVAudioCommonFormat: 16/32-bit integer, 32/64-but floating point Audio Formats AVAudioFormat
data from files and buffers - Scheduled to play immediately or at future time - Future times specified with AVAudioTime - Files - Schedule file or file segment with completion callback - Buffers - Schedule multiple buffers with individual completion callbacks - Schedule looping buffer Player Nodes AVAudioPlayerNode
input bus of a mixer node - Source and mixer nodes conform to this protocol Audio Mixing AVAudioMixing AVAudioOutputNode AVAudioMixerNode AVAudioPlayerNode AVAudioPlayerNode volume pan volume pan Input Bus 0 Input Bus 1
output of a particular node - Record data from microphone - Record data from a pre-recorded or live audio mix - Perform data visualization or analysis -Can install one tap per output bus -Dynamically install and remove taps -Audio data returned in a block callback Node Taps Pulling Data
-Configuration parameters: - delayTime: The delay time of the input signal (up to 2 seconds) - feedback: Amount of output fed back into delay line - lowPassCutoff: Frequency past which high frequencies rolled off - wetDryMix: The blend of wet/dry signals (0% to 100%) Delay AVAudioUnitDelay
Retrieved from the AVAudioUnitEQ object’s bands property -Configuration parameters: - filterType: Parametric, Low/High Pass, Band Pass, Low/High Shelf - frequency: The center frequency or cutoff frequency - bandwidth: The width around the main frequency in octaves - gain: The gain adjustment (boost or cut) to the frequency - bypass: The bypass state Equalization (Continued) AVAudioUnitEQFilterParameters
- DrumsBitBrush, MultiBrokenSpeaker, SpeechWaves, etc -Configuration parameters: - preGain: Gain applied to signal before distorted (-80dB to 20dB) - wetDryMix: The blend of wet/dry signals (0% to 100%) Distortion AVAudioUnitDistortion
- loadFactoryPreset:(AVAudioUnitReverbPreset)preset - Small Room, Large Hall, Cathedral, etc. -Configuration parameters: - wetDryMix: The blend of wet/dry signals (0% to 100%) Reverb AVAudioUnitReverb
controlling electronic instruments - Hardware cables and connectors - Standard MIDI file format -Extensions: - General MIDI (GM) - Downloadable Sounds (DLS) MIDI What is MIDI? http://www.midi.org
EXS, SF2, or DLS formats - Can additionally load and arbitrary array of sample data -Responds to all standard MIDI messages - Note on/off, controller messages, pitch bend, etc. -Great solution for a live performance instrument - What about playing sequences? Sampling Instrument AVAudioUnitSampler
audio - Great solution for music, audio, and gaming applications - Core Audio for Mortals -Enables you to build advanced audio applications - Read and write audio files - Play and record audio using files and buffers - Add DSP effects: Reverb, Delays, etc. - Perform Stereo and 3D mixing off audio signals - MIDI playback and control over sampler instruments Summary AVAudioEngine