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
28
HandGestureTool for AppleVisionPro
cova8bitdots
0
71
NinjaGazeTyping 制作秘話
cova8bitdots
0
270
UnityとGoogleCloudFunction を連携して社内サービスを作った話
cova8bitdots
0
130
Unity-chan.Terrastal!!
cova8bitdots
0
310
ExampleOfTilemap2D
cova8bitdots
0
89
unity_lt_2021_Dec.pdf
cova8bitdots
0
740
HowToUseAudioMixer
cova8bitdots
0
110
TrapOfSpriteAtlas
cova8bitdots
0
4.9k
Other Decks in Programming
See All in Programming
ソフトウェアの振る舞いに着目し 複雑な要件の開発に立ち向かう
rickyban
0
890
モバイルアプリにおける自動テストの導入戦略
ostk0069
0
110
Symfony Mapper Component
soyuka
2
730
フロントエンドのディレクトリ構成どうしてる? Feature-Sliced Design 導入体験談
osakatechlab
8
4.1k
testcontainers のススメ
sgash708
1
120
Haze - Real time background blurring
chrisbanes
1
510
Асинхронность неизбежна: как мы проектировали сервис уведомлений
lamodatech
0
730
Semantic Kernelのネイティブプラグインで知識拡張をしてみる
tomokusaba
0
180
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
120
ドメインイベント増えすぎ問題
h0r15h0
1
270
たのしいparse.y
ydah
3
120
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
720
Featured
See All Featured
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
2
290
Git: the NoSQL Database
bkeepers
PRO
427
64k
Building a Scalable Design System with Sketch
lauravandoore
460
33k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
We Have a Design System, Now What?
morganepeng
51
7.3k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
520
Statistics for Hackers
jakevdp
796
220k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
48
2.2k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.3k
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.