Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Unity_VolumeEffect

Cova8bitdots
January 29, 2019

 Unity_VolumeEffect

Unityオーディオ完全に理解した勉強会での登壇資料です

Cova8bitdots

January 29, 2019
Tweet

More Decks by Cova8bitdots

Other Decks in Programming

Transcript

  1. Իྔͷجૅ Իྔʹ͍ͭͯ ▸ Իڹֶత؍఺ ▸ ʮԻྔʯͱ͍͏ݴ༿͸ͳ͘ʮԻѹʯʮԻͷڧ͞ʯʮԻڹύϫʔʯͳͲͷ
 ෺ཧྔΛఆٛ ▸ Իѹ p[Pa]

    ͷԻѹϨϕϧ(SoundPressureLevel) Lp [dB]
 
 
 
 p0 ɿج४Իѹ஋(1kHz ͷ࠷খՄௌԻ) = 2.0x10-5[Pa]
 ▸ σδλϧ৴߸ॲཧ
 [0.0 1.0] Ͱਖ਼نԽ͞Ε͍ͯΔͷͰͦͷର਺Λͱͬͯ͋͛Δ
 ˠ[-∞ 0.0] ʹม׵
  2. Իྔͷجૅ ϥ΢υωεͷݱ࣮ ▸ ςϨϏͳͲͷ์ૹۀք
 ຽ์࿈ɿ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ϝʔλ͸͋Δ΋ͷͷ…
  3. Իྔͷجૅ ԻׂΕ ▸ ݩ೾ܗ
 
 
 
 
 ▸ ԻׂΕ


    
 
 
 
 ݩ೾ܗΛ4ഒʹ૿෯
 ˠ೾ܗαΠζௐ੔
 ˠ0.5 Ҏ্,-0.5ҎԼ͕ਅͬฏΒʹ εϖΫτϥϜ εϖΫτϥϜ ೾ܗ ೾ܗ ԻׂΕ͕ى͖Δˠۣܗ೾Έ͍ͨʹ೾ܗ͕มԽ͍ͯ͠Δ
  4. UNITY ্ͰͷԻྔԋग़ Իྔʹؔ͢Δԋग़ྫ ▸ UnityͰ࢖༻ՄೳͳϑΟϧλ ▸ LowPassFilter
 ߴԻҬΛΧοτɻ
 ήʔϜͷϙʔζதͳͲʹ࢖༻͞ΕΔ͜ͱ͕ଟ͍ ▸

    HighPassFilter
 ௿ԻҬΛΧοτɻ
 LPFͱ૊Έ߹ΘͤͯBandPassFilterͱͯ͠ར༻΋
 BPFͳΒதҬͷΈ௨աͰϥδΦͬΆ͍ԋग़΋ [༻ޠઆ໌] ΧοτΦϑप೾਺fc ɿ ύϫʔ͕6dB ௿Լ͢Δ఺ͷप೾਺ Q஋:
 
 
 ɹQ஋͕ߴ͍ͱϑϥοτͳ෦෼͕ଟ͍
 ɹ௿͍ͱ࠷ॳ͔ΒΏͬͨΓͱ௿Լ͢Δ(LPF) ڞৼप೾਺ όϯυ෯ ʰԻڹֶೖ໳ʱΑΓҾ༻
  5. UNITY ্ͰͷԻྔԋग़ Իྔʹؔ͢Δԋग़ྫ ▸ AudioMixerΛ࢖ͬͯͷදݱ ▸ LowPassEffect
 ▸ HighPassEffect
 ▸

    FadeIn/FadeOut
 SnapShotͷ੾Γସ͑ʹΑΓࣗಈͰϑΣʔυ͕͔͔Δ ▸ μοΩϯά
 ϘΫγϯάͷ͔͕Ήಈ࡞͔Βདྷ͍ͯΔ༻ޠ
 ଞͷԻ͕໐Δͱ͖ʹࣗ਎ʢେ఍͸BGMʣͷԻྔΛԼ͛໐ΓऴΘΔͱಉ࣌ʹԻྔΛݩʹ໭͢ԋग़
 ▸ αΠυνΣʔϯೖྗʹΑΔμοΩϯά
 ଞͷԻ(ϕʔεԻ, υϥϜͷΩοΫԻͳͲ)ͷେ͖͞ʹ࿈ಈͯ͠ಈతʹԻྔΛมԽͤ͞Δํ๏

  6. UNITY ্ͰͷԻྔԋग़ ϑΣʔυ࣮૷ͷςΫχοΫ ▸ ͬ͘͟Γͱͨ͠આ໌ ▸ ೾ͷΤωϧΪʔ͸ઈର஋ͷ2৐ ▸ A(t), B(t)

    ʹ t, 1-t Λ୅ೖ ▸ ৴߸S1 (t), S2 (t) ͷΤωϧΪʔΛҰఆͱԾఆ
 
 
 ▸ 2৐ͨ͠ͱ͖ʹҰఆˠsin2+cos2 ▸ ࡾ֯ؔ਺ͰϑΣʔυΧʔϒΛදݱͯ͋͛͠Ε͹͍͍ ▸ ৄࡉɿhttps://speakerdeck.com/cova8bitdots/unitydeintarakuteibumiyuzitukuyatutemita
  7. UNITY ্ͰͷԻྔԋग़ Իྔʹؔ͢Δԋग़ྫ ▸ ScriptʹΑΔ੍ޚ ▸ FadeIn/FadeOut →ίϧʔνϯ ͳΓͰ࣮૷Մೳ ▸

    μοΩϯά
 ԻݯBΛ࠶ੜ͢ΔલʹԻݯAΛFadeͰԻྔམͱ͢ˠԻݯB࠶ੜޙʹԻݯAΛFadeͰݩͷԻྔ΁
 ▸ Πϯτϩ෇BGM࠶ੜ
 ΠϯτϩͷԻݯͷऴΘΓ͔͚ͱϧʔϓ෦෼ΛΫϩεϑΣʔυͰಉظͤͯ͞࠶ੜ
 ▸ ΠϯλϥΫςΟϒϛϡʔδοΫ ▸ ݱࡏͷBGMͷϏʔτʹ߹ΘͤͯΫϩεϑΣʔυΛελʔτͤͯ͋͛͞Δ ▸ ݱࡏͷBGMͷ࠶ੜҐஔΛಉظͯ͠ΫϩεϑΣʔυΛߦ͏
  8. ಺༰ͷ૯෮श ·ͱΊ ▸ Իྔʹ͍ͭͯ ▸ ର਺Λͱͬͯදݱ[dB] ▸ ײ֮ྔʹΑΓͦ͏ͳΒϥ΢υωε
 ▸ ԻׂΕ

    ▸ ԻׂΕ͢ΔͱԻ͕࿪Ή ▸ ഒԻ੒෼ʹΑͬͯԻ৭͕มΘΔ ▸ α΢ϯυԋग़ ▸ FadeΛ੍͢Ε͹৭ʑग़དྷΔ ▸ μοΩϯά ▸ Πϯτϩ෇BGM࠶ੜ ▸ ΠϯλϥΫςΟϒϛϡʔδοΫ
  9. ͓ΘΓʹ એ఻ ▸ ϛυϧ΢ΣΞʹཔΒͳ͍ͰؤுΔα΢ϯυΤϯδϯӶҙ੡࡞த ▸ https://github.com/UnityLibrary/UniSound
 ▸ ػೳ ▸ Πϯτϩ෇͖BGM࠶ੜ

    ▸ FadeIn/FadeOut/ CrossFade ▸ ΠϕϯτͷϏʔτಉظ ▸ Մมςϯϙ৘ใઃఆ ▸ ಉ࣌ൃԻ੍ޚ ▸ ൃԻ਺੍໿ ▸ ൃԻͷΠϯλʔόϧ੍໿ ▸ ઌண/ޙண༏ઌઃఆ ▸ etc.