Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Unity_VolumeEffect
Search
Cova8bitdots
January 29, 2019
Programming
2
4.2k
Unity_VolumeEffect
Unityオーディオ完全に理解した勉強会での登壇資料です
Cova8bitdots
January 29, 2019
Tweet
Share
More Decks by Cova8bitdots
See All by Cova8bitdots
Latest_Information_of_CICD_for_UnityAppWithAppleVisionPro
cova8bitdots
0
24
HandGestureTool for AppleVisionPro
cova8bitdots
0
64
NinjaGazeTyping 制作秘話
cova8bitdots
0
260
UnityとGoogleCloudFunction を連携して社内サービスを作った話
cova8bitdots
0
120
Unity-chan.Terrastal!!
cova8bitdots
0
290
ExampleOfTilemap2D
cova8bitdots
0
84
unity_lt_2021_Dec.pdf
cova8bitdots
0
720
HowToUseAudioMixer
cova8bitdots
0
110
TrapOfSpriteAtlas
cova8bitdots
0
4.9k
Other Decks in Programming
See All in Programming
Flutterを言い訳にしない!アプリの使い心地改善テクニック5選🔥
kno3a87
1
180
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
190
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
610
Arm移行タイムアタック
qnighy
0
320
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
930
OnlineTestConf: Test Automation Friend or Foe
maaretp
0
110
flutterkaigi_2024.pdf
kyoheig3
0
110
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
170
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
2
350
TypeScriptでライブラリとの依存を限定的にする方法
tutinoko
2
670
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
110
Featured
See All Featured
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
A designer walks into a library…
pauljervisheath
204
24k
GraphQLとの向き合い方2022年版
quramy
43
13k
Into the Great Unknown - MozCon
thekraken
32
1.5k
The Cult of Friendly URLs
andyhume
78
6k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
890
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
506
140k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Adopting Sorbet at Scale
ufuk
73
9.1k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Transcript
Իྔͷجૅˍ ɹɹUNITY্ͰͷԻྔԋग़ UNITYΦʔσΟΦશʹཧղͨ͠
͡Ίʹ ొஃऀใ Twitter: @8bitdots ήʔϜͱαϯυେ͖UnityΤϯδχΞ ʢ≠αϯυΤϯδχΞʣ
Իྔͷجૅ Իྔʹ͍ͭͯ < ͜͜ͷSEͪΐͬͱ͏Δ͍͞Ͱ͢Ͷ ͦ͏ͨ͠ΒͱΓ͋͑ͣ3dB ఔԼ͛ͯΒ͑·͔͢ʁ> < (AudioSource.volume ͬͯ0.0~1.0 ͳΜ͚ͩͲͳ͊ɻ
ԿݴͬͯΔΜͩʁ) Έ͍ͨͳΓͱΓͷܦݧͳ͍Ͱ͠ΐ͏͔ʁ
Իྔͷجૅ Իྔʹ͍ͭͯ ▸ Իڹֶత؍ ▸ ʮԻྔʯͱ͍͏ݴ༿ͳ͘ʮԻѹʯʮԻͷڧ͞ʯʮԻڹύϫʔʯͳͲͷ ཧྔΛఆٛ ▸ Իѹ p[Pa]
ͷԻѹϨϕϧ(SoundPressureLevel) Lp [dB] p0 ɿج४Իѹ(1kHz ͷ࠷খՄௌԻ) = 2.0x10-5[Pa] ▸ σδλϧ৴߸ॲཧ [0.0 1.0] Ͱਖ਼نԽ͞Ε͍ͯΔͷͰͦͷରΛͱͬͯ͋͛Δ ˠ[-∞ 0.0] ʹม
Իྔͷجૅ Իྔʹ͍ͭͯ ▸ Ұൠతʹਓؒͷײ֮ྔ ཧྔͷରʹ΄΅ൺྫɹɹɹɹɹɹɹ ▸ ਓؒͷײ֮ʹ߹ΘͤͨԻྔ ˠϥυωε ϥυωεۂઢ(ISO226:2003) ʰԻڹֶೖʱΑΓҾ༻
ʰԻڹֶೖʱΑΓҾ༻
Իྔͷجૅ ϥυωεͷݱ࣮ ▸ ςϨϏͳͲͷ์ૹۀք ຽ์࿈ɿhttps://j-ba.or.jp/category/t032 ฏۉ: -24LKFS (Loudness K-weight Full
Scale)Ͱ౷Ұ ▸ ήʔϜۀքͰ ▸ ίϯγϡʔϚʔɿ2012ʹCEDECͰηογϣϯ͕͋ͬͨͷͷ… https://www.slideshare.net/IGDAJ_SigAudio/sigaudio1-cedec2012 ▸ ϞόΠϧɿTencent Ͱେମ-16LKFS ఔʹἧ͑ͨͱͷ͜ͱ https://cedil.cesa.or.jp/cedil_sessions/view/1806 ▸ UnityͰ ▸ AudioMixerʹVUϝʔλ͋Δͷͷ…
Իྔͷجૅ ԻׂΕ ▸ ԻྔΛ্͛ΔͱԻׂΕ͢Δ ˠԻ͕Ճ͞Εͨײ͡ʹฉ͑͜Δ ▸ ݪҼɿ Mathf.Clamp( ܗ, -1,
1 ) ͕ߦΘΕΔͨΊ
Իྔͷجૅ ԻׂΕ ▸ ݩܗ ▸ ԻׂΕ
ݩܗΛ4ഒʹ૿෯ ˠܗαΠζௐ ˠ0.5 Ҏ্,-0.5ҎԼ͕ਅͬฏΒʹ εϖΫτϥϜ εϖΫτϥϜ ܗ ܗ ԻׂΕ͕ى͖ΔˠۣܗΈ͍ͨʹܗ͕มԽ͍ͯ͠Δ
Իྔͷجૅ ԻׂΕ ԻׂΕͰܗ͕ۣܗͬΆ͘ͳͬͨ ˠۣܗʹ͍ͭͯߟ͑ͯΈΔ ▸ ϑʔϦΤڃల։ ▸ ͬ͘͟Γͱͨ͠આ໌ɿ पظؔΛsinͱcos ͦΕͧΕͷഒԻΛͲΜͲΜ͠߹Θͤͯۙࣅ͢Δදݱ
▸ ஸೡͳઆ໌ɿ पظTͷؔf(t) ΛۮؔͱحؔͷͰදݱ εϖΫτϥϜ εϖΫτϥϜ ܗ
Իྔͷجૅ ܗͱϑʔϦΤڃల։ ▸ ۣܗΛϑʔϦΤڃల։Λͬͯදݱͯ͠ΈΔ حؔͳͷͰۮؔ(an )શͯ0 حؔ
Իྔͷجૅ ۣܗΛϑʔϦΤڃల։Ͱදݱ Sin(t) ͷΈ
Իྔͷجૅ ۣܗΛϑʔϦΤڃల։Ͱදݱ Sin(3t) ·Ͱͷ
Իྔͷجૅ ۣܗΛϑʔϦΤڃల։Ͱදݱ Sin(5t) ·Ͱͷ
Իྔͷجૅ ۣܗΛϑʔϦΤڃల։Ͱදݱ Sin(11t) ·Ͱͷ
Իྔͷجૅ ۣܗΛϑʔϦΤڃల։Ͱදݱ Sin(21t) ·Ͱͷ
Իྔͷجૅ ۣܗΛϑʔϦΤڃల։Ͱදݱ Sin(41t) ·Ͱͷ ͍ͩͿۣܗʹ͍͍ۙͮͯΔͷͷ ͕·ͩݟ͑Δ
Իྔͷجૅ ۣܗΛϑʔϦΤڃల։Ͱදݱ Sin(101t) ·Ͱͷ ·ͩߥͿ͍ͬͯΔ͕ தԝ͍ۙͩͿ͕ࡉ͔͘ͳ͖͍ͬͯͯΔ
Իྔͷجૅ ۣܗΛϑʔϦΤڃల։Ͱදݱ Sin(201t) ·Ͱͷ ͔ͳΓݟۣͨܗͬΆ͘ͳ͖͍ͬͯͯΔ
Իྔͷجૅ ۣܗΛϑʔϦΤڃల։Ͱදݱ ۣܗΛࡾ֯ؔͰදݱ͢Δʹߴ࣍ഒԻͷॏͶ߹Θ͕ͤඞཁ https://github.com/Cova8bitdots/FourieSample
Իྔͷجૅ ԻׂΕʢ·ͱΊʣ ▸ ۣܗɿSinͷߴ࣍ഒԻ·ͰͷॏͶ߹ΘͤͰදݱ ▸ ԻׂΕঢ়ଶˠܗ͕ۣܗνοΫʹՃ͞ΕΔ ɹɹɹɹɹˠߴ࣍ഒԻ͕উखʹ͞Εͯ͠·͏ ɹɹɹɹɹˠԻ৭͕มΘΔ ▸ ԻΛॏͶͯ໐Β࣌͢ؾΛ͚ͭΑ͏
UNITY ্ͰͷԻྔԋग़ Իྔʹؔ͢Δԋग़ྫ • ϑΟϧλ/ΤϑΣΫτʹΑΔ੍ޚ • ScriptʹΑΔ੍ޚ
UNITY ্ͰͷԻྔԋग़ Իྔʹؔ͢Δԋग़ྫ • ϑΟϧλ/ΤϑΣΫτʹΑΔ੍ޚ • ScriptʹΑΔ੍ޚ
UNITY ্ͰͷԻྔԋग़ Իྔʹؔ͢Δԋग़ྫ ▸ UnityͰ༻ՄೳͳϑΟϧλ ▸ LowPassFilter ߴԻҬΛΧοτɻ ήʔϜͷϙʔζதͳͲʹ༻͞ΕΔ͜ͱ͕ଟ͍ ▸
HighPassFilter ԻҬΛΧοτɻ LPFͱΈ߹ΘͤͯBandPassFilterͱͯ͠ར༻ BPFͳΒதҬͷΈ௨աͰϥδΦͬΆ͍ԋग़ [༻ޠઆ໌] ΧοτΦϑपfc ɿ ύϫʔ͕6dB Լ͢Δͷप Q: ɹQ͕ߴ͍ͱϑϥοτͳ෦͕ଟ͍ ɹ͍ͱ࠷ॳ͔ΒΏͬͨΓͱԼ͢Δ(LPF) ڞৼप όϯυ෯ ʰԻڹֶೖʱΑΓҾ༻
UNITY ্ͰͷԻྔԋग़ Իྔʹؔ͢Δԋग़ྫ ▸ AudioMixerΛͬͯͷදݱ ▸ LowPassEffect ▸ HighPassEffect ▸
FadeIn/FadeOut SnapShotͷΓସ͑ʹΑΓࣗಈͰϑΣʔυ͕͔͔Δ ▸ μοΩϯά ϘΫγϯάͷ͔͕Ήಈ࡞͔Βདྷ͍ͯΔ༻ޠ ଞͷԻ͕໐Δͱ͖ʹࣗʢେBGMʣͷԻྔΛԼ͛໐ΓऴΘΔͱಉ࣌ʹԻྔΛݩʹ͢ԋग़ ▸ αΠυνΣʔϯೖྗʹΑΔμοΩϯά ଞͷԻ(ϕʔεԻ, υϥϜͷΩοΫԻͳͲ)ͷେ͖͞ʹ࿈ಈͯ͠ಈతʹԻྔΛมԽͤ͞Δํ๏
UNITY ্ͰͷԻྔԋग़ Իྔʹؔ͢Δԋग़ྫ • ϑΟϧλʹΑΔ੍ޚ • ScriptʹΑΔ੍ޚ
UNITY ্ͰͷԻྔԋग़ Իྔʹؔ͢Δԋग़ྫ ▸ ScriptʹΑΔ੍ޚ ▸ FadeIn/FadeOut →ίϧʔνϯ ͳΓͰ࣮Մೳ ▸
μοΩϯά ▸ ΠϯτϩBGM࠶ੜ ▸ ΠϯλϥΫςΟϒϛϡʔδοΫ
UNITY ্ͰͷԻྔԋग़ ϑΣʔυ࣮ͷςΫχοΫ ▸ Scriptࣗମඇৗʹ୯७ FadeIn/Out ͦΕͧΕಉ͡ίʔυͰදݱՄೳʢStartͱEndͷઃఆ࣍ୈʣ
UNITY ্ͰͷԻྔԋग़ ϑΣʔυ࣮ͷςΫχοΫ ▸ ΫϩεϑΣʔυͷҙ ▸ ϑΣʔυΧʔϒ͕ઢͩͱશମͷԻྔ͕Լ͕Δॠ͕ؒੜ·ΕΔ ▸ ▸
ղܾखஈͱͯ͠ɺϑΣʔυΧʔϒͱͯ͠ࡾ֯ؔΛ༻͍Δ
UNITY ্ͰͷԻྔԋग़ ϑΣʔυ࣮ͷςΫχοΫ ▸ ͬ͘͟Γͱͨ͠આ໌ ▸ ͷΤωϧΪʔઈରͷ2 ▸ A(t), B(t)
ʹ t, 1-t Λೖ ▸ ৴߸S1 (t), S2 (t) ͷΤωϧΪʔΛҰఆͱԾఆ ▸ 2ͨ͠ͱ͖ʹҰఆˠsin2+cos2 ▸ ࡾ֯ؔͰϑΣʔυΧʔϒΛදݱͯ͋͛͠Ε͍͍ ▸ ৄࡉɿhttps://speakerdeck.com/cova8bitdots/unitydeintarakuteibumiyuzitukuyatutemita
UNITY ্ͰͷԻྔԋग़ Իྔʹؔ͢Δԋग़ྫ ▸ ScriptʹΑΔ੍ޚ ▸ FadeIn/FadeOut →ίϧʔνϯ ͳΓͰ࣮Մೳ ▸
μοΩϯά ԻݯBΛ࠶ੜ͢ΔલʹԻݯAΛFadeͰԻྔམͱ͢ˠԻݯB࠶ੜޙʹԻݯAΛFadeͰݩͷԻྔ ▸ ΠϯτϩBGM࠶ੜ ΠϯτϩͷԻݯͷऴΘΓ͔͚ͱϧʔϓ෦ΛΫϩεϑΣʔυͰಉظͤͯ͞࠶ੜ ▸ ΠϯλϥΫςΟϒϛϡʔδοΫ ▸ ݱࡏͷBGMͷϏʔτʹ߹ΘͤͯΫϩεϑΣʔυΛελʔτͤͯ͋͛͞Δ ▸ ݱࡏͷBGMͷ࠶ੜҐஔΛಉظͯ͠ΫϩεϑΣʔυΛߦ͏
༰ͷ૯෮श ·ͱΊ ▸ Իྔʹ͍ͭͯ ▸ ରΛͱͬͯදݱ[dB] ▸ ײ֮ྔʹΑΓͦ͏ͳΒϥυωε ▸ ԻׂΕ
▸ ԻׂΕ͢ΔͱԻ͕Ή ▸ ഒԻʹΑͬͯԻ৭͕มΘΔ ▸ αϯυԋग़ ▸ FadeΛ੍͢Ε৭ʑग़དྷΔ ▸ μοΩϯά ▸ ΠϯτϩBGM࠶ੜ ▸ ΠϯλϥΫςΟϒϛϡʔδοΫ
͓ΘΓʹ એ ▸ ϛυϧΣΞʹཔΒͳ͍ͰؤுΔαϯυΤϯδϯӶҙ࡞த ▸ https://github.com/UnityLibrary/UniSound ▸ ػೳ ▸ Πϯτϩ͖BGM࠶ੜ
▸ FadeIn/FadeOut/ CrossFade ▸ ΠϕϯτͷϏʔτಉظ ▸ Մมςϯϙใઃఆ ▸ ಉ࣌ൃԻ੍ޚ ▸ ൃԻ੍ ▸ ൃԻͷΠϯλʔόϧ੍ ▸ ઌண/ޙண༏ઌઃఆ ▸ etc.