🇫🇷 France
Joined: 3/5/2026
Posts: 2
Location: 🇫🇷 France
Hi, I'm currently working on a project to make retro games more accessible for blind players. The idea is to add audio feedback during gameplay using Lua scripts in BizHawk. For example, playing short sounds when the player hits a wall, interacts with objects, or when certain events happen in the game. To do this, I tried triggering a WAV sound from Lua. My first attempt was to launch an external executable that plays the sound. Example: os.execute("D:\\bizhawk\\sounds\\audio.exe D:\\bizhawk\\sounds\\s_wall.wav") However, when the sound triggers, the emulator freezes for about 2–3 seconds before the sound plays and the game resumes. It seems that launching the external process blocks the emulator. I also tried other approaches, like launching the sound through cmd with "start", and even creating a persistent audio executable that stays running and receives commands to play sounds. Unfortunately, I still experienced freezes or unreliable behavior. What I'm looking for is a way to play short sound cues during gameplay without interrupting or freezing the emulator. So my questions are: 1. Is there any built-in way in BizHawk Lua to play audio? 2. Is there a recommended non-blocking method to trigger sounds from Lua? 3. Would writing a BizHawk external tool (C# plugin) be the correct approach for this? This is specifically for accessibility purposes, to help blind players understand what is happening in the game. Any suggestions or ideas would be greatly appreciated. Thanks!
YoshiRulz
Any
Editor, Emulator Coder
Location: 🇦🇺 Sydney, Australia
Joined: 8/30/2020
Posts: 216
Location: 🇦🇺 Sydney, Australia
djblind wrote:
1. Is there any built-in way in BizHawk Lua to play audio?
No. (There is a hack to do it from C# though.)
djblind wrote:
3. Would writing a BizHawk external tool (C# plugin) be the correct approach for this?
It's probably the easier approach, if not better all around.
I contribute to BizHawk as Linux/cross-platform lead, testing and automation lead, and UI designer. This year, I'm experimenting with streaming BizHawk development on Twitch. nope Links to find me elsewhere and to some of my side projects are on my personal site. I will respond on Discord faster than to PMs on this site.
Hey look buddy, I'm an engineer. That means I solve problems. Not problems like "What is software," because that would fall within the purview of your conundrums of philosophy. I solve practical problems. For instance, how am I gonna stop some high-wattage thread-ripping monster of a CPU dead in its tracks? The answer: use code. And if that don't work? Use more code.
Sand
He/Him
Editor, Player (168)
Joined: 6/26/2018
Posts: 239
It's possible to use third-party Lua modules (from, e.g., LuaRocks) from within the BizHawk Lua console. If you can find a module that plays sound in a non-blocking way, it might work for your purpose. (You may have to tinker with package.path / package.cpath, depending on where LuaRocks installs things.) I tried something with the Lua-SDL2 module (luarocks install lua-sdl2):
Language: lua

local SDL = require("SDL") SDL.mixer = require("SDL.mixer") assert(SDL.mixer.openAudio(48000, SDL.audioFormat.S16, 2, 2048)) local beep = assert(SDL.mixer.loadWAV("beep.wav")) assert(beep:playChannel(-1, 0, 0))
However, it doesn't quite work, because BizHawk includes its own copy of libSDL2, which shadows the system libSDL2, and which isn't compiled with support for audio. It gives the error "SDL not built with audio support" in the Lua console. If you can find a module that doesn't conflict with one of BizHawk's included libraries, or if you can find a way to make the Lua script use the system libSDL2 rather than the BizHawk one, it may work. I tried the ao module and it does work, in the sense that it plays audio from within the BizHawk Lua console, but it has the same problem as your os.execute idea, namely that it blocks until the sound is finished playing.