Skip to content

Commit 1851958

Browse files
committed
Add ASIO audio capture support for professional audio interfaces
- Add electron-asio native module for low-latency ASIO audio capture - Integrate ASIO API into preload.js (isAsioAvailable, getAsioDevices, createAsioStream) - Add demo/asio-waveform.html with waveform/spectrum visualization - Update README with ASIO documentation and JavaScript API examples - Fix electron-builder v26.x linux.desktop schema compatibility - Add npmRebuild: false to fix Node.js 22 compatibility - Add archiver dependency for afterPack hook - Exclude electron-asio-src from builds Windows only feature - requires ASIO driver (ASIO4ALL or native interface driver)
1 parent 34b5c2f commit 1851958

File tree

11 files changed

+2215
-26
lines changed

11 files changed

+2215
-26
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
/node_modules
44
/native-modules/*
55
!/native-modules/window-audio-capture
6+
!/native-modules/electron-asio
7+
/native-modules/electron-asio/build
68
mac.sh
79
/vdoninja

README.md

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,76 @@ Youtube has a built-in automatic ad-skipper added, and for both Youtube, Twitch,
159159
![image](https://user-images.githubusercontent.com/2575698/130308991-4a6e15f2-00e3-453f-a79f-8a874d2a6417.png)
160160
161161
162-
### Audio Output
162+
### ASIO Audio Capture (Windows Only)
163+
164+
Electron Capture now supports **ASIO audio capture** for professional audio interfaces. ASIO (Audio Stream Input/Output) provides ultra-low latency audio capture directly from your audio interface, bypassing the Windows audio mixer.
165+
166+
#### Why ASIO?
167+
168+
- **Ultra-low latency**: ASIO drivers provide latency as low as 1-10ms vs 50-100ms+ for standard Windows audio
169+
- **Professional quality**: Direct bit-perfect audio capture from your interface
170+
- **Multi-channel support**: Capture multiple channels simultaneously from multi-channel interfaces
171+
- **Sample rate flexibility**: Support for professional sample rates (44.1kHz to 192kHz)
172+
173+
#### Requirements
174+
175+
1. **Windows only** - ASIO is a Windows audio standard
176+
2. **ASIO driver installed** - Either:
177+
- Your audio interface's native ASIO driver (Focusrite, Universal Audio, RME, etc.)
178+
- [ASIO4ALL](https://www.asio4all.org/) - Free universal ASIO driver for any audio device
179+
3. **Node integration enabled** - Launch with `--node` flag
180+
181+
#### Usage
182+
183+
```bash
184+
# Launch Electron Capture with node integration
185+
elecap.exe --node --url="file:///path/to/demo/asio-waveform.html"
186+
```
187+
188+
#### JavaScript API
189+
190+
```js
191+
// Check if ASIO is available
192+
if (window.electronApi.isAsioAvailable()) {
193+
// Get list of ASIO devices
194+
const devices = window.electronApi.getAsioDevices();
195+
console.log('ASIO Devices:', devices);
196+
197+
// Create an ASIO audio stream
198+
const stream = window.electronApi.createAsioStream({
199+
deviceIndex: devices[0].index, // First ASIO device
200+
sampleRate: 48000, // Sample rate in Hz
201+
channels: 2, // Number of channels
202+
framesPerBuffer: 256 // Buffer size (lower = less latency)
203+
});
204+
205+
// Listen for audio data
206+
stream.on('data', (audioData) => {
207+
// audioData is a Float32Array of audio samples
208+
console.log('Received', audioData.length, 'samples');
209+
});
210+
211+
stream.on('error', (err) => {
212+
console.error('ASIO Error:', err);
213+
});
214+
215+
// Start capturing
216+
stream.start();
217+
218+
// Stop when done
219+
// stream.stop();
220+
}
221+
```
222+
223+
#### Demo
224+
225+
A waveform visualization demo is included at `demo/asio-waveform.html`. Open it in Electron Capture with:
226+
227+
```bash
228+
elecap.exe --node --url="file:///C:/path/to/electroncapture/demo/asio-waveform.html"
229+
```
230+
231+
### Audio Output
163232

164233
A popular way of outputting audio from the Electron Capture app into OBS is done using a virtual audio cable. Some such cables include:
165234

@@ -586,6 +655,7 @@ window.electronApi.applyPlayoutDelay(rtcRtpReceiver, 30);
586655
| Adaptive scaling control |||| Yes |
587656
| Cursor suppression |||| Optional |
588657
| Extended playout delay |||| Optional |
658+
| ASIO audio capture |||| --node |
589659

590660

591661
### Security considerations

0 commit comments

Comments
 (0)