SlideShare a Scribd company logo
Core Audio
Stephen Cussen

Dec 6th, 2013
for the
Cocoa Conspiracy team at Ideas and Coffee
What is the connection?
Get Lucky (2013)

I Feel Love (1977)
Highest level is best
•

most of the time if you need audio services you will be using
AVFoundation/AVFoundation.h or
AudioToolbox/AudioServices.h

•

an example using AudioToolbox - loading a sound from a
mp3 file:
.
.
.

•

@property (assign, nonatomic) SystemSoundID noteE1;

NSURL *url = [[NSBundle mainBundle] URLForResource:@"guitarE1" withExtension:@"mp3"];
AudioServicesCreateSystemSoundID((__bridge CFURLRef)url, &noteE1);

…then play the sound
AudioServicesPlaySystemSound(self.noteE1);

•

demo - quick look at TrackTouch source and simulator demo
‘High level’ - another example:
•

SpriteKit allows you to play music (or sound effects)
as an action

•

an example of a ‘play sound’ action:
SKAction *playMusic = [SKAction playSoundFileNamed:@"flight.caf" waitForCompletion:NO];

•

demo - quick look at the Seed2 source for MyScene
and a simulator demo
From AVFoundation’s
perspective:
Core Audio - some things you
need to dive deeper for
•

Say… you wanted to build an application like Final Cut Pro,
Sound Track Pro, Garage Band, your own Synth App for the iOS
or indeed the ‘Pano Composer’ :-)

•

Core Audio is the engine underlying all audio services on iOS
and OSX. Programming it directly has a cost - it’s complicated
and quite a lot of the ‘documentation’ is reading the header files
and trying things out

•

First, make sure that you really need to be at this level. For
example you could build a simple DJ mixer in AVFoundation

•

However, if you wanted to build the real full featured DJ Mixer with
complex fades, effects and playing things backwards(!) you’d be
at CoreAudio level
Core Audio is built on
AudioUnit components
•

Audio Units are arranged in the form of a graph (AUGraph), in
a pipeline similar to the way Core Image works with filters

•

You end up with a single output from an AUGraph that results in
the final output sound stream

•

Audio Units are based on a plugin architecture with Apple
supplying an extensive set of Audio Units that cover just about
anything you could need. The standard CoreAudio bundle is in
‘/System/Library/Components’ and there is a search path for
components so you can include Audio Component Plugins

•

You could build your own Audio Units and package them as
plugins - for an overview see WWDC 2011 Video #411
Audio Units
•

Effects

•

Music Effects

•

Instruments

•

Generators

•

Panners

•

Converters

•

Mixers

•

Offline Effects

•

Output Units
Core Audio - a real example
with some code
An iOS example to:
- load multiple instruments from a sound font file
- perform real-time pitch adjustment on a single instrument
- mix the output (play multiple instruments simultaneously)
We will call it the Synth Mixer Demo…
AU Graph for Synth Mixer Demo
Synth Mixer Demo
•demo
•so

- a simulator demo then a look at the Synth Mixer source

how did I find out how to adjust the pitch with the effects unit?

•documentation

- from AudioUnitParameters.h

- from AudioUnitParameters.h
// Parameters for AUNewTimePitch
enum {
// Global, rate, 1/32 -> 32.0, 1.0
kNewTimePitchParam_Rate
// Global, Cents, -2400 -> 2400, 1.0
kNewTimePitchParam_Pitch
// Global, generic, 3.0 -> 32.0, 8.0
kNewTimePitchParam_Overlap
// Global, Boolean, 0->1, 1
kNewTimePitchParam_EnablePeakLocking
};

- from AudioUnitParameters.h
enum {
kAudioUnitScope_Global
kAudioUnitScope_Input
kAudioUnitScope_Output
kAudioUnitScope_Group
kAudioUnitScope_Part
kAudioUnitScope_Note
kAudioUnitScope_Layer
kAudioUnitScope_LayerItem
};

= 0,
= 1,
= 2,
= 3,
= 6,

= 4,
= 5,
=7

= 0,
= 1,
= 4,
=6
Synth Mixer Demo cont…
•

So how did I find out how to load a Sound Font?

•

Apple Technical Note TN2283 AUSampler - Loading Instruments
MIDI
•I’m

using MusicDeviceMIDIEvent (declared in
MusicDevice.h) that is used to send MIDI events to an
Audio Unit
// some MIDI constants:
enum {
kMIDIMessage_NoteOn = 0x9,
kMIDIMessage_NoteOff = 0x8,
};
UInt32 noteNum = 60;
UInt32 onVelocity = 127;
UInt32 noteCommand =

kMIDIMessage_NoteOn << 4 | 0;

MusicDeviceMIDIEvent (self.samplerUnit, noteCommand, noteNum, onVelocity, 0);
Sound Scape
•

My Core Audio example code on Github (scussen)
Documentation & Resources
What’s missing from the Apple Documentation?
- The ‘Unified’ CoreAudio Overview Document :-)
Well there is a Core Audio Overview document in the Developer Library but it was last updated in 2008…
Documentation & Resources available:
Your number one place to go is the iOS Developer Library (now much better but not complete)
The videos:
WWDC 2013: What’s New In Core Audio for iOS - Video #602
WWDC 2011: AudioSession and MultiRoute Audio - Video #505
WWDC 2011: Audio Session Management For iOS - Video #413
WWDC 2011: Music in iOS and Lion - Video #411
The documents:
https://developer.apple.com/library/ios/navigation/#section=Frameworks&topic=AVFoundation
https://developer.apple.com/library/ios/navigation/#section=Frameworks&topic=AudioToolbox
https://developer.apple.com/library/ios/navigation/#section=Frameworks&topic=AudioUnit
https://developer.apple.com/library/ios/navigation/#section=Frameworks&topic=CoreAudio
Tech notes:
- iOS Developer Library - Technical Note TN2283 ‘AUSampler - Loading Instruments’
- Example of the level of detail available: Audio Queue - Looping Compressed Audio
The header files:
This is where you will find most (and sometimes all the) detail ‘documentation’ :-)
Resources cont…
•

AU Lab

•

Panaiotis - our very own world class music
professor, composer and synth expert!
What is the link?
•

Daft Punk

•

Donna Summer

•

Giorgio Moroder

•

Moog Synthesizer

More Related Content

What's hot

Start sequence for gta v cut sequence annotation
Start sequence for gta v cut sequence annotationStart sequence for gta v cut sequence annotation
Start sequence for gta v cut sequence annotation
MartinDevney
 
Core Audio in iOS 6 (CocoaConf DC, March 2013)
Core Audio in iOS 6 (CocoaConf DC, March 2013)Core Audio in iOS 6 (CocoaConf DC, March 2013)
Core Audio in iOS 6 (CocoaConf DC, March 2013)
Chris Adamson
 
XNA L06–Input, Audio and Video Playback
XNA L06–Input, Audio and Video PlaybackXNA L06–Input, Audio and Video Playback
XNA L06–Input, Audio and Video Playback
Mohammad Shaker
 
Core Audio in iOS 6 (CocoaConf San Jose, April 2013)
Core Audio in iOS 6 (CocoaConf San Jose, April 2013) Core Audio in iOS 6 (CocoaConf San Jose, April 2013)
Core Audio in iOS 6 (CocoaConf San Jose, April 2013)
Chris Adamson
 
Rhl sound generation_1
Rhl sound generation_1Rhl sound generation_1
Rhl sound generation_1
halo4robo
 
Alpan Aytekin-Game Audio Essentials
Alpan Aytekin-Game Audio EssentialsAlpan Aytekin-Game Audio Essentials
Alpan Aytekin-Game Audio Essentials
gamedevelopersturkey
 

What's hot (20)

Start sequence for gta v cut sequence annotation
Start sequence for gta v cut sequence annotationStart sequence for gta v cut sequence annotation
Start sequence for gta v cut sequence annotation
 
Core Audio in iOS 6 (CocoaConf DC, March 2013)
Core Audio in iOS 6 (CocoaConf DC, March 2013)Core Audio in iOS 6 (CocoaConf DC, March 2013)
Core Audio in iOS 6 (CocoaConf DC, March 2013)
 
XNA L06–Input, Audio and Video Playback
XNA L06–Input, Audio and Video PlaybackXNA L06–Input, Audio and Video Playback
XNA L06–Input, Audio and Video Playback
 
Core Audio in iOS 6 (CocoaConf San Jose, April 2013)
Core Audio in iOS 6 (CocoaConf San Jose, April 2013) Core Audio in iOS 6 (CocoaConf San Jose, April 2013)
Core Audio in iOS 6 (CocoaConf San Jose, April 2013)
 
Assignment 2
Assignment 2Assignment 2
Assignment 2
 
Kewirausahaan 2 ppt.
Kewirausahaan 2 ppt.Kewirausahaan 2 ppt.
Kewirausahaan 2 ppt.
 
Background Audio Playback
Background Audio PlaybackBackground Audio Playback
Background Audio Playback
 
Web Audio API + AngularJS
Web Audio API + AngularJSWeb Audio API + AngularJS
Web Audio API + AngularJS
 
Android Lab Test : Managing sounds with SoundPool (english)
Android Lab Test : Managing sounds with SoundPool (english)Android Lab Test : Managing sounds with SoundPool (english)
Android Lab Test : Managing sounds with SoundPool (english)
 
Html multimedia
Html multimediaHtml multimedia
Html multimedia
 
Android Audio & OpenSL
Android Audio & OpenSLAndroid Audio & OpenSL
Android Audio & OpenSL
 
Rhl sound generation_1
Rhl sound generation_1Rhl sound generation_1
Rhl sound generation_1
 
Stupid Video Tricks, CocoaConf Las Vegas
Stupid Video Tricks, CocoaConf Las VegasStupid Video Tricks, CocoaConf Las Vegas
Stupid Video Tricks, CocoaConf Las Vegas
 
Deep dive into Android’s audio latency problem
Deep dive into Android’s audio latency problemDeep dive into Android’s audio latency problem
Deep dive into Android’s audio latency problem
 
Alpan Aytekin-Game Audio Essentials
Alpan Aytekin-Game Audio EssentialsAlpan Aytekin-Game Audio Essentials
Alpan Aytekin-Game Audio Essentials
 
Prepare a project in Logic 9
Prepare a project in Logic 9Prepare a project in Logic 9
Prepare a project in Logic 9
 
Video Game Music Overview
Video Game Music OverviewVideo Game Music Overview
Video Game Music Overview
 
FYBSC IT Web Programming Unit II Audio Video in HTML
FYBSC IT Web Programming Unit II  Audio  Video in HTMLFYBSC IT Web Programming Unit II  Audio  Video in HTML
FYBSC IT Web Programming Unit II Audio Video in HTML
 
Forward Swift 2017: Media Frameworks and Swift: This Is Fine
Forward Swift 2017: Media Frameworks and Swift: This Is FineForward Swift 2017: Media Frameworks and Swift: This Is Fine
Forward Swift 2017: Media Frameworks and Swift: This Is Fine
 
How to create a podcast
How to create a podcastHow to create a podcast
How to create a podcast
 

Similar to Core audio

Ig2 task 1 work sheet connor martin
Ig2 task 1 work sheet connor martinIg2 task 1 work sheet connor martin
Ig2 task 1 work sheet connor martin
Kalen612
 
Ig2 task 1 work sheet - JS
Ig2 task 1 work sheet - JSIg2 task 1 work sheet - JS
Ig2 task 1 work sheet - JS
JamieShepherd
 
Ig2 task 1 work sheet newi9979
Ig2 task 1 work sheet newi9979Ig2 task 1 work sheet newi9979
Ig2 task 1 work sheet newi9979
CallumDrakeCPFC
 
Ig2 task 1 work sheet 12378
Ig2 task 1 work sheet 12378Ig2 task 1 work sheet 12378
Ig2 task 1 work sheet 12378
CallumDrakeCPFC
 
Ig2task1worksheetelliot 140511141816-phpapp02
Ig2task1worksheetelliot 140511141816-phpapp02Ig2task1worksheetelliot 140511141816-phpapp02
Ig2task1worksheetelliot 140511141816-phpapp02
ElliotBlack
 
Shaun warburton ig2 task 1 work sheet improved
Shaun warburton ig2 task 1 work sheet improvedShaun warburton ig2 task 1 work sheet improved
Shaun warburton ig2 task 1 work sheet improved
warburton9191
 
Martin devney IG2 task 1 work sheet
Martin devney IG2 task 1 work sheetMartin devney IG2 task 1 work sheet
Martin devney IG2 task 1 work sheet
MartinDevney
 
IG2 Task 1 Worksheet
IG2 Task 1 WorksheetIG2 Task 1 Worksheet
IG2 Task 1 Worksheet
SamDuxburyGDS
 
Ig2 task 1 work sheet
Ig2 task 1 work sheetIg2 task 1 work sheet
Ig2 task 1 work sheet
hajohnson90
 
Michael williamsig2task1worksheet
Michael williamsig2task1worksheetMichael williamsig2task1worksheet
Michael williamsig2task1worksheet
Hooaax
 
Anthony bowes IG2 task 1
Anthony bowes  IG2 task 1 Anthony bowes  IG2 task 1
Anthony bowes IG2 task 1
bowes96123
 
Ig2 task 1 work sheet (revisited)
Ig2 task 1 work sheet (revisited)Ig2 task 1 work sheet (revisited)
Ig2 task 1 work sheet (revisited)
Mrrrjones
 
Sound recording glossary updated
Sound recording glossary updated Sound recording glossary updated
Sound recording glossary updated
TomCrook
 

Similar to Core audio (20)

IG2 Task 1
IG2 Task 1 IG2 Task 1
IG2 Task 1
 
Ig2 task 1 work sheet connor martin
Ig2 task 1 work sheet connor martinIg2 task 1 work sheet connor martin
Ig2 task 1 work sheet connor martin
 
Sound Recording Glossary
Sound Recording GlossarySound Recording Glossary
Sound Recording Glossary
 
Ig2 task 1 work sheet - JS
Ig2 task 1 work sheet - JSIg2 task 1 work sheet - JS
Ig2 task 1 work sheet - JS
 
IG2 Task 1 Work Sheet
IG2 Task 1 Work SheetIG2 Task 1 Work Sheet
IG2 Task 1 Work Sheet
 
Ig2 task 1 work sheet newi9979
Ig2 task 1 work sheet newi9979Ig2 task 1 work sheet newi9979
Ig2 task 1 work sheet newi9979
 
Ig2 task 1 work sheet 12378
Ig2 task 1 work sheet 12378Ig2 task 1 work sheet 12378
Ig2 task 1 work sheet 12378
 
Sound recording glossary improved
Sound recording glossary improvedSound recording glossary improved
Sound recording glossary improved
 
Bl ig2 url edit
Bl ig2 url editBl ig2 url edit
Bl ig2 url edit
 
Thingy editedd
Thingy editeddThingy editedd
Thingy editedd
 
Ig2task1worksheetelliot 140511141816-phpapp02
Ig2task1worksheetelliot 140511141816-phpapp02Ig2task1worksheetelliot 140511141816-phpapp02
Ig2task1worksheetelliot 140511141816-phpapp02
 
Shaun warburton ig2 task 1 work sheet improved
Shaun warburton ig2 task 1 work sheet improvedShaun warburton ig2 task 1 work sheet improved
Shaun warburton ig2 task 1 work sheet improved
 
Martin devney IG2 task 1 work sheet
Martin devney IG2 task 1 work sheetMartin devney IG2 task 1 work sheet
Martin devney IG2 task 1 work sheet
 
IG2 Task 1 Worksheet
IG2 Task 1 WorksheetIG2 Task 1 Worksheet
IG2 Task 1 Worksheet
 
Ig2 task 1 work sheet
Ig2 task 1 work sheetIg2 task 1 work sheet
Ig2 task 1 work sheet
 
Michael williamsig2task1worksheet
Michael williamsig2task1worksheetMichael williamsig2task1worksheet
Michael williamsig2task1worksheet
 
Anthony bowes IG2 task 1
Anthony bowes  IG2 task 1 Anthony bowes  IG2 task 1
Anthony bowes IG2 task 1
 
Ig2 task 1 work sheet (revisited)
Ig2 task 1 work sheet (revisited)Ig2 task 1 work sheet (revisited)
Ig2 task 1 work sheet (revisited)
 
Core Audio Cranks It Up
Core Audio Cranks It UpCore Audio Cranks It Up
Core Audio Cranks It Up
 
Sound recording glossary updated
Sound recording glossary updated Sound recording glossary updated
Sound recording glossary updated
 

Recently uploaded

Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 

Recently uploaded (20)

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx
 
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringBasic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
Salient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptxSalient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptx
 
The Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational ResourcesThe Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational Resources
 
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxslides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfINU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
 
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptxJose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 

Core audio

  • 1. Core Audio Stephen Cussen Dec 6th, 2013 for the Cocoa Conspiracy team at Ideas and Coffee
  • 2. What is the connection? Get Lucky (2013) I Feel Love (1977)
  • 3. Highest level is best • most of the time if you need audio services you will be using AVFoundation/AVFoundation.h or AudioToolbox/AudioServices.h • an example using AudioToolbox - loading a sound from a mp3 file: . . . • @property (assign, nonatomic) SystemSoundID noteE1; NSURL *url = [[NSBundle mainBundle] URLForResource:@"guitarE1" withExtension:@"mp3"]; AudioServicesCreateSystemSoundID((__bridge CFURLRef)url, &noteE1); …then play the sound AudioServicesPlaySystemSound(self.noteE1); • demo - quick look at TrackTouch source and simulator demo
  • 4. ‘High level’ - another example: • SpriteKit allows you to play music (or sound effects) as an action • an example of a ‘play sound’ action: SKAction *playMusic = [SKAction playSoundFileNamed:@"flight.caf" waitForCompletion:NO]; • demo - quick look at the Seed2 source for MyScene and a simulator demo
  • 6. Core Audio - some things you need to dive deeper for • Say… you wanted to build an application like Final Cut Pro, Sound Track Pro, Garage Band, your own Synth App for the iOS or indeed the ‘Pano Composer’ :-) • Core Audio is the engine underlying all audio services on iOS and OSX. Programming it directly has a cost - it’s complicated and quite a lot of the ‘documentation’ is reading the header files and trying things out • First, make sure that you really need to be at this level. For example you could build a simple DJ mixer in AVFoundation • However, if you wanted to build the real full featured DJ Mixer with complex fades, effects and playing things backwards(!) you’d be at CoreAudio level
  • 7. Core Audio is built on AudioUnit components • Audio Units are arranged in the form of a graph (AUGraph), in a pipeline similar to the way Core Image works with filters • You end up with a single output from an AUGraph that results in the final output sound stream • Audio Units are based on a plugin architecture with Apple supplying an extensive set of Audio Units that cover just about anything you could need. The standard CoreAudio bundle is in ‘/System/Library/Components’ and there is a search path for components so you can include Audio Component Plugins • You could build your own Audio Units and package them as plugins - for an overview see WWDC 2011 Video #411
  • 9. Core Audio - a real example with some code An iOS example to: - load multiple instruments from a sound font file - perform real-time pitch adjustment on a single instrument - mix the output (play multiple instruments simultaneously) We will call it the Synth Mixer Demo…
  • 10. AU Graph for Synth Mixer Demo
  • 11. Synth Mixer Demo •demo •so - a simulator demo then a look at the Synth Mixer source how did I find out how to adjust the pitch with the effects unit? •documentation - from AudioUnitParameters.h - from AudioUnitParameters.h // Parameters for AUNewTimePitch enum { // Global, rate, 1/32 -> 32.0, 1.0 kNewTimePitchParam_Rate // Global, Cents, -2400 -> 2400, 1.0 kNewTimePitchParam_Pitch // Global, generic, 3.0 -> 32.0, 8.0 kNewTimePitchParam_Overlap // Global, Boolean, 0->1, 1 kNewTimePitchParam_EnablePeakLocking }; - from AudioUnitParameters.h enum { kAudioUnitScope_Global kAudioUnitScope_Input kAudioUnitScope_Output kAudioUnitScope_Group kAudioUnitScope_Part kAudioUnitScope_Note kAudioUnitScope_Layer kAudioUnitScope_LayerItem }; = 0, = 1, = 2, = 3, = 6, = 4, = 5, =7 = 0, = 1, = 4, =6
  • 12. Synth Mixer Demo cont… • So how did I find out how to load a Sound Font? • Apple Technical Note TN2283 AUSampler - Loading Instruments
  • 13. MIDI •I’m using MusicDeviceMIDIEvent (declared in MusicDevice.h) that is used to send MIDI events to an Audio Unit // some MIDI constants: enum { kMIDIMessage_NoteOn = 0x9, kMIDIMessage_NoteOff = 0x8, }; UInt32 noteNum = 60; UInt32 onVelocity = 127; UInt32 noteCommand = kMIDIMessage_NoteOn << 4 | 0; MusicDeviceMIDIEvent (self.samplerUnit, noteCommand, noteNum, onVelocity, 0);
  • 14. Sound Scape • My Core Audio example code on Github (scussen)
  • 15. Documentation & Resources What’s missing from the Apple Documentation? - The ‘Unified’ CoreAudio Overview Document :-) Well there is a Core Audio Overview document in the Developer Library but it was last updated in 2008… Documentation & Resources available: Your number one place to go is the iOS Developer Library (now much better but not complete) The videos: WWDC 2013: What’s New In Core Audio for iOS - Video #602 WWDC 2011: AudioSession and MultiRoute Audio - Video #505 WWDC 2011: Audio Session Management For iOS - Video #413 WWDC 2011: Music in iOS and Lion - Video #411 The documents: https://developer.apple.com/library/ios/navigation/#section=Frameworks&topic=AVFoundation https://developer.apple.com/library/ios/navigation/#section=Frameworks&topic=AudioToolbox https://developer.apple.com/library/ios/navigation/#section=Frameworks&topic=AudioUnit https://developer.apple.com/library/ios/navigation/#section=Frameworks&topic=CoreAudio Tech notes: - iOS Developer Library - Technical Note TN2283 ‘AUSampler - Loading Instruments’ - Example of the level of detail available: Audio Queue - Looping Compressed Audio The header files: This is where you will find most (and sometimes all the) detail ‘documentation’ :-)
  • 16. Resources cont… • AU Lab • Panaiotis - our very own world class music professor, composer and synth expert!
  • 17. What is the link? • Daft Punk • Donna Summer • Giorgio Moroder • Moog Synthesizer