SlideShare a Scribd company logo
1 of 52
Get on the Audiobus
Chris Adamson • @invalidname
CocoaConf Columbus • September 2013
Slides & code will be posted to the CocoaConf
Glassboard, and announced on my Twitter & app.net
Sunday, September 29, 13
Sunday, September 29, 13
Roadmap
• How audio works on iOS
• What Audiobus is and how it connects apps
• Adopting Audiobus in your audio app
Sunday, September 29, 13
Audio on iOS
• Each app is responsible for its own audio
• No access to audio to/from other apps
• Apps use the Audio Session API to interact
with the system
• See also AVAudioSession in AV
Foundation
Sunday, September 29, 13
Audio Session
• Allows inspection of hardware properties
(sampling rate, hardware latencies) and
negotiation of access to system audio
resources
• Audio “category” declares what your app does
with audio
• This affects things like whether you mix with
other apps’ audio, honor ring/silent, can play
in background, etc.
Sunday, September 29, 13
Audio Categories
• Ambient
• Solo Ambient
• Playback
• Record
• Play and Record
• Audio Processing
• Multi-Route
Sunday, September 29, 13
Audio Engines
• How your app interacts with audio
hardware, i.e., captures or produces sound
• OpenAL (play-out only)
• Audio Queue
• Audio Units
Sunday, September 29, 13
AURemoteIO
AURemoteIO
Bus 0: audio out
Bus 1: audio in
Sunday, September 29, 13
Mixing between apps
AURemoteIO AURemoteIO
Sunday, September 29, 13
Mixing between apps
AURemoteIO AURemoteIO
!
Sunday, September 29, 13
Every App is an Island
• Only awareness of other apps’ audio is
value of
kAudioSessionProperty_OtherAudioIsPlaying
property
• No access to what other apps are playing
audio, how loud it is, etc.
Sunday, September 29, 13
Which means…
• You can’t record audio from one app in
another app
• Production apps can’t specialize; have to
provide everything (instruments, filters/
effects, recording) that you’d ever need
Sunday, September 29, 13
Enter Audiobus
Sunday, September 29, 13
Audiobus
• Standalone app that coordinates inter-app
audio
• Currently on 50% off sale ($4.99)
• Only works with apps that adopt the
Audiobus API
• 300 and counting!
Sunday, September 29, 13
Demo
Sunday, September 29, 13
What Audiobus Is
• Audiobus is an app for users to coordinate
audio across supported apps
• User decides which apps are the
inputs, effects, and outputs
Sunday, September 29, 13
What Audiobus Isn’t
• Audiobus is not a general-purpose system-
level audio capture (like Audio Hijack on
Mac)
• Audiobus cannot get audio from or send
audio to an arbitrary app
• Apps must adopt the Audiobus SDK and
register with the Audiobus website
Sunday, September 29, 13
How the heck does it
even work?
Considering that inter-app communication
is nearly impossible on iOS…
Sunday, September 29, 13
Secret Sauce!
• Audiobus began with MIDI “System Exclusive” (SysEx)
messages, defined as being arbitrary blobs of data
unique to a given MIDI device
• Originally meant for synths to exchange waveforms,
patches or other software/firmware upgrades, etc.
• MIDI messages available to all interested apps via Core
MIDI
• Later switched to Mach Ports, which Core MIDI is
implemented atop
Sunday, September 29, 13
Audiobus Concepts
• Apps take on roles based on their
relationship to Audiobus
• Inputs produce audio
• Outputs receive audio
• Filters receive from inputs and send to
outputs
• Points of connection are called ports
Sunday, September 29, 13
http://developer.audiob.us/doc/index.html
Sunday, September 29, 13
Basic Audiobus
Integration
• Decide if you’re an input, output, or filter
• Decide if you can work with the Remote
IO unit or Audiobus’ port API
• Adopt the Audiobus SDK to connect to
Audiobus at runtime
• Register at audiob.us
Sunday, September 29, 13
An Audiobus
Integration Case Study
Sunday, September 29, 13
Audiobus Web Radio
• Web Radio app developed as in-class
exercise for all-day Core Audio class
• Coming to CocoaConfs Boston & Atlanta
• Uses Audio File Stream to receive packets
of MP3 and play them with Audio Queue
012
Packets
Packets
Packets
Packets
Packets
Packets
Sunday, September 29, 13
LPCM or GTFO
• Audiobus ports and AURemoteIO only
work with uncompressed LPCM audio
• Web radio app is dealing in MP3 or AAC
• Conversion to LPCM happens inside the
Audio Queue
Sunday, September 29, 13
Offline Queues
012
AURemoteIO
Packets
Packets
Packets
Packets
Packets
Packets
AudioQueueOfflineRender()
Sunday, September 29, 13
Libraries
• Download the Audiobus SDK from
developer.audiob.us
• Add libAudiobus.a and the Audiobus
headers to your project
• Add Accelerate,AudioToolbox,
QuartzCore, CoreGraphics, and Security
frameworks to your project
Sunday, September 29, 13
Sunday, September 29, 13
Enable background audio
• Add “audio” to the app’s “Required
Background Modes” if it’s not already
present
• All Audiobus-enabled apps must
participate in backgrounding, since they
must be able to be running when
Audiobus is in foreground
Sunday, September 29, 13
Sunday, September 29, 13
Create a launch URL
scheme
• You must have a URL scheme for your app
that ends in “.audiobus” for Audiobus to be
able to launch you
• Add this to the target’s “URL Types”
Sunday, September 29, 13
Sunday, September 29, 13
Get Audiobus API key
• For apps registered with iTunes Connect,
submit your App Store URL or ID
• For unpublished apps or tinkering, register
for a temporary ID, good for 14 days
• This requires dropping the Info.plist from
your app bundle (not from project!)
Sunday, September 29, 13
Sunday, September 29, 13
Audiobus API Keys
• Audiobus app gets a master list of known
keys from a server every 30 minutes
• For temporary IDs, click the link from the
developer page on the device that you’re using
Audiobus on to register your App ID
• e.g., audiobus-registry://
developer.audiob.us/tempreg?t=0ff37
• The dev page can mail you the link
Sunday, September 29, 13
Sunday, September 29, 13
Set Audiobus-compatible
behaviors
• Audio Session category must be playback
or play-and-record
• Must also set the mix-with-others property
on the audio session
• Often do both these things in the
AppDelegate
Sunday, September 29, 13
UInt32 audioCategory = kAudioSessionCategory_MediaPlayback;
AudioSessionSetProperty(kAudioSessionProperty_AudioCategory,
!! ! ! ! ! ! ! sizeof(audioCategory),
!! ! ! ! ! ! ! &audioCategory);
UInt32 allowMixing = YES;
AudioSessionSetProperty(kAudioSessionProperty_OverrideCategory
MixWithOthers,
! ! ! ! ! ! ! ! ! sizeof (allowMixing),
! ! ! ! ! ! ! ! ! &allowMixing);
Note:Audio Session is deprecated in iOS 7
Modern apps can use the AV Foundation equivalents
Sunday, September 29, 13
SetupYour App’s Audio
System
• Your app’s audio infrastructure needs to be up
and running before you connect to Audiobus
• If you’re going to send audio via the
ABAudioBusAudioUnitWrapper, you’ll need
to initialize your AURemoteIO
• For the web radio app, I send an
NSNotification once the player class starts
playing
Sunday, September 29, 13
Instantiate
ABAudiobusController
• ABAudiobusController is your app’s
connection to Audiobus; probably gets held
as a strong property somewhere
• init method takes the launch URL and your
API key
• Obviously, these must match what you
registered on audiob.us
Sunday, September 29, 13
self.audiobusController = [[ABAudiobusController alloc]
! ! ! ! ! ! initWithAppLaunchURL:
[NSURL URLWithString:@"audiobuswebradio.audiobus://"]
! ! ! ! ! ! apiKey:AUDIOBUS_API_KEY];
Sunday, September 29, 13
Create ABOutputPort
(and Audio Unit wrapper)
• ABOutputPort sends audio to Audiobus
(via ABOutputPortSendAudio() function)
• If you use a RemoteIO unit for your
output, the ABAudiobusAudioUnitWrapper
will make these calls for you
Sunday, September 29, 13
CCFViewController *vc =
(CCFViewController*) self.window.rootViewController;
ABOutputPort *output = [self.audiobusController
! ! ! ! ! ! addOutputPortNamed:@"Audio Output"
! ! ! ! ! ! title:NSLocalizedString(@"Main App Output", @"")];
self.audiobusAudioUnitWrapper = [[ABAudiobusAudioUnitWrapper alloc]
! ! ! ! ! ! initWithAudiobusController:self.audiobusController
! ! ! ! ! ! ! ! audioUnit:vc.player.remoteIOUnit
! ! ! ! ! ! ! ! output:output
! ! ! ! ! ! ! ! input:nil];
Sunday, September 29, 13
Demo
Sunday, September 29, 13
Demo
Sunday, September 29, 13
Ports
• Apps that don’t use the Audio Unit
Wrapper use ports directly instead
• ABOutputPortSendAudio() for senders
(inputs and filters)
• Block-based callback or poll with
ABInputPortReceive() for receivers (filters
and outputs)
Sunday, September 29, 13
Filters & Outputs
• If you produce audio output based on
input, you need to tell the ABInputPort, so
that the signal isn’t doubled in Audiobus.
Sunday, September 29, 13
As for iOS 7…
Sunday, September 29, 13
Sunday, September 29, 13
Sherlocked?
Embrace & Extend!
From: michael@audiob.us
Date: June 19, 2013
Subject: Important Information Regarding Audiobus, iOS 7 and Inter-App
Audio
iOS 7 introduces many new features, including Apple’s own Inter-App
Audio framework which we’re planning to incorporate into Audiobus so you
don’t have to. For details and further discussion, we highly recommend
checking out our thread on the Apple developer forums:
https://devforums.apple.com/thread/191197
Sunday, September 29, 13
Closing Thoughts
• Audiobus is approachable for developers
already working at the Audio Unit level
• Adding Audiobus will get it seen by users
who’ve proven willing to pay for good apps
(we love music app users!)
• Future-proofed for iOS 7
Sunday, September 29, 13
Q&A
Slides & code will be posted to the CocoaConf Glassboard,
and announced on my Twitter & app.net (@invalidname)
Sunday, September 29, 13

More Related Content

More from Chris Adamson

Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)
Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)
Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)Chris Adamson
 
Firebase: Totally Not Parse All Over Again (Unless It Is)
Firebase: Totally Not Parse All Over Again (Unless It Is)Firebase: Totally Not Parse All Over Again (Unless It Is)
Firebase: Totally Not Parse All Over Again (Unless It Is)Chris Adamson
 
Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)
Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)
Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)Chris Adamson
 
Video Killed the Rolex Star (CocoaConf San Jose, November, 2015)
Video Killed the Rolex Star (CocoaConf San Jose, November, 2015)Video Killed the Rolex Star (CocoaConf San Jose, November, 2015)
Video Killed the Rolex Star (CocoaConf San Jose, November, 2015)Chris Adamson
 
Video Killed the Rolex Star (CocoaConf Columbus, July 2015)
Video Killed the Rolex Star (CocoaConf Columbus, July 2015)Video Killed the Rolex Star (CocoaConf Columbus, July 2015)
Video Killed the Rolex Star (CocoaConf Columbus, July 2015)Chris Adamson
 
Revenge of the 80s: Cut/Copy/Paste, Undo/Redo, and More Big Hits (CocoaConf C...
Revenge of the 80s: Cut/Copy/Paste, Undo/Redo, and More Big Hits (CocoaConf C...Revenge of the 80s: Cut/Copy/Paste, Undo/Redo, and More Big Hits (CocoaConf C...
Revenge of the 80s: Cut/Copy/Paste, Undo/Redo, and More Big Hits (CocoaConf C...Chris Adamson
 
Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014
Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014
Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014Chris Adamson
 
Stupid Video Tricks, CocoaConf Seattle 2014
Stupid Video Tricks, CocoaConf Seattle 2014Stupid Video Tricks, CocoaConf Seattle 2014
Stupid Video Tricks, CocoaConf Seattle 2014Chris Adamson
 
Stupid Video Tricks, CocoaConf Las Vegas
Stupid Video Tricks, CocoaConf Las VegasStupid Video Tricks, CocoaConf Las Vegas
Stupid Video Tricks, CocoaConf Las VegasChris Adamson
 
Core Image: The Most Fun API You're Not Using (CocoaConf Columbus 2014)
Core Image: The Most Fun API You're Not Using (CocoaConf Columbus 2014)Core Image: The Most Fun API You're Not Using (CocoaConf Columbus 2014)
Core Image: The Most Fun API You're Not Using (CocoaConf Columbus 2014)Chris Adamson
 
Stupid Video Tricks (CocoaConf DC, March 2014)
Stupid Video Tricks (CocoaConf DC, March 2014)Stupid Video Tricks (CocoaConf DC, March 2014)
Stupid Video Tricks (CocoaConf DC, March 2014)Chris Adamson
 
Introduction to the Roku SDK
Introduction to the Roku SDKIntroduction to the Roku SDK
Introduction to the Roku SDKChris Adamson
 
Get On The Audiobus (CocoaConf Atlanta, November 2013)
Get On The Audiobus (CocoaConf Atlanta, November 2013)Get On The Audiobus (CocoaConf Atlanta, November 2013)
Get On The Audiobus (CocoaConf Atlanta, November 2013)Chris Adamson
 
Get On The Audiobus (CocoaConf Boston, October 2013)
Get On The Audiobus (CocoaConf Boston, October 2013)Get On The Audiobus (CocoaConf Boston, October 2013)
Get On The Audiobus (CocoaConf Boston, October 2013)Chris Adamson
 
Glitch-Free A/V Encoding (CocoaConf Boston, October 2013)
Glitch-Free A/V Encoding (CocoaConf Boston, October 2013)Glitch-Free A/V Encoding (CocoaConf Boston, October 2013)
Glitch-Free A/V Encoding (CocoaConf Boston, October 2013)Chris Adamson
 
iOS Media APIs (MobiDevDay Detroit, May 2013)
iOS Media APIs (MobiDevDay Detroit, May 2013)iOS Media APIs (MobiDevDay Detroit, May 2013)
iOS Media APIs (MobiDevDay Detroit, May 2013)Chris Adamson
 
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
 
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
 
Mobile Movies with HTTP Live Streaming (CocoaConf DC, March 2013)
Mobile Movies with HTTP Live Streaming (CocoaConf DC, March 2013)Mobile Movies with HTTP Live Streaming (CocoaConf DC, March 2013)
Mobile Movies with HTTP Live Streaming (CocoaConf DC, March 2013)Chris Adamson
 

More from Chris Adamson (20)

Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)
Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)
Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)
 
Firebase: Totally Not Parse All Over Again (Unless It Is)
Firebase: Totally Not Parse All Over Again (Unless It Is)Firebase: Totally Not Parse All Over Again (Unless It Is)
Firebase: Totally Not Parse All Over Again (Unless It Is)
 
Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)
Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)
Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)
 
Video Killed the Rolex Star (CocoaConf San Jose, November, 2015)
Video Killed the Rolex Star (CocoaConf San Jose, November, 2015)Video Killed the Rolex Star (CocoaConf San Jose, November, 2015)
Video Killed the Rolex Star (CocoaConf San Jose, November, 2015)
 
Video Killed the Rolex Star (CocoaConf Columbus, July 2015)
Video Killed the Rolex Star (CocoaConf Columbus, July 2015)Video Killed the Rolex Star (CocoaConf Columbus, July 2015)
Video Killed the Rolex Star (CocoaConf Columbus, July 2015)
 
Revenge of the 80s: Cut/Copy/Paste, Undo/Redo, and More Big Hits (CocoaConf C...
Revenge of the 80s: Cut/Copy/Paste, Undo/Redo, and More Big Hits (CocoaConf C...Revenge of the 80s: Cut/Copy/Paste, Undo/Redo, and More Big Hits (CocoaConf C...
Revenge of the 80s: Cut/Copy/Paste, Undo/Redo, and More Big Hits (CocoaConf C...
 
Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014
Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014
Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014
 
Stupid Video Tricks, CocoaConf Seattle 2014
Stupid Video Tricks, CocoaConf Seattle 2014Stupid Video Tricks, CocoaConf Seattle 2014
Stupid Video Tricks, CocoaConf Seattle 2014
 
Stupid Video Tricks, CocoaConf Las Vegas
Stupid Video Tricks, CocoaConf Las VegasStupid Video Tricks, CocoaConf Las Vegas
Stupid Video Tricks, CocoaConf Las Vegas
 
Core Image: The Most Fun API You're Not Using (CocoaConf Columbus 2014)
Core Image: The Most Fun API You're Not Using (CocoaConf Columbus 2014)Core Image: The Most Fun API You're Not Using (CocoaConf Columbus 2014)
Core Image: The Most Fun API You're Not Using (CocoaConf Columbus 2014)
 
Stupid Video Tricks (CocoaConf DC, March 2014)
Stupid Video Tricks (CocoaConf DC, March 2014)Stupid Video Tricks (CocoaConf DC, March 2014)
Stupid Video Tricks (CocoaConf DC, March 2014)
 
Stupid Video Tricks
Stupid Video TricksStupid Video Tricks
Stupid Video Tricks
 
Introduction to the Roku SDK
Introduction to the Roku SDKIntroduction to the Roku SDK
Introduction to the Roku SDK
 
Get On The Audiobus (CocoaConf Atlanta, November 2013)
Get On The Audiobus (CocoaConf Atlanta, November 2013)Get On The Audiobus (CocoaConf Atlanta, November 2013)
Get On The Audiobus (CocoaConf Atlanta, November 2013)
 
Get On The Audiobus (CocoaConf Boston, October 2013)
Get On The Audiobus (CocoaConf Boston, October 2013)Get On The Audiobus (CocoaConf Boston, October 2013)
Get On The Audiobus (CocoaConf Boston, October 2013)
 
Glitch-Free A/V Encoding (CocoaConf Boston, October 2013)
Glitch-Free A/V Encoding (CocoaConf Boston, October 2013)Glitch-Free A/V Encoding (CocoaConf Boston, October 2013)
Glitch-Free A/V Encoding (CocoaConf Boston, October 2013)
 
iOS Media APIs (MobiDevDay Detroit, May 2013)
iOS Media APIs (MobiDevDay Detroit, May 2013)iOS Media APIs (MobiDevDay Detroit, May 2013)
iOS Media APIs (MobiDevDay Detroit, May 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)
Core Audio in iOS 6 (CocoaConf San Jose, April 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)
Core Audio in iOS 6 (CocoaConf DC, March 2013)
 
Mobile Movies with HTTP Live Streaming (CocoaConf DC, March 2013)
Mobile Movies with HTTP Live Streaming (CocoaConf DC, March 2013)Mobile Movies with HTTP Live Streaming (CocoaConf DC, March 2013)
Mobile Movies with HTTP Live Streaming (CocoaConf DC, March 2013)
 

Recently uploaded

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 

Recently uploaded (20)

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 

Get On The Audiobus (CocoaConf Columbus, September 2013)

  • 1. Get on the Audiobus Chris Adamson • @invalidname CocoaConf Columbus • September 2013 Slides & code will be posted to the CocoaConf Glassboard, and announced on my Twitter & app.net Sunday, September 29, 13
  • 3. Roadmap • How audio works on iOS • What Audiobus is and how it connects apps • Adopting Audiobus in your audio app Sunday, September 29, 13
  • 4. Audio on iOS • Each app is responsible for its own audio • No access to audio to/from other apps • Apps use the Audio Session API to interact with the system • See also AVAudioSession in AV Foundation Sunday, September 29, 13
  • 5. Audio Session • Allows inspection of hardware properties (sampling rate, hardware latencies) and negotiation of access to system audio resources • Audio “category” declares what your app does with audio • This affects things like whether you mix with other apps’ audio, honor ring/silent, can play in background, etc. Sunday, September 29, 13
  • 6. Audio Categories • Ambient • Solo Ambient • Playback • Record • Play and Record • Audio Processing • Multi-Route Sunday, September 29, 13
  • 7. Audio Engines • How your app interacts with audio hardware, i.e., captures or produces sound • OpenAL (play-out only) • Audio Queue • Audio Units Sunday, September 29, 13
  • 8. AURemoteIO AURemoteIO Bus 0: audio out Bus 1: audio in Sunday, September 29, 13
  • 9. Mixing between apps AURemoteIO AURemoteIO Sunday, September 29, 13
  • 10. Mixing between apps AURemoteIO AURemoteIO ! Sunday, September 29, 13
  • 11. Every App is an Island • Only awareness of other apps’ audio is value of kAudioSessionProperty_OtherAudioIsPlaying property • No access to what other apps are playing audio, how loud it is, etc. Sunday, September 29, 13
  • 12. Which means… • You can’t record audio from one app in another app • Production apps can’t specialize; have to provide everything (instruments, filters/ effects, recording) that you’d ever need Sunday, September 29, 13
  • 14. Audiobus • Standalone app that coordinates inter-app audio • Currently on 50% off sale ($4.99) • Only works with apps that adopt the Audiobus API • 300 and counting! Sunday, September 29, 13
  • 16. What Audiobus Is • Audiobus is an app for users to coordinate audio across supported apps • User decides which apps are the inputs, effects, and outputs Sunday, September 29, 13
  • 17. What Audiobus Isn’t • Audiobus is not a general-purpose system- level audio capture (like Audio Hijack on Mac) • Audiobus cannot get audio from or send audio to an arbitrary app • Apps must adopt the Audiobus SDK and register with the Audiobus website Sunday, September 29, 13
  • 18. How the heck does it even work? Considering that inter-app communication is nearly impossible on iOS… Sunday, September 29, 13
  • 19. Secret Sauce! • Audiobus began with MIDI “System Exclusive” (SysEx) messages, defined as being arbitrary blobs of data unique to a given MIDI device • Originally meant for synths to exchange waveforms, patches or other software/firmware upgrades, etc. • MIDI messages available to all interested apps via Core MIDI • Later switched to Mach Ports, which Core MIDI is implemented atop Sunday, September 29, 13
  • 20. Audiobus Concepts • Apps take on roles based on their relationship to Audiobus • Inputs produce audio • Outputs receive audio • Filters receive from inputs and send to outputs • Points of connection are called ports Sunday, September 29, 13
  • 22. Basic Audiobus Integration • Decide if you’re an input, output, or filter • Decide if you can work with the Remote IO unit or Audiobus’ port API • Adopt the Audiobus SDK to connect to Audiobus at runtime • Register at audiob.us Sunday, September 29, 13
  • 23. An Audiobus Integration Case Study Sunday, September 29, 13
  • 24. Audiobus Web Radio • Web Radio app developed as in-class exercise for all-day Core Audio class • Coming to CocoaConfs Boston & Atlanta • Uses Audio File Stream to receive packets of MP3 and play them with Audio Queue 012 Packets Packets Packets Packets Packets Packets Sunday, September 29, 13
  • 25. LPCM or GTFO • Audiobus ports and AURemoteIO only work with uncompressed LPCM audio • Web radio app is dealing in MP3 or AAC • Conversion to LPCM happens inside the Audio Queue Sunday, September 29, 13
  • 27. Libraries • Download the Audiobus SDK from developer.audiob.us • Add libAudiobus.a and the Audiobus headers to your project • Add Accelerate,AudioToolbox, QuartzCore, CoreGraphics, and Security frameworks to your project Sunday, September 29, 13
  • 29. Enable background audio • Add “audio” to the app’s “Required Background Modes” if it’s not already present • All Audiobus-enabled apps must participate in backgrounding, since they must be able to be running when Audiobus is in foreground Sunday, September 29, 13
  • 31. Create a launch URL scheme • You must have a URL scheme for your app that ends in “.audiobus” for Audiobus to be able to launch you • Add this to the target’s “URL Types” Sunday, September 29, 13
  • 33. Get Audiobus API key • For apps registered with iTunes Connect, submit your App Store URL or ID • For unpublished apps or tinkering, register for a temporary ID, good for 14 days • This requires dropping the Info.plist from your app bundle (not from project!) Sunday, September 29, 13
  • 35. Audiobus API Keys • Audiobus app gets a master list of known keys from a server every 30 minutes • For temporary IDs, click the link from the developer page on the device that you’re using Audiobus on to register your App ID • e.g., audiobus-registry:// developer.audiob.us/tempreg?t=0ff37 • The dev page can mail you the link Sunday, September 29, 13
  • 37. Set Audiobus-compatible behaviors • Audio Session category must be playback or play-and-record • Must also set the mix-with-others property on the audio session • Often do both these things in the AppDelegate Sunday, September 29, 13
  • 38. UInt32 audioCategory = kAudioSessionCategory_MediaPlayback; AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, !! ! ! ! ! ! ! sizeof(audioCategory), !! ! ! ! ! ! ! &audioCategory); UInt32 allowMixing = YES; AudioSessionSetProperty(kAudioSessionProperty_OverrideCategory MixWithOthers, ! ! ! ! ! ! ! ! ! sizeof (allowMixing), ! ! ! ! ! ! ! ! ! &allowMixing); Note:Audio Session is deprecated in iOS 7 Modern apps can use the AV Foundation equivalents Sunday, September 29, 13
  • 39. SetupYour App’s Audio System • Your app’s audio infrastructure needs to be up and running before you connect to Audiobus • If you’re going to send audio via the ABAudioBusAudioUnitWrapper, you’ll need to initialize your AURemoteIO • For the web radio app, I send an NSNotification once the player class starts playing Sunday, September 29, 13
  • 40. Instantiate ABAudiobusController • ABAudiobusController is your app’s connection to Audiobus; probably gets held as a strong property somewhere • init method takes the launch URL and your API key • Obviously, these must match what you registered on audiob.us Sunday, September 29, 13
  • 41. self.audiobusController = [[ABAudiobusController alloc] ! ! ! ! ! ! initWithAppLaunchURL: [NSURL URLWithString:@"audiobuswebradio.audiobus://"] ! ! ! ! ! ! apiKey:AUDIOBUS_API_KEY]; Sunday, September 29, 13
  • 42. Create ABOutputPort (and Audio Unit wrapper) • ABOutputPort sends audio to Audiobus (via ABOutputPortSendAudio() function) • If you use a RemoteIO unit for your output, the ABAudiobusAudioUnitWrapper will make these calls for you Sunday, September 29, 13
  • 43. CCFViewController *vc = (CCFViewController*) self.window.rootViewController; ABOutputPort *output = [self.audiobusController ! ! ! ! ! ! addOutputPortNamed:@"Audio Output" ! ! ! ! ! ! title:NSLocalizedString(@"Main App Output", @"")]; self.audiobusAudioUnitWrapper = [[ABAudiobusAudioUnitWrapper alloc] ! ! ! ! ! ! initWithAudiobusController:self.audiobusController ! ! ! ! ! ! ! ! audioUnit:vc.player.remoteIOUnit ! ! ! ! ! ! ! ! output:output ! ! ! ! ! ! ! ! input:nil]; Sunday, September 29, 13
  • 46. Ports • Apps that don’t use the Audio Unit Wrapper use ports directly instead • ABOutputPortSendAudio() for senders (inputs and filters) • Block-based callback or poll with ABInputPortReceive() for receivers (filters and outputs) Sunday, September 29, 13
  • 47. Filters & Outputs • If you produce audio output based on input, you need to tell the ABInputPort, so that the signal isn’t doubled in Audiobus. Sunday, September 29, 13
  • 48. As for iOS 7… Sunday, September 29, 13
  • 50. Sherlocked? Embrace & Extend! From: michael@audiob.us Date: June 19, 2013 Subject: Important Information Regarding Audiobus, iOS 7 and Inter-App Audio iOS 7 introduces many new features, including Apple’s own Inter-App Audio framework which we’re planning to incorporate into Audiobus so you don’t have to. For details and further discussion, we highly recommend checking out our thread on the Apple developer forums: https://devforums.apple.com/thread/191197 Sunday, September 29, 13
  • 51. Closing Thoughts • Audiobus is approachable for developers already working at the Audio Unit level • Adding Audiobus will get it seen by users who’ve proven willing to pay for good apps (we love music app users!) • Future-proofed for iOS 7 Sunday, September 29, 13
  • 52. Q&A Slides & code will be posted to the CocoaConf Glassboard, and announced on my Twitter & app.net (@invalidname) Sunday, September 29, 13