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
21
HandGestureTool for AppleVisionPro
cova8bitdots
0
55
NinjaGazeTyping 制作秘話
cova8bitdots
0
260
UnityとGoogleCloudFunction を連携して社内サービスを作った話
cova8bitdots
0
120
Unity-chan.Terrastal!!
cova8bitdots
0
290
ExampleOfTilemap2D
cova8bitdots
0
83
unity_lt_2021_Dec.pdf
cova8bitdots
0
710
HowToUseAudioMixer
cova8bitdots
0
100
TrapOfSpriteAtlas
cova8bitdots
0
4.8k
Other Decks in Programming
See All in Programming
Amazon Neptuneで始めてみるグラフDB-OpenSearchによるグラフの全文検索-
satoshi256kbyte
4
330
cXML という電子商取引の トランザクションを支える プロトコルと向きあっている話
phigasui
3
2.3k
僕がつくった48個のWebサービス達
yusukebe
18
17k
Vue3の一歩踏み込んだパフォーマンスチューニング2024
hal_spidernight
3
3.1k
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
7
2.8k
Macとオーディオ再生 2024/11/02
yusukeito
0
210
C#/.NETのこれまでのふりかえり
tomokusaba
1
160
/←このスケジュール表に立ち向かう フロントエンド開発戦略 / A front-end development strategy to tackle a single-slash schedule.
nrslib
1
590
【Kaigi on Rails 2024】YOUTRUST スポンサーLT
krpk1900
1
250
Modern Angular: Renovation for Your Applications
manfredsteyer
PRO
0
210
Vue.js学習の振り返り
hiro_xre
2
130
Server Driven Compose With Firebase
skydoves
0
400
Featured
See All Featured
Measuring & Analyzing Core Web Vitals
bluesmoon
1
41
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.2k
Code Reviewing Like a Champion
maltzj
519
39k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
32
1.8k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
107
49k
Designing the Hi-DPI Web
ddemaree
280
34k
Building Better People: How to give real-time feedback that sticks.
wjessup
363
19k
Automating Front-end Workflow
addyosmani
1365
200k
The Art of Programming - Codeland 2020
erikaheidi
51
13k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
3
370
GraphQLとの向き合い方2022年版
quramy
43
13k
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.