Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
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
25
HandGestureTool for AppleVisionPro
cova8bitdots
0
68
NinjaGazeTyping 制作秘話
cova8bitdots
0
270
UnityとGoogleCloudFunction を連携して社内サービスを作った話
cova8bitdots
0
130
Unity-chan.Terrastal!!
cova8bitdots
0
300
ExampleOfTilemap2D
cova8bitdots
0
86
unity_lt_2021_Dec.pdf
cova8bitdots
0
730
HowToUseAudioMixer
cova8bitdots
0
110
TrapOfSpriteAtlas
cova8bitdots
0
4.9k
Other Decks in Programming
See All in Programming
【re:Growth 2024】 Aurora DSQL をちゃんと話します!
maroon1st
0
520
Recoilを剥がしている話
kirik
0
420
React + Tauriでデスクトップアプリ開発に入門してみた
ynishimura0922
0
210
As an Engineers, let's build the CRM system via LINE Official Account 2.0
clonn
1
640
型のインスタンス化は非常に深く、無限である可能性があります。
kimitashoichi
0
140
14 Years of iOS: Lessons and Key Points
seyfoyun
1
690
Modular Monolith Monorepo ~シンプルさを保ちながらmonorepoのメリットを最大化する~
yuisakamoto
11
4k
flutterkaigi_2024.pdf
kyoheig3
0
470
Refactor your code - refactor yourself
xosofox
1
170
Arm移行タイムアタック
qnighy
0
410
.NET Conf 2024の振り返り
tomokusaba
0
200
クリエイティブコーディングとRuby学習 / Creative Coding and Learning Ruby
chobishiba
0
3.7k
Featured
See All Featured
KATA
mclloyd
29
14k
Site-Speed That Sticks
csswizardry
1
150
Scaling GitHub
holman
458
140k
It's Worth the Effort
3n
183
27k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
How GitHub (no longer) Works
holman
310
140k
VelocityConf: Rendering Performance Case Studies
addyosmani
326
24k
Designing for humans not robots
tammielis
250
25k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
0
27
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
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.