LoginSignup
14
11

More than 5 years have passed since last update.

AVFoundation 3Dオーディオメモ

Last updated at Posted at 2016-08-14

AVAudioEnvironmentNode

AVAudioEnvironmentNode(環境ノード)は3Dオーディオ環境をシミュレートするミキサーノードで、AVAudioPlayerNode などの AVAudioMixing プロトコルに準拠するノードをソースとして接続することができる。AVAudio3DMixing プロトコルに準拠しているが、これは現在は AVAudioEnvironmentNode のみで実装されている。


WWDC15 507 What's New in Core Audioより

環境ノードは暗黙の「リスナー」を持っていて、リスナーの位置と方向を制御することにより、ユーザーは仮想世界にいるような体験をすることができる。また環境を特徴づける補助的な距離減衰(障害物など)や残響(リバーブ)のプロパティを定義することもできる。

環境ノードは現在は2チャンネル以上のフォーマットの合成をサポートしていない。ある入力がステレオの場合はそのオーディオは空間化されずにそのまま通される(ステレオには何も効果がない)。なのでモノラルの入力を接続して空間化しなければならない。


WWDC15 507 What's New in Core Audioより

有効なレンダリングアルゴリズムは AVAudioEnvironmentNode のapplicableRenderingAlgorithms メソッドで取得可能。

AVAudio3DMixingRenderingAlgorithm

定義されているオーディオレンダリングアルゴリズムの種類。入力ノードに対して renderingAlgorithm を設定する。

.EqualPowerPanning

デフォルトのレンダリングアルゴリズム。
最も単純なパンニング(左右に動かす)アルゴリズムで、ステレオフィールドにミキサーバスのデータをパンする。

.StereoPassThrough

モノラル/ステレオ入力を直接ミキサーに渡す。3D レンダリングを無効にする。

.SoundField

マルチチャンネル(サラウンド)へレンダリングするためのアルゴリズム。

.SphericalHead

シンプルなバイノーラル合成アルゴリズム。HRTF よりも CPU を使わない。

.HRTF

頭部伝達関数 (Head Related Transfer Function) を利用した高品質なバイノーラル合成アルゴリズム。ヘッドホンで3次元空間をエミュレートする。SphericalHead よりも CPU を消費する。

オーディオの空間化

空間化のためにソースオーディオの位置を設定する。position では AVAudioMake3DPoint で3次元空間内の位置を指定できる。障害物の設定には obstruction, occlusion を使用する。


WWDC15 507 What's New in Core Audioより


WWDC14 502 AVAudioEngine in practiceより


WWDC14 502 AVAudioEngine in practiceより


WWDC14 502 AVAudioEngine in practiceより

環境ノードのリスナーの位置と方向を設定して、オーディオの聞こえ方を制御する。
listenerPosition は AVAudioMake3DPoint で3次元空間内の位置を、listenerAngularOrientation は、yaw, pitch, roll の3要素で角度を指定する。


WWDC14 502 AVAudioEngine in practiceより

補足:yaw, pitch, roll


https://ja.wikipedia.org/wiki/ローリング

yaw … 船体の左右の向き
pitch … 船体の上下の向き
roll … 船体の前後を軸とした回転

資料

リファレンス

AVAudio3DMixing
https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudio3DMixing_Protocol/

AVAudioEnvironmentNode
https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudioEnvironmentNode_Class/index.html

参考になる WWDC セッション

実装例など

AVAudioEngine 3D Audio Example
https://developer.apple.com/library/mac/samplecode/AVAEGamingExample/Introduction/Intro.html

Details on using the AVAudioEngine
http://stackoverflow.com/questions/33155925/details-on-using-the-avaudioengine

iOS 3D Audio Test
https://github.com/lazerwalker/ios-3d-audio-test

How to set an AVAudio3DMixingRenderingAlgorithm for binaural mixing
http://stackoverflow.com/questions/33941606/how-to-set-an-avaudio3dmixingrenderingalgorithm-for-binaural-mixing

14
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
11