Streaming audio to OpenAI in your browser is cool… until you deal with PCM16.

The browser gives you Float32 audio. The API expects PCM16 at 24kHz.

That means:

Float32 → clamp → Int16 → base64 → send to realtime api

If you don’t handle the conversion properly, you’ll hear it right away — crackling, silence, or wrong pitch.

Wrote a quick guide on how to do it correctly: https://l.zfir.dev/6rbGCiN

#PCM16 #WebAudioAPI #OpenAI #OpenAIRealtime #JavaScript

PCM16 encoding for the OpenAI Realtime API — a practical guide

You’re streaming audio from the browser. The API expects PCM16. Here’s what the implementation actually looks like and the things worth knowing before you start. Press enter or click to view image in full size

Understanding Audio Frequency Analysis in JavaScript: A Guide to Using AnalyserNode and getByteFrequencyData

Learn how to analyze audio frequency data in JavaScript using AnalyserNode and getByteFrequencyData. Perfect for building visualizers and VU meters.

Deconstruct - A Blog From the Makers of Pipe

#TIL from building a web audio player (for the mixes):

#Safari's #opus support is still quirky. With a #webm container, playback works but AnalyserNodes won't receive anything to compute frequency data with. With #ogg, `getByteFrequencyData()` works, but the audio element calculates the wrong duration, prob. b/c it always assumes CBR. Also if you build the audio pipeline before the first user interaction in Safari, nothing will get routed to the speakers

But still, the #WebAudioAPI is awesome!

I just released the alpha of Web Audio Studio.

It's a browser-based tool for writing real Web Audio API code and visualizing the runtime graph it produces. You can inspect connections, follow signal flow, and insert analysers to see what's happening between nodes.

Everything runs locally in the browser. No signup. Desktop-only for now.

Would love feedback from anyone working with #WebAudio or #DSP.

https://webaudio.studio

#webaudio #webaudioapi #dsp #webdev #creativecoding

Dittytoy transforme votre navigateur en studio de musique qui se code

https://fed.brid.gy/r/https://korben.info/dittytoy-live-coding-musique-navigateur.html

I've worked out how to output discrete values from an LFO’s continuous wave. I can use these multipliers to fluctuate any prop over time. Pretty endless possibilities. In this case, I'm altering a ratio that controls probability (chance) of playback. #WebAudioAPI

Last installment of my "make a Game Boy emulator" series. I cover audio, memory, and timing this time! https://www.youtube.com/watch?v=Be5v8E21pEQ

One neat consequence of this video is that it got me to actually start learning about #GameBoy audio so I might have a "how game boy audio works" video some day. It also got me to learn about the #WebaudioApi to make the demo waveforms/visualizations

Make a Game Boy Emulator: Audio, Memory, and Timing

YouTube

📝 New blog post: "The Web Audio API: A Cautionary Tale of Ambitious Design and Practical Limitations"

https://rye.dev/blog/web-audio-api-design-philosophy-and-reality/

#WebAudioAPI #webstandards #JavaScript #WebAssembly #APIdesign

The Web Audio API: A Cautionary Tale of Ambitious Design and Practical Limitations

An in-depth analysis of the Web Audio API's design philosophy, adoption challenges, and the gap between its ambitious goals and real-world developer needs.

Cameron Rye
Daniel's deep dive into the Web Audio API attempts to bring retro Gameboy vibes to life, proving that nostalgia is only a square wave away 🎮➡️📈. Who knew that painfully recreating 8-bit sounds could be the pinnacle of modern web development? 👾🔊 Let's all pretend we needed another reason to procrastinate with audio nerdiness! 🎶💻
https://www.danblack.co/blog/variable-duty-cycle-square-wave #WebAudioAPI #RetroGaming #8BitNostalgia #AudioNerd #Procrastination #HackerNews #ngated
Daniel Black

Daniel Black's personal website

Daniel Black

Daniel Black's personal website