Update on my single-file VBA audio engine: WAV export, better DSP, BLEP oscillators and Freeverb-style reverb
I posted Riff here earlier and got a lot of really useful feedback, so I wanted to share a follow-up update.
For context, Riff is a single-file VBA audio engine built on WASAPI and Media Foundation. The goal is still the same: no external DLLs, no COM registration, no references, no installer. Just import Riff.bas, call RiffOpen, and play audio directly from VBA.
The first thread helped a lot. A few people pointed out real issues and interesting future directions, so I spent some time cleaning things up and adding some of the missing pieces.
The biggest fixes and additions in this update:
- Fixed the VBA7 vs Win64
LongLongissue in the Media Foundation decoding path - Updated the examples so
RiffOpenis clearly required before playback - Added WAV export for loaded buffers
- Added offline oscillator rendering directly to WAV
- Added biquad-based EQ, low-pass, and high-pass filters
- Added BLEP-style band-limited oscillators to reduce aliasing on square and saw waves
- Reworked the reverb into a Freeverb-style implementation
- Improved validation around buffer handles, loop regions, seeking, and memory-loaded audio
- Updated the README and API reference
The WAV export part was added because someone asked whether Riff could generate audio files instead of only playing audio. That was not available in the first version, but now it is.
Example:
Dim buf As Long
buf = RiffLoad("C:\sounds\sound.mp3")
RiffExportBufferWav buf, "C:\sounds\export.wav"
Oscillator rendering is also possible now:
RiffRenderOscillatorWav 0, 440, 3, "C:\sounds\sine.wav"
RiffRenderOscillatorWav 1, 110, 2, "C:\sounds\square.wav"
RiffRenderOscillatorWav 2, 220, 2, "C:\sounds\saw.wav"
I also experimented with direct vtable calls inside the Media Foundation decoding loop to reduce DispCallFunc overhead, but I reverted that path for now. It was too unstable in VBA and could crash Excel. I would rather keep the engine stable than ship a risky optimization just because it looks clever.
That said, the typelib discussion from the previous thread got me thinking a lot. There is clearly a bigger problem around making lower-level Windows APIs more accessible from VBA, especially for 64-bit Office, without forcing every developer to manually deal with raw pointers, vtable offsets, broken tooling, or incomplete definitions.
So this update is not just “Riff got better audio”. It also made me think that maybe these projects should not live only under my personal profile forever.
Would it make sense to create a small team or organization focused specifically on serious VBA research and tooling? Something dedicated to projects like Riff, low-level Windows API access, audio, networking, typelibs, Office automation internals, and modern experiments around what VBA can still do today?
I am curious if people would find that useful, or if it is better to keep everything as individual projects under my own GitHub.