System: I'm on a 2019 Intel Core i9 MacBook Pro running macOS 12.5.1 Monterey.
Context: I'm experimenting with a tool (pico8_rom_tool) to translate a subset of PICO-8 music to Rust code for playback in WASM-4.
This test WASM-4 cartridge (zipped .wasm) (source) currently plays the treble part of the first few bars of Ode to Joy, extracted from this PICO-8 cartridge with pico8_rom_tool:

It does not play properly in the currently shipping macOS minifb native runtime for WASM-4. It sounds like the frame timings are very slow, by multiple frames, and as a result, the music is slow, unpredictably timed, and thus almost unrecognizable. This mostly goes away if the runtime's window is clicked at least once, at which point it seems to run at normal speed.
I've captured audio from each of PICO-8, the minifb native runtime without clicking the window, the minifb native runtime with clicking the window, Firefox using the web runtime, and a resurrected glfw build of the native runtime, and visualized them in Audacity:

Here I've zoomed in on the first few notes. (Note that Firefox won't play any audio until the player is clicked, so the first note is missing from that version.)

The minifb native runtime (after clicking) sounds nearly as good as PICO-8. The glfw native runtime is close but accumulates some drift after a few notes. The web runtime in Firefox is worse than either native runtime (note the wider spacing between notes) but recognizable. I've also tried it in Safari, which is not included in the visualization, but sounds roughly equivalent to Firefox.
I have not yet tried this experiment on the native runtime on other platforms. I'll look at Windows after filing this bug.
Summary:
- There's clearly something wrong with the macOS minifb build where it's not running at full speed when the runtime starts. I don't have an idea what's causing this; suggestions are welcome.
- In general, WASM-4 has no mechanism for timing music or sound effects that is independent of counting
update() calls. Music and SFX are extremely sensitive to small delays in frame timing. Adding an elapsed-real-time API independent of update() would improve the developer and user experience for anything related to audio, and probably also in general.
System: I'm on a 2019 Intel Core i9 MacBook Pro running macOS 12.5.1 Monterey.
Context: I'm experimenting with a tool (
pico8_rom_tool) to translate a subset of PICO-8 music to Rust code for playback in WASM-4.This test WASM-4 cartridge (zipped

.wasm) (source) currently plays the treble part of the first few bars of Ode to Joy, extracted from this PICO-8 cartridge withpico8_rom_tool:It does not play properly in the currently shipping macOS minifb native runtime for WASM-4. It sounds like the frame timings are very slow, by multiple frames, and as a result, the music is slow, unpredictably timed, and thus almost unrecognizable. This mostly goes away if the runtime's window is clicked at least once, at which point it seems to run at normal speed.
I've captured audio from each of PICO-8, the minifb native runtime without clicking the window, the minifb native runtime with clicking the window, Firefox using the web runtime, and a resurrected glfw build of the native runtime, and visualized them in Audacity:
Here I've zoomed in on the first few notes. (Note that Firefox won't play any audio until the player is clicked, so the first note is missing from that version.)
The minifb native runtime (after clicking) sounds nearly as good as PICO-8. The glfw native runtime is close but accumulates some drift after a few notes. The web runtime in Firefox is worse than either native runtime (note the wider spacing between notes) but recognizable. I've also tried it in Safari, which is not included in the visualization, but sounds roughly equivalent to Firefox.
I have not yet tried this experiment on the native runtime on other platforms. I'll look at Windows after filing this bug.
Summary:
update()calls. Music and SFX are extremely sensitive to small delays in frame timing. Adding an elapsed-real-time API independent ofupdate()would improve the developer and user experience for anything related to audio, and probably also in general.