SlideShare una empresa de Scribd logo
1 de 19
Descargar para leer sin conexión
Web & Sound
Playing with Sound APIs recently introduced to the Web
Overview + Demo
New Sound APIs
◇ Web Audio (http://webaudio.github.io/web-audio-api/)
■ Real-time audio synthesis
○ cf. SuperCollider, Pure Data, Max/MSP
■ SFX (Pan, Delay, Filter, etc)
◇ Web MIDI (http://webaudio.github.io/web-midi-api/)
■ Real-time communication
○ Web ⇄ Musical Instruments
● Synths, DJ and lighting controllers
◇ WebRTC (http://w3c.github.io/webrtc-pc/)
■ Camera & Microphone
Web Audio Demo
◇ Web Audio Playground (http://webaudioplayground.appspot.com/)
■ Straight-forward GUI wrapper
◇ WebPd (https://github.com/sebpiq/WebPd)
■ Pure Data clone
◇ CoffeeCollider (https://github.com/mohayonao/CoffeeCollider)
■ Coffee Script + SuperCollider
◇ T’SS JS edition (https://github.com/toyoshim/tss)
■ Chiptune sound emulation (demo, tsdsp)
MIDI is old, and new
◇ 30th anniversary
◇ MIDI is not only SMF but a protocol
■ SMF: Standard MIDI File
○ Protocol dump file with timestamps
■ Real-time communication - lighting and more
○ 冨田勲×初音ミク「イーハトーヴ」@ YouTube
◇ De facto for music production tools
■ Software Synth in DAW: Audio Unit, VSTi, DXi
■ Hardware: DIN, USB, FireWire, RTP, Bluetooth(*)
○ (*): supported by Yosemite, Windows 10, Android M
Web MIDI Demo
◇ Physical controller for online sound systems
■ Web Audio Synth v2 (http://aikelab.net/websynthv2/)
■ Web FM Synthesizer (http://www.taktech.org/takm/WebFMSynth/)
■ Online DAW: audiotool (http://www.audiotool.com/)
■ Online VJ: MajVj (GGT 2014 demo)
◇ Demo and Productions by YAMAHA
■ Pocket Miku (Product page & Web App)
■ Web Music Platform (toyoshim’s fork)
■ Reface + Soundmondo (Product page)
○ Social to share your sound and music via Web MIDI
WebRTC
◇ microphone
■ getUserMedia({audio:true}, …)
○ Can connect to Web Audio via
createMediaStreamSource()
◇ camera
■ getUserMedia({video: true}... )
○ Can use it as a texture for WebGL
Web Apps be Secure!
◇ Hardware is hard to use securely
■ What happens on WebGL?
○ Need GPU process and GPU command validator
■ Recent APIs to use hardware
○ Permission prompt (infobar/bubble UI)
○ Secure origin, e.g. https or localhost, is mandatory
■ Real P0 issue happened on Web MIDI
○ Microsoft GS Wavetable SW Synth crashes
● on receiving a special valid sequence
● outside Chrome sandbox, inside the driver
How to learn
◇ Web Audio
■ Getting Started with Web Audio API html5rocks
■ Web Audio API Ryoya Kawai
■ Web Audio API 解説 g200kg
◇ Web MIDI
■ Web MIDI API (x-webmidi編) Ryoya Kawai
■ ブラウザで電子楽器を作ってみよう HTML5 Experts
■ 最高に乱暴なWeb MIDI API利用方法 tadfmac
Lesson: Web Audio 1
◇ Simple sine wave
var audio = new AudioContext();
var osc = audio.createOscillator();
osc.frequency.value = 440; // in Hz
osc.connect(audio.destination);
osc.start(0);
Lesson: Web Audio 2
◇ Other nodes
■ Audio source
○ AudioBufferSourceNode (from Audio resources, e.g., mp3, m4a)
○ MediaElementAudioSourceNode (from DOM media object)
○ MediaStreamSource (from microphone via getUserMedia)
○ ScriptProcessorNode (deprecated) => AudioWorkerNodeProcessor (from JS)
○ OscillatorNode (from various kinds of oscillators)
■ Effect
○ GainNode
○ DelayNode
○ (Stereo)PannerNode / AudioListener
○ ConvolverNode (e.g., Vocoder, Reverb, and so on)
○ DynamicsCompressorNode / WaveShaperNode
○ BuquadFilterNode (e.g., LPF, HPF, BPF, and so on)
■ Misc
○ AnalyserNode (FFT)
○ ChannelSplitterNode / ChannelMergerNode (Mixer)
Lesson: Web MIDI 1
◇ Device Query
var promise = navigator.requestMIDIAccess();
promise.then(function(midi) {
for (var input of midi.inputs.values())
console.log(input); // MIDIInput
for (var output of midi.outputs.values())
console.log(output); // MIDIOutput
});
Lesson: Web MIDI 2
◇ MIDIInput
for (var input of midi.inputs.values())
input.onmidimessage = handler;
function handler (e) {
// Single MIDI message in Array.
console.log(e.data);
}
Lesson: Web MIDI 3
◇ MIDIOutput
for (var output of midi.outputs.values()) {
// Send single MIDI message or multiple
// MIDI messages.
output.send([0x90, 0x40, 0x7f]); // Note ON
}
Lesson: Promise
◇ New replacement for callbacks
foo(successCallback, errorCallback);
↓
foo().then(successCallback, errorCallback);
foo().then(bar)
.then(baz)
.catch(qux);
◇ Chaining
Promise.all([foo(),
bar()])
.then(baz, qux);
◇ Wait multiple async functions
Lesson: Maplike
◇ readonly maplike<DOMString, MIDIInput> inputs
◇ readonly maplike<DOMString, MIDIOutput> outputs
◇ keys() … MIDIPort.id is used as an unique key
◇ values() … MIDIInput / MIDIOutput
for (var input of inputs.values()) {
// New syntax for ES6 iterable
}
Lesson: Web MIDI 4
◇ Hotplug
midi.onstatechange = function (e) {
var newport = e.port;
if (newport.state == “connected”)
console.log(newport.name + “ is attached”;
else if (newport.state == “disconnected”)
console.log(newport.name + “ is detached”;
};
Fine ||
References
◇ Slide template
■ from Slides Carnival
○ http://www.slidescarnival.com/imogen-free-
presentation-template/399

Más contenido relacionado

Destacado

【SoftLayer事例】株式会社データテック
【SoftLayer事例】株式会社データテック【SoftLayer事例】株式会社データテック
【SoftLayer事例】株式会社データテック
softlayerjp
 

Destacado (14)

Benefits of yoga
Benefits of yogaBenefits of yoga
Benefits of yoga
 
Strengthening Revenue Cycle Partnerships
Strengthening Revenue Cycle PartnershipsStrengthening Revenue Cycle Partnerships
Strengthening Revenue Cycle Partnerships
 
Post demonetization-auto-sales-will-settle-during-dec
Post demonetization-auto-sales-will-settle-during-decPost demonetization-auto-sales-will-settle-during-dec
Post demonetization-auto-sales-will-settle-during-dec
 
20160120 gpsロガーアプリを作ろう
20160120 gpsロガーアプリを作ろう20160120 gpsロガーアプリを作ろう
20160120 gpsロガーアプリを作ろう
 
150 business-jargon-fixes 0
150 business-jargon-fixes 0150 business-jargon-fixes 0
150 business-jargon-fixes 0
 
2015 Who Went Where Survey Presentation - Jamie Grigsby
2015 Who Went Where Survey Presentation - Jamie Grigsby2015 Who Went Where Survey Presentation - Jamie Grigsby
2015 Who Went Where Survey Presentation - Jamie Grigsby
 
【SoftLayer事例】株式会社データテック
【SoftLayer事例】株式会社データテック【SoftLayer事例】株式会社データテック
【SoftLayer事例】株式会社データテック
 
いよいよ本番(斜め上)活用例から見るWebVRの使いドコロ @JSおじさん
������� ������������ ���������いよいよ本番(斜め上)活用例から見るWebVRの使いドコロ @JSおじさん������� ������������ ���������いよいよ本番(斜め上)活用例から見るWebVRの使いドコロ @JSおじさん
いよいよ本番(斜め上)活用例から見るWebVRの使いドコロ @JSおじさん
 
20160824 isao meetup_vol2
20160824 isao meetup_vol220160824 isao meetup_vol2
20160824 isao meetup_vol2
 
いまからでも遅くない Docker事始め&愉快な仲間達
いまからでも遅くない Docker事始め&愉快な仲間達いまからでも遅くない Docker事始め&愉快な仲間達
いまからでも遅くない Docker事始め&愉快な仲間達
 
OnsenUI + AngularJS + CloudEndpointsで作るSPA 地雷処理の巻
OnsenUI + AngularJS + CloudEndpointsで作るSPA 地雷処理の巻OnsenUI + AngularJS + CloudEndpointsで作るSPA 地雷処理の巻
OnsenUI + AngularJS + CloudEndpointsで作るSPA 地雷処理の巻
 
How To Build A High Performance Lead Generation Website
How To Build A High Performance  Lead Generation WebsiteHow To Build A High Performance  Lead Generation Website
How To Build A High Performance Lead Generation Website
 
Dr. Samad sir_Assignment dehydration_Ok
Dr. Samad sir_Assignment dehydration_OkDr. Samad sir_Assignment dehydration_Ok
Dr. Samad sir_Assignment dehydration_Ok
 
10 Ways to Make Your Lead Generation Website Convert On the First Visit
10 Ways to Make Your Lead Generation Website Convert On the First Visit10 Ways to Make Your Lead Generation Website Convert On the First Visit
10 Ways to Make Your Lead Generation Website Convert On the First Visit
 

Similar a Web &amp; sound

Gracenote API - MusicHackDay
Gracenote API - MusicHackDayGracenote API - MusicHackDay
Gracenote API - MusicHackDay
Oscar Celma
 
MIDI is Staging a Comeback… in Your Browser!
MIDI is Staging a Comeback… in Your Browser!MIDI is Staging a Comeback… in Your Browser!
MIDI is Staging a Comeback… in Your Browser!
FITC
 

Similar a Web &amp; sound (20)

Songbird
SongbirdSongbird
Songbird
 
Making Music on the Web with MIDI Technology - Music China
Making Music on the Web with MIDI Technology - Music ChinaMaking Music on the Web with MIDI Technology - Music China
Making Music on the Web with MIDI Technology - Music China
 
Web MIDI API - the paster, the present, and the future -
Web MIDI API - the paster, the present, and the future -Web MIDI API - the paster, the present, and the future -
Web MIDI API - the paster, the present, and the future -
 
Let's Make Some Noise with Web Audio API
Let's Make Some Noise with Web Audio APILet's Make Some Noise with Web Audio API
Let's Make Some Noise with Web Audio API
 
Linux & Open Source - Alternative Software
Linux & Open Source - Alternative SoftwareLinux & Open Source - Alternative Software
Linux & Open Source - Alternative Software
 
Dronecode: software open source em drones
Dronecode: software open source em dronesDronecode: software open source em drones
Dronecode: software open source em drones
 
VA-API rust-binding (GStreamer Conference 2017)
VA-API rust-binding (GStreamer Conference 2017)VA-API rust-binding (GStreamer Conference 2017)
VA-API rust-binding (GStreamer Conference 2017)
 
Breakout@TPAC 2013 (Entertain Web with Musical Instruments)
Breakout@TPAC 2013 (Entertain Web with Musical Instruments)Breakout@TPAC 2013 (Entertain Web with Musical Instruments)
Breakout@TPAC 2013 (Entertain Web with Musical Instruments)
 
Android taipei 2016 03-21.pptx
Android taipei 2016 03-21.pptxAndroid taipei 2016 03-21.pptx
Android taipei 2016 03-21.pptx
 
WebRTC Reborn SignalConf 2016
WebRTC Reborn SignalConf 2016WebRTC Reborn SignalConf 2016
WebRTC Reborn SignalConf 2016
 
Twilio Signal 2016 WebRTC Reborn
Twilio Signal 2016 WebRTC RebornTwilio Signal 2016 WebRTC Reborn
Twilio Signal 2016 WebRTC Reborn
 
Guitar Effects with the HTML5 Audio API
Guitar Effects with the HTML5 Audio APIGuitar Effects with the HTML5 Audio API
Guitar Effects with the HTML5 Audio API
 
Create fun & immersive audio experiences with web audio
Create fun & immersive audio experiences with web audioCreate fun & immersive audio experiences with web audio
Create fun & immersive audio experiences with web audio
 
Mashup Y! widget
Mashup Y! widgetMashup Y! widget
Mashup Y! widget
 
Push the web with HTML5
Push the web with HTML5Push the web with HTML5
Push the web with HTML5
 
Deep dive into Android’s audio latency problem
Deep dive into Android’s audio latency problemDeep dive into Android’s audio latency problem
Deep dive into Android’s audio latency problem
 
Internet of Things
Internet of ThingsInternet of Things
Internet of Things
 
Gracenote API - MusicHackDay
Gracenote API - MusicHackDayGracenote API - MusicHackDay
Gracenote API - MusicHackDay
 
MIDI is Staging a Comeback… in Your Browser!
MIDI is Staging a Comeback… in Your Browser!MIDI is Staging a Comeback… in Your Browser!
MIDI is Staging a Comeback… in Your Browser!
 
MIDI is Staging a Comeback... In Your Browser!
MIDI is Staging a Comeback... In Your Browser!MIDI is Staging a Comeback... In Your Browser!
MIDI is Staging a Comeback... In Your Browser!
 

Más de Takashi Toyoshima (9)

楽しいロリコン
楽しいロリコン楽しいロリコン
楽しいロリコン
 
第2回html5jゲーム部勉強会 Oh! JavaScript 夢の続きを語ろうよ〜emscriptenの逆襲 - html5編
第2回html5jゲーム部勉強会   Oh! JavaScript 夢の続きを語ろうよ〜emscriptenの逆襲 - html5編第2回html5jゲーム部勉強会   Oh! JavaScript 夢の続きを語ろうよ〜emscriptenの逆襲 - html5編
第2回html5jゲーム部勉強会 Oh! JavaScript 夢の続きを語ろうよ〜emscriptenの逆襲 - html5編
 
z-music.js - AudioProcessorNode can do it
z-music.js - AudioProcessorNode can do itz-music.js - AudioProcessorNode can do it
z-music.js - AudioProcessorNode can do it
 
Oh! java script 夢の続きを語ろうよ〜emscriptenの逆襲
Oh! java script 夢の続きを語ろうよ〜emscriptenの逆襲Oh! java script 夢の続きを語ろうよ〜emscriptenの逆襲
Oh! java script 夢の続きを語ろうよ〜emscriptenの逆襲
 
Audio Context+ at WebAudio.tokyo #1
Audio Context+ at WebAudio.tokyo #1Audio Context+ at WebAudio.tokyo #1
Audio Context+ at WebAudio.tokyo #1
 
Chrome Web MIDI 2015
Chrome Web MIDI 2015Chrome Web MIDI 2015
Chrome Web MIDI 2015
 
子供と使う便利ツール
子供と使う便利ツール子供と使う便利ツール
子供と使う便利ツール
 
Web MIDI API update
Web MIDI API updateWeb MIDI API update
Web MIDI API update
 
USB MIDI - DMX bridge
USB MIDI - DMX bridgeUSB MIDI - DMX bridge
USB MIDI - DMX bridge
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 

Web &amp; sound

  • 1. Web & Sound Playing with Sound APIs recently introduced to the Web
  • 3. New Sound APIs ◇ Web Audio (http://webaudio.github.io/web-audio-api/) ■ Real-time audio synthesis ○ cf. SuperCollider, Pure Data, Max/MSP ■ SFX (Pan, Delay, Filter, etc) ◇ Web MIDI (http://webaudio.github.io/web-midi-api/) ■ Real-time communication ○ Web ⇄ Musical Instruments ● Synths, DJ and lighting controllers ◇ WebRTC (http://w3c.github.io/webrtc-pc/) ■ Camera & Microphone
  • 4. Web Audio Demo ◇ Web Audio Playground (http://webaudioplayground.appspot.com/) ■ Straight-forward GUI wrapper ◇ WebPd (https://github.com/sebpiq/WebPd) ■ Pure Data clone ◇ CoffeeCollider (https://github.com/mohayonao/CoffeeCollider) ■ Coffee Script + SuperCollider ◇ T’SS JS edition (https://github.com/toyoshim/tss) ■ Chiptune sound emulation (demo, tsdsp)
  • 5. MIDI is old, and new ◇ 30th anniversary ◇ MIDI is not only SMF but a protocol ■ SMF: Standard MIDI File ○ Protocol dump file with timestamps ■ Real-time communication - lighting and more ○ 冨田勲×初音ミク「イーハトーヴ」@ YouTube ◇ De facto for music production tools ■ Software Synth in DAW: Audio Unit, VSTi, DXi ■ Hardware: DIN, USB, FireWire, RTP, Bluetooth(*) ○ (*): supported by Yosemite, Windows 10, Android M
  • 6. Web MIDI Demo ◇ Physical controller for online sound systems ■ Web Audio Synth v2 (http://aikelab.net/websynthv2/) ■ Web FM Synthesizer (http://www.taktech.org/takm/WebFMSynth/) ■ Online DAW: audiotool (http://www.audiotool.com/) ■ Online VJ: MajVj (GGT 2014 demo) ◇ Demo and Productions by YAMAHA ■ Pocket Miku (Product page & Web App) ■ Web Music Platform (toyoshim’s fork) ■ Reface + Soundmondo (Product page) ○ Social to share your sound and music via Web MIDI
  • 7. WebRTC ◇ microphone ■ getUserMedia({audio:true}, …) ○ Can connect to Web Audio via createMediaStreamSource() ◇ camera ■ getUserMedia({video: true}... ) ○ Can use it as a texture for WebGL
  • 8. Web Apps be Secure! ◇ Hardware is hard to use securely ■ What happens on WebGL? ○ Need GPU process and GPU command validator ■ Recent APIs to use hardware ○ Permission prompt (infobar/bubble UI) ○ Secure origin, e.g. https or localhost, is mandatory ■ Real P0 issue happened on Web MIDI ○ Microsoft GS Wavetable SW Synth crashes ● on receiving a special valid sequence ● outside Chrome sandbox, inside the driver
  • 9. How to learn ◇ Web Audio ■ Getting Started with Web Audio API html5rocks ■ Web Audio API Ryoya Kawai ■ Web Audio API 解説 g200kg ◇ Web MIDI ■ Web MIDI API (x-webmidi編) Ryoya Kawai ■ ブラウザで電子楽器を作ってみよう HTML5 Experts ■ 最高に乱暴なWeb MIDI API利用方法 tadfmac
  • 10. Lesson: Web Audio 1 ◇ Simple sine wave var audio = new AudioContext(); var osc = audio.createOscillator(); osc.frequency.value = 440; // in Hz osc.connect(audio.destination); osc.start(0);
  • 11. Lesson: Web Audio 2 ◇ Other nodes ■ Audio source ○ AudioBufferSourceNode (from Audio resources, e.g., mp3, m4a) ○ MediaElementAudioSourceNode (from DOM media object) ○ MediaStreamSource (from microphone via getUserMedia) ○ ScriptProcessorNode (deprecated) => AudioWorkerNodeProcessor (from JS) ○ OscillatorNode (from various kinds of oscillators) ■ Effect ○ GainNode ○ DelayNode ○ (Stereo)PannerNode / AudioListener ○ ConvolverNode (e.g., Vocoder, Reverb, and so on) ○ DynamicsCompressorNode / WaveShaperNode ○ BuquadFilterNode (e.g., LPF, HPF, BPF, and so on) ■ Misc ○ AnalyserNode (FFT) ○ ChannelSplitterNode / ChannelMergerNode (Mixer)
  • 12. Lesson: Web MIDI 1 ◇ Device Query var promise = navigator.requestMIDIAccess(); promise.then(function(midi) { for (var input of midi.inputs.values()) console.log(input); // MIDIInput for (var output of midi.outputs.values()) console.log(output); // MIDIOutput });
  • 13. Lesson: Web MIDI 2 ◇ MIDIInput for (var input of midi.inputs.values()) input.onmidimessage = handler; function handler (e) { // Single MIDI message in Array. console.log(e.data); }
  • 14. Lesson: Web MIDI 3 ◇ MIDIOutput for (var output of midi.outputs.values()) { // Send single MIDI message or multiple // MIDI messages. output.send([0x90, 0x40, 0x7f]); // Note ON }
  • 15. Lesson: Promise ◇ New replacement for callbacks foo(successCallback, errorCallback); ↓ foo().then(successCallback, errorCallback); foo().then(bar) .then(baz) .catch(qux); ◇ Chaining Promise.all([foo(), bar()]) .then(baz, qux); ◇ Wait multiple async functions
  • 16. Lesson: Maplike ◇ readonly maplike<DOMString, MIDIInput> inputs ◇ readonly maplike<DOMString, MIDIOutput> outputs ◇ keys() … MIDIPort.id is used as an unique key ◇ values() … MIDIInput / MIDIOutput for (var input of inputs.values()) { // New syntax for ES6 iterable }
  • 17. Lesson: Web MIDI 4 ◇ Hotplug midi.onstatechange = function (e) { var newport = e.port; if (newport.state == “connected”) console.log(newport.name + “ is attached”; else if (newport.state == “disconnected”) console.log(newport.name + “ is detached”; };
  • 19. References ◇ Slide template ■ from Slides Carnival ○ http://www.slidescarnival.com/imogen-free- presentation-template/399