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
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
250
flutterkaigi_2024.pdf
kyoheig3
0
150
Quine, Polyglot, 良いコード
qnighy
4
650
OnlineTestConf: Test Automation Friend or Foe
maaretp
0
110
Realtime API 入門
riofujimon
0
150
Generative AI Use Cases JP (略称:GenU)奮闘記
hideg
1
300
Figma Dev Modeで変わる!Flutterの開発体験
watanave
0
140
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
170
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
220
CSC509 Lecture 09
javiergs
PRO
0
140
macOS でできる リアルタイム動画像処理
biacco42
9
2.4k
Enabling DevOps and Team Topologies Through Architecture: Architecting for Fast Flow
cer
PRO
0
340
Featured
See All Featured
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
The Cost Of JavaScript in 2023
addyosmani
45
6.8k
Faster Mobile Websites
deanohume
305
30k
Code Review Best Practice
trishagee
64
17k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
Designing Experiences People Love
moore
138
23k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
Making Projects Easy
brettharned
115
5.9k
Adopting Sorbet at Scale
ufuk
73
9.1k
Designing for humans not robots
tammielis
250
25k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
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.