Slide 1

Slide 1 text

Իྔͷجૅˍ
 ɹɹUNITY্ͰͷԻྔԋग़ UNITYΦʔσΟΦ׬શʹཧղͨ͠

Slide 2

Slide 2 text

͸͡Ίʹ ొஃऀ৘ใ Twitter: @8bitdots ήʔϜͱα΢ϯυେ޷͖UnityΤϯδχΞ
 ʢ≠α΢ϯυΤϯδχΞʣ

Slide 3

Slide 3 text

Իྔͷجૅ Իྔʹ͍ͭͯ < ͜͜ͷSEͪΐͬͱ͏Δ͍͞Ͱ͢Ͷ ͦ͏ͨ͠ΒͱΓ͋͑ͣ3dB ఔԼ͛ͯ΋Β͑·͔͢ʁ> < (AudioSource.volume ͬͯ0.0~1.0 ͳΜ͚ͩͲͳ͊ɻ
 ԿݴͬͯΔΜͩʁ) Έ͍ͨͳ΍ΓͱΓͷܦݧ͸ͳ͍Ͱ͠ΐ͏͔ʁ

Slide 4

Slide 4 text

Իྔͷجૅ Իྔʹ͍ͭͯ ▸ Իڹֶత؍఺ ▸ ʮԻྔʯͱ͍͏ݴ༿͸ͳ͘ʮԻѹʯʮԻͷڧ͞ʯʮԻڹύϫʔʯͳͲͷ
 ෺ཧྔΛఆٛ ▸ Իѹ p[Pa] ͷԻѹϨϕϧ(SoundPressureLevel) Lp [dB]
 
 
 
 p0 ɿج४Իѹ஋(1kHz ͷ࠷খՄௌԻ) = 2.0x10-5[Pa]
 ▸ σδλϧ৴߸ॲཧ
 [0.0 1.0] Ͱਖ਼نԽ͞Ε͍ͯΔͷͰͦͷର਺Λͱͬͯ͋͛Δ
 ˠ[-∞ 0.0] ʹม׵

Slide 5

Slide 5 text

Իྔͷجૅ Իྔʹ͍ͭͯ ▸ Ұൠతʹਓؒͷײ֮ྔ͸
 ෺ཧྔͷର਺ʹ΄΅ൺྫɹɹɹɹɹɹɹ ▸ ਓؒͷײ֮ʹ߹ΘͤͨԻྔ
 ˠϥ΢υωε ౳ϥ΢υωεۂઢ(ISO226:2003)
 ʰԻڹֶೖ໳ʱΑΓҾ༻ ʰԻڹֶೖ໳ʱΑΓҾ༻

Slide 6

Slide 6 text

Իྔͷجૅ ϥ΢υωεͷݱ࣮ ▸ ςϨϏͳͲͷ์ૹۀք
 ຽ์࿈ɿ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ϝʔλ͸͋Δ΋ͷͷ…

Slide 7

Slide 7 text

Իྔͷجૅ ԻׂΕ ▸ ԻྔΛ্͛ΔͱԻׂΕ͢Δ
 ˠԻ͕Ճ޻͞Εͨײ͡ʹฉ͑͜Δ ▸ ݪҼɿ
 Mathf.Clamp( ೾ܗ, -1, 1 ) ͕ߦΘΕΔͨΊ

Slide 8

Slide 8 text

Իྔͷجૅ ԻׂΕ ▸ ݩ೾ܗ
 
 
 
 
 ▸ ԻׂΕ
 
 
 
 
 ݩ೾ܗΛ4ഒʹ૿෯
 ˠ೾ܗαΠζௐ੔
 ˠ0.5 Ҏ্,-0.5ҎԼ͕ਅͬฏΒʹ εϖΫτϥϜ εϖΫτϥϜ ೾ܗ ೾ܗ ԻׂΕ͕ى͖Δˠۣܗ೾Έ͍ͨʹ೾ܗ͕มԽ͍ͯ͠Δ

Slide 9

Slide 9 text

Իྔͷجૅ ԻׂΕ ԻׂΕͰ೾ܗ͕ۣܗ೾ͬΆ͘ͳͬͨ
 ˠۣܗ೾ʹ͍ͭͯߟ͑ͯΈΔ ▸ ϑʔϦΤڃ਺ల։ ▸ ͬ͘͟Γͱͨ͠આ໌ɿ
 पظؔ਺Λsinͱcos ͦΕͧΕͷഒԻΛͲΜͲΜ଍͠߹Θͤͯۙࣅ͢Δදݱ
 ▸ ஸೡͳઆ໌ɿ
 पظTͷؔ਺f(t) Λۮؔ਺ͱحؔ਺ͷ࿨Ͱදݱ εϖΫτϥϜ εϖΫτϥϜ ೾ܗ

Slide 10

Slide 10 text

Իྔͷجૅ ೾ܗͱϑʔϦΤڃ਺ల։ ▸ ۣܗ೾ΛϑʔϦΤڃ਺ల։Λ࢖ͬͯදݱͯ͠ΈΔ
 حؔ਺ͳͷͰۮؔ਺੒෼(an )͸શͯ0
 
 حؔ਺੒෼

Slide 11

Slide 11 text

Իྔͷجૅ ۣܗ೾ΛϑʔϦΤڃ਺ల։Ͱදݱ Sin(t) ͷΈ

Slide 12

Slide 12 text

Իྔͷجૅ ۣܗ೾ΛϑʔϦΤڃ਺ల։Ͱදݱ Sin(3t) ·Ͱͷ࿨

Slide 13

Slide 13 text

Իྔͷجૅ ۣܗ೾ΛϑʔϦΤڃ਺ల։Ͱදݱ Sin(5t) ·Ͱͷ࿨

Slide 14

Slide 14 text

Իྔͷجૅ ۣܗ೾ΛϑʔϦΤڃ਺ల։Ͱදݱ Sin(11t) ·Ͱͷ࿨

Slide 15

Slide 15 text

Իྔͷجૅ ۣܗ೾ΛϑʔϦΤڃ਺ల։Ͱදݱ Sin(21t) ·Ͱͷ࿨

Slide 16

Slide 16 text

Իྔͷجૅ ۣܗ೾ΛϑʔϦΤڃ਺ల։Ͱදݱ Sin(41t) ·Ͱͷ࿨ ͍ͩͿۣܗ೾ʹ͍ۙͮͯ͸͍Δ΋ͷͷ
 ೾͕·ͩݟ͑Δ

Slide 17

Slide 17 text

Իྔͷجૅ ۣܗ೾ΛϑʔϦΤڃ਺ల։Ͱදݱ Sin(101t) ·Ͱͷ࿨ ୺఺͸·ͩߥͿ͍ͬͯΔ͕
 தԝ෇ۙ͸͍ͩͿ೾͕ࡉ͔͘ͳ͖͍ͬͯͯΔ

Slide 18

Slide 18 text

Իྔͷجૅ ۣܗ೾ΛϑʔϦΤڃ਺ల։Ͱදݱ Sin(201t) ·Ͱͷ࿨ ͔ͳΓݟͨ໨΋ۣܗ೾ͬΆ͘ͳ͖͍ͬͯͯΔ

Slide 19

Slide 19 text

Իྔͷجૅ ۣܗ೾ΛϑʔϦΤڃ਺ల։Ͱදݱ ۣܗ೾Λࡾ֯ؔ਺Ͱදݱ͢Δʹ͸ߴ࣍ഒԻͷॏͶ߹Θ͕ͤඞཁ
 https://github.com/Cova8bitdots/FourieSample

Slide 20

Slide 20 text

Իྔͷجૅ ԻׂΕʢ·ͱΊʣ ▸ ۣܗ೾ɿSin೾ͷߴ࣍ഒԻ·ͰͷॏͶ߹ΘͤͰදݱ ▸ ԻׂΕঢ়ଶˠ೾ܗ͕ۣܗ೾νοΫʹՃ޻͞ΕΔ
 ɹɹɹɹɹˠߴ࣍ഒԻ͕উखʹ଍͞Εͯ͠·͏
 ɹɹɹɹɹˠԻ৭͕มΘΔ ▸ ԻΛॏͶͯ໐Β࣌͢͸ؾΛ͚ͭΑ͏

Slide 21

Slide 21 text

UNITY ্ͰͷԻྔԋग़ Իྔʹؔ͢Δԋग़ྫ • ϑΟϧλ/ΤϑΣΫτʹΑΔ੍ޚ • ScriptʹΑΔ੍ޚ

Slide 22

Slide 22 text

UNITY ্ͰͷԻྔԋग़ Իྔʹؔ͢Δԋग़ྫ • ϑΟϧλ/ΤϑΣΫτʹΑΔ੍ޚ • ScriptʹΑΔ੍ޚ

Slide 23

Slide 23 text

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

Slide 24

Slide 24 text

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


Slide 25

Slide 25 text

UNITY ্ͰͷԻྔԋग़ Իྔʹؔ͢Δԋग़ྫ • ϑΟϧλʹΑΔ੍ޚ • ScriptʹΑΔ੍ޚ

Slide 26

Slide 26 text

UNITY ্ͰͷԻྔԋग़ Իྔʹؔ͢Δԋग़ྫ ▸ ScriptʹΑΔ੍ޚ ▸ FadeIn/FadeOut →ίϧʔνϯ ͳΓͰ࣮૷Մೳ ▸ μοΩϯά ▸ Πϯτϩ෇BGM࠶ੜ ▸ ΠϯλϥΫςΟϒϛϡʔδοΫ

Slide 27

Slide 27 text

UNITY ্ͰͷԻྔԋग़ ϑΣʔυ࣮૷ͷςΫχοΫ ▸ Scriptࣗମ͸ඇৗʹ୯७ FadeIn/Out ͦΕͧΕಉ͡ίʔυͰදݱՄೳʢStartͱEndͷઃఆ࣍ୈʣ

Slide 28

Slide 28 text

UNITY ্ͰͷԻྔԋग़ ϑΣʔυ࣮૷ͷςΫχοΫ ▸ ΫϩεϑΣʔυͷ஫ҙ఺ ▸ ϑΣʔυΧʔϒ͕௚ઢͩͱશମͷԻྔ͕Լ͕Δॠ͕ؒੜ·ΕΔ ▸ 
 ▸ ղܾखஈͱͯ͠͸ɺϑΣʔυΧʔϒͱͯ͠ࡾ֯ؔ਺Λ༻͍Δ

Slide 29

Slide 29 text

UNITY ্ͰͷԻྔԋग़ ϑΣʔυ࣮૷ͷςΫχοΫ ▸ ͬ͘͟Γͱͨ͠આ໌ ▸ ೾ͷΤωϧΪʔ͸ઈର஋ͷ2৐ ▸ A(t), B(t) ʹ t, 1-t Λ୅ೖ ▸ ৴߸S1 (t), S2 (t) ͷΤωϧΪʔΛҰఆͱԾఆ
 
 
 ▸ 2৐ͨ͠ͱ͖ʹҰఆˠsin2+cos2 ▸ ࡾ֯ؔ਺ͰϑΣʔυΧʔϒΛදݱͯ͋͛͠Ε͹͍͍ ▸ ৄࡉɿhttps://speakerdeck.com/cova8bitdots/unitydeintarakuteibumiyuzitukuyatutemita

Slide 30

Slide 30 text

UNITY ্ͰͷԻྔԋग़ Իྔʹؔ͢Δԋग़ྫ ▸ ScriptʹΑΔ੍ޚ ▸ FadeIn/FadeOut →ίϧʔνϯ ͳΓͰ࣮૷Մೳ ▸ μοΩϯά
 ԻݯBΛ࠶ੜ͢ΔલʹԻݯAΛFadeͰԻྔམͱ͢ˠԻݯB࠶ੜޙʹԻݯAΛFadeͰݩͷԻྔ΁
 ▸ Πϯτϩ෇BGM࠶ੜ
 ΠϯτϩͷԻݯͷऴΘΓ͔͚ͱϧʔϓ෦෼ΛΫϩεϑΣʔυͰಉظͤͯ͞࠶ੜ
 ▸ ΠϯλϥΫςΟϒϛϡʔδοΫ ▸ ݱࡏͷBGMͷϏʔτʹ߹ΘͤͯΫϩεϑΣʔυΛελʔτͤͯ͋͛͞Δ ▸ ݱࡏͷBGMͷ࠶ੜҐஔΛಉظͯ͠ΫϩεϑΣʔυΛߦ͏

Slide 31

Slide 31 text

಺༰ͷ૯෮श ·ͱΊ ▸ Իྔʹ͍ͭͯ ▸ ର਺Λͱͬͯදݱ[dB] ▸ ײ֮ྔʹΑΓͦ͏ͳΒϥ΢υωε
 ▸ ԻׂΕ ▸ ԻׂΕ͢ΔͱԻ͕࿪Ή ▸ ഒԻ੒෼ʹΑͬͯԻ৭͕มΘΔ ▸ α΢ϯυԋग़ ▸ FadeΛ੍͢Ε͹৭ʑग़དྷΔ ▸ μοΩϯά ▸ Πϯτϩ෇BGM࠶ੜ ▸ ΠϯλϥΫςΟϒϛϡʔδοΫ

Slide 32

Slide 32 text

͓ΘΓʹ એ఻ ▸ ϛυϧ΢ΣΞʹཔΒͳ͍ͰؤுΔα΢ϯυΤϯδϯӶҙ੡࡞த ▸ https://github.com/UnityLibrary/UniSound
 ▸ ػೳ ▸ Πϯτϩ෇͖BGM࠶ੜ ▸ FadeIn/FadeOut/ CrossFade ▸ ΠϕϯτͷϏʔτಉظ ▸ Մมςϯϙ৘ใઃఆ ▸ ಉ࣌ൃԻ੍ޚ ▸ ൃԻ਺੍໿ ▸ ൃԻͷΠϯλʔόϧ੍໿ ▸ ઌண/ޙண༏ઌઃఆ ▸ etc.