SlideShare ist ein Scribd-Unternehmen logo
1 von 17
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

Weitere ähnliche Inhalte

Was ist angesagt?

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 annotationMartinDevney
 
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 PlaybackMohammad 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
 
Background Audio Playback
Background Audio PlaybackBackground Audio Playback
Background Audio PlaybackKorhan Bircan
 
Web Audio API + AngularJS
Web Audio API + AngularJSWeb Audio API + AngularJS
Web Audio API + AngularJSChris Bateman
 
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)Bruno Delb
 
Android Audio & OpenSL
Android Audio & OpenSLAndroid Audio & OpenSL
Android Audio & OpenSLYoss Cohen
 
Rhl sound generation_1
Rhl sound generation_1Rhl sound generation_1
Rhl sound generation_1halo4robo
 
Stupid Video Tricks, CocoaConf Las Vegas
Stupid Video Tricks, CocoaConf Las VegasStupid Video Tricks, CocoaConf Las Vegas
Stupid Video Tricks, CocoaConf Las VegasChris Adamson
 
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 problemSirawat Pitaksarit
 
Alpan Aytekin-Game Audio Essentials
Alpan Aytekin-Game Audio EssentialsAlpan Aytekin-Game Audio Essentials
Alpan Aytekin-Game Audio Essentialsgamedevelopersturkey
 
Prepare a project in Logic 9
Prepare a project in Logic 9Prepare a project in Logic 9
Prepare a project in Logic 9Roope Anttinen
 
Video Game Music Overview
Video Game Music OverviewVideo Game Music Overview
Video Game Music OverviewKaren Collins
 
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 HTMLArti Parab Academics
 
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 FineChris Adamson
 
How to create a podcast
How to create a podcastHow to create a podcast
How to create a podcastFALE - UFMG
 

Was ist angesagt? (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
 

Ähnlich wie 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 martinKalen612
 
Ig2 task 1 work sheet - JS
Ig2 task 1 work sheet - JSIg2 task 1 work sheet - JS
Ig2 task 1 work sheet - JSJamieShepherd
 
Ig2 task 1 work sheet newi9979
Ig2 task 1 work sheet newi9979Ig2 task 1 work sheet newi9979
Ig2 task 1 work sheet newi9979CallumDrakeCPFC
 
Ig2 task 1 work sheet 12378
Ig2 task 1 work sheet 12378Ig2 task 1 work sheet 12378
Ig2 task 1 work sheet 12378CallumDrakeCPFC
 
Sound recording glossary improved
Sound recording glossary improvedSound recording glossary improved
Sound recording glossary improvedBen Atherton
 
Bl ig2 url edit
Bl ig2 url editBl ig2 url edit
Bl ig2 url editbenloynd
 
Ig2task1worksheetelliot 140511141816-phpapp02
Ig2task1worksheetelliot 140511141816-phpapp02Ig2task1worksheetelliot 140511141816-phpapp02
Ig2task1worksheetelliot 140511141816-phpapp02ElliotBlack
 
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 improvedwarburton9191
 
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 sheetMartinDevney
 
IG2 Task 1 Worksheet
IG2 Task 1 WorksheetIG2 Task 1 Worksheet
IG2 Task 1 WorksheetSamDuxburyGDS
 
Ig2 task 1 work sheet
Ig2 task 1 work sheetIg2 task 1 work sheet
Ig2 task 1 work sheethajohnson90
 
Michael williamsig2task1worksheet
Michael williamsig2task1worksheetMichael williamsig2task1worksheet
Michael williamsig2task1worksheetHooaax
 
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
 
Core Audio Cranks It Up
Core Audio Cranks It UpCore Audio Cranks It Up
Core Audio Cranks It UpChris Adamson
 
Sound recording glossary updated
Sound recording glossary updated Sound recording glossary updated
Sound recording glossary updated TomCrook
 

Ähnlich wie 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
 

Kürzlich hochgeladen

Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEaurabinda banchhor
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxRosabel UA
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataBabyAnnMotar
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 

Kürzlich hochgeladen (20)

Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSE
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptx
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 

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