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
Webで音楽を奏でる
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
nishaya
September 04, 2017
Technology
6.3k
0
Share
Webで音楽を奏でる
Reactでパターンシーケンサを作った話
nishaya
September 04, 2017
More Decks by nishaya
See All by nishaya
ブラウザで一緒に音楽をつくる
nishaya
0
2.2k
そのSPA、本当に必要ですか?
nishaya
0
3.5k
ES.next — 20年目のECMAScriptに向けて
nishaya
0
1.3k
Other Decks in Technology
See All in Technology
OpenID Connectによるサービス間連携
takesection
0
140
APIテストとは?
nagix
0
160
AI フレンドリーなエラー監視を TypeScript で実現する
shinyaigeek
2
190
AI-DLCを活用した高品質・安全なAI駆動開発実践 / AI Driven Development
yoshidashingo
1
260
個人の発見を、組織の知恵に 〜生成AI活用を"探索"から"組織の仕組み"へ〜
kintotechdev
2
130
食べログのサーキットブレーカー導入を振り返って
atpons
1
150
関西に縁あるMicrosoft MVPsが語るCopilotの未来
kasada
0
210
Diagnosing performance problems without the guesswork
elenatanasoiu
0
120
Kiro CLI v2.0.0がやってきた!
kentapapa
0
220
Platform Engineering as a Product: Criteria for Improvement and Multi-Tenant Design
kumorn5s
0
400
インフラが苦手でも大丈夫! 紙芝居 Kubernetes -WWGT 10周年編-
aoi1
1
310
ビジュアルプログラミングIoTLT vol.23
1ftseabass
PRO
0
160
Featured
See All Featured
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
220
Leo the Paperboy
mayatellez
7
1.8k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Designing Experiences People Love
moore
143
24k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
370
The Mindset for Success: Future Career Progression
greggifford
PRO
0
340
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
330
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.5k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.5k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2k
Bash Introduction
62gerente
615
210k
Principles of Awesome APIs and How to Build Them.
keavy
128
17k
Transcript
ϒϥβͰԻָΛͰΔ ɹ SpeeeKaigi 2017/08/25 ೋࣾ୩ ߉༎ @nishaya 1
ࣗݾհ • ೋࣾ୩ ߉༎ • GitHub: @nishaya • WebΞϓϦέʔγϣϯΤϯδχΞ •
(ג) Speee ϓϩδΣΫτਪਐࣨ • React2016ʙ 2
લճ·Ͱͷ͋Β͢͡ React/ReduxͰγϯηαΠβʔΛ࡞ͬͨ2 • ԻΛग़͍ͨ͠ͱ͍͏ڧ͍Ϟνϕʔγ ϣϯ • React/Redux৯Θͣݏ͍Λࠀ͢Δ • ࣄલʹ͓͍ͬͯͨ͜ͱͰϓϩδΣ ΫτͰͷ໎͍͕ܰݮ͞Εͨ
2 ReactͰγϯηαΠβʔΛ࡞ͬͨ - Speee DEVELOPER BLOG http://tech.speee.jp/entry/2017/04/06/100000 3
ղܾ͍ͨ͠՝ • ָث͕͚ͳ͍ • Իָཧ͕Θ͔Βͳ͍ • ͍Ζ͍ΖͳԻΛ͍͍ͨ ...͚ͲɺԻָΛͰ͍ͨ 4
Reaktion Multi Track Web Sequencer 5
ָث͕͚ͳ͍ • ָثΛ࡞͍͍͕ͬͨɺ͚ͳ͍ͷͰԻָ͕Ͱ͖ͳ͔ͬͨ • ϒϥβʹࣗಈԋͤ͞Ε͍͍ • ҙͷλΠϛϯάͰԻΛ໐Β͢Έ͕ඞཁ 6
DEMO #1 7
ҙͷλΠϛϯάͰԻΛ໐Β͢ • Ұ൪࠷ॳʹࢥ͍ු͔Ϳͷ setInterval() setTimeout() Ͱϧʔϓ͢Δํ๏ • ਫ਼͕Γͳ͍ •
OscillatorNode.start() AudioBufferSourceNode.start() ʹɺൃԻλΠϛϯάΛε έδϡʔϦϯά͢Δ 8
λΠϛϯά੍ޚͷ • ൃԻλΠϛϯάͷσʔλʮstep = 16Իූ1ͭʯͱ͍͏ ୯ҐͰཧ 9
λΠϛϯά੍ޚͷ • ϧʔϓ͝ͱʹɺݱࡏͷ࣌ࠁ͔Β࣍ʹstepΛ໐Β͢·ͰͷΦϑ ηοτΛࢉग़ t1 • ֤AudioNodeͷ start() ʹઈର࣌ࠁΛ͢ඞཁ͕͋Δͨ Ίɺࢉग़ͨ͠Φϑηοτʹ
AudioContext.currentTime Λ ͨ͠ͷΛൃԻ։࢝λΠϛϯάͱͯ͠εέδϡʔϦϯά͢ Δ t1 ϧʔϓࣗମ setTimeout() Ͱ੍ޚ 10
✅ λΠϛϯά੍ޚ 11
Իָཧ͕Θ͔Βͳ͍ • ԻָΛਅ໘ʹษڧͯ͜͠ͳ͔ͬͨͷͰͲ͏ͬͯۂΛߏ ͨ͠Β͍͍͔Θ͔Βͳ͍ • ੜ͞ΕͨύλʔϯΛΈ߹ΘͤΔํ๏ͳΒ͍͚Δ͔ 12
DEMO #2 13
มԽͷ࿈ʹΑͬͯύλʔϯΛੜ͢Δ • ύλʔϯΛड͚ͯɺ৽͍͠ύλʔϯΛฦ͢ύʔπΛfragment ͱͯ͠ఆٛ • fragmentʹ܁Γฦ͠ɺ֊ஈঢ়ͷมԽɺԻఔͷ্ԼͳͲ͞· ͟·ͳछྨΛ༻ҙ • fragmentΛचͭͳ͗ʹ͢Δ͜ͱͰɺ࠷ॳͷύλʔϯ͔Βେ ͖͘มԽͤ͞Δ͜ͱͰ͖Δ
14
fragmentͷதͰ͍ͬͯΔ͜ͱ transform(steps: Steps): Steps { const newList = steps.list.map((step) =>
{ const note = step.note + this.state.transpose return { ...step, note } }) return { ...steps, list: newList } } 15
✅ ύλʔϯੜ 16
͍Ζ͍ΖͳԻΛ͍͍ͨ • γϯηαΠβʔΛ࡞ͬͨͱ͖oscillatorͱݺΕΔجຊܗ ͔Β͍Ζ͍ΖͳԻ৭Λ࡞͕ͬͨɺγϯηαΠζ͕͍͠Ի(ε τϦϯάͱ͔ɺͱ͔)͍͍ͨ • Իͨ͠Ի͕ͦͷͰ͑ͨΒָͦ͠͏ 17
DEMO #3 18
MediaDevices, MediaRecorderΛ͏ PCʹଓ͞ΕͨϚΠΫΧϝϥΛར༻͢ΔͨΊͷAPI • navigator.mediaDevices.getUserMedia({ audio: true, video: false })
Λݺͼग़͢ͱϚΠΫ༻ͷڐՄΛٻΊΔμ ΠΞϩά͕දࣔ͞ΕΔ 19
MediaDevices, MediaRecorderΛ͏ • Ϣʔβ͕ڐՄ͢ΔͱϚΠΫೖྗ͕ MediaStream ͱͯ͠ಘΒΕ ΔͷͰɺ new MediaRecorder(stream) ΛͬͯԻΛߦ͏
20
Ի৭ͱͯ͠͏ͨΊͷ • ϊʔϚϥΠζͰԻྔΛ࠷దԽ • ಄ग़͠ͱϧʔϓ • Իఔมߋ(υͷ伴൫Λԡͨ͠ΒυͷԻ Ͱ໐ΔΑ͏ʹௐ͢Δ) 21
αϯϓϦϯάσʔλ(flowtype) // @flow export type Sample = { buffer: AudioBuffer,
id: string, name: string, offset: number, loop: boolean, loopStart: number, loopEnd: number, transpose: number, } 22
✅ αϯϓϦϯά 23
https://reaktion.synthesizer.tokyo/ 3 3 FirebaseͰϗεςΟϯάͯ͠·͢ɻূ໌ॻઃఆͯ͘͠Εͯศར 24
·ͱΊ • ࠷ऴతʹѻ͏ཁૉ͕ଟ͘ͳ͕ͬͨɺReactͱFlowtypeʹॿ͚ ΒΕͨ • (Ұൠతʹ)ϒϥβͰΒͳ͍Α͏ͳࣄΛ͢Δͱɺීஈ ͍ͬͯͳ͍APIʹ৮ΕΒΕָ͍ͯ͠ • ͦ͜Ͱಘͨܦݧ͕ϓϩμΫτʹؐݩͰ͖ͨΒૉఢ 25