DiscoverSyntax - Tasty Web Development Treats876: MIDI & Music in the Browser
876: MIDI & Music in the Browser

876: MIDI & Music in the Browser

Update: 2025-02-12
Share

Digest

This podcast provides a comprehensive introduction to the Web Audio and Web MIDI APIs, focusing on their capabilities beyond basic sound playback and MIDI input. The Web MIDI API is explored in detail, explaining MIDI messages (note on/off, velocity, channels), and demonstrating how to receive and interpret MIDI data from a keyboard using JavaScript and the `webmidi.js` library. The podcast then delves into the Web Audio API, showing how to generate sounds using oscillators, control waveforms, and incorporate audio from various sources, including a demo of recreating phone dial tones. The Media Recorder API is also covered, demonstrating browser-based audio recording. The episode concludes with creative project ideas combining these APIs for interactive and expressive web applications, highlighting the potential for building interactive musical instruments, generative music, and real-time collaborative music applications. The podcast addresses browser limitations, such as the need for user interaction before audio playback, and discusses the differences between the Web Audio and Web MIDI APIs.

Outlines

00:00:00
Introduction to Web Audio and Web MIDI APIs & Exploring the Web MIDI API

This section introduces the Web Audio and Web MIDI APIs, detailing their functionalities beyond basic sound playback and MIDI input. It covers MIDI messages (note on/off, velocity, channels), demonstrating how to receive and interpret MIDI data from a keyboard using JavaScript and the `webmidi.js` library.

00:24:44
Utilizing the Web Audio API

This section focuses on the Web Audio API, explaining sound generation using oscillators, waveform control, and audio source integration. A demo of recreating phone dial tones is included.

00:37:39
Media Recorder API and Project Ideas & Browser Limitations and Creative Applications

This section covers the Media Recorder API for browser-based audio recording and presents creative project ideas combining Web Audio, Web MIDI, and other APIs for interactive web applications. It also addresses browser limitations, such as the need for user interaction before audio playback, and explores creative applications of the APIs.

Keywords

Web Audio API


A JavaScript API for manipulating audio in web browsers, enabling sound generation, processing, and integration with other media.

Web MIDI API


A JavaScript API enabling communication between web apps and MIDI devices, allowing sending and receiving MIDI messages for music creation and interactive control.

MIDI (Musical Instrument Digital Interface)


A protocol for digital communication between musical instruments and computers, transmitting data representing musical notes, velocity, and other parameters.

`webmidi.js`


A JavaScript library simplifying Web MIDI API interaction, handling low-level MIDI message parsing.

JavaScript


The programming language used to interact with the Web Audio and Web MIDI APIs.

Audio Synthesis


The process of generating sounds programmatically, often using oscillators and other audio processing techniques.

Interactive Music Applications


Web applications that allow users to create, manipulate, and interact with music in real-time.

Browser-Based Audio Recording


The ability to record audio directly within a web browser using APIs like the Media Recorder API.

Sampling Rate


The number of samples per second when converting analog audio to digital; higher rates improve quality but increase file size.

Media Recorder API


A JavaScript API enabling audio and video recording directly within a web browser.

Q&A

  • What are the key differences between the Web Audio API and the Web MIDI API?

    The Web Audio API handles raw audio data and manipulation, while the Web MIDI API handles MIDI message transmission (control data, not sound). They often work together; MIDI controls the Web Audio API.

  • How can I use the Web MIDI API to control elements on a webpage?

    Receive MIDI messages via the API and map MIDI note values or control change messages to actions or changes in webpage elements (e.g., changing colors, animating objects).

  • What are some limitations of using the Web MIDI API?

    MIDI messages have limited data size (typically 3 bytes), complex data might require multiple messages, and browser support/device compatibility should be considered.

  • Why is a user interaction (like a click) often required before playing audio in the browser?

    To prevent autoplay annoyances, browsers require a user gesture before allowing audio playback to start.

  • What are some creative applications of the Web Audio and Web MIDI APIs?

    Building interactive musical instruments, creating generative music, controlling visual elements with MIDI, developing custom audio effects, and building real-time collaborative music applications.

Show Notes

Wes and Scott talk about the Web Audio and Web MIDI APIs, diving into how they enable powerful music and sound manipulation in the browser. They explore MIDI messaging, synthesizing audio, creative coding with music, and share hands-on projects, tips, and libraries to get started.

Show Notes Sick Picks Shameless Plugs Hit us up on Socials!

Syntax: X Instagram Tiktok LinkedIn Threads

Wes: X Instagram Tiktok LinkedIn Threads

Scott: X Instagram Tiktok LinkedIn Threads

Randy: X Instagram YouTube Threads

Comments 
00:00
00:00
x

0.5x

0.8x

1.0x

1.25x

1.5x

2.0x

3.0x

Sleep Timer

Off

End of Episode

5 Minutes

10 Minutes

15 Minutes

30 Minutes

45 Minutes

60 Minutes

120 Minutes

876: MIDI & Music in the Browser

876: MIDI & Music in the Browser

Wes Bos & Scott Tolinski - Full Stack JavaScript Web Developers