@gjsify/webaudio 0.4.42 → 0.4.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +41 -0
  2. package/package.json +4 -4
package/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # @gjsify/webaudio
2
+
3
+ Web Audio API implementation for GJS backed by GStreamer 1.0. Provides `AudioContext` (with `decodeAudioData` via GStreamer's `decodebin`), `AudioBufferSourceNode`, `GainNode`, `AudioParam`, `AudioBuffer`, and `HTMLAudioElement`. Phase 1 implementation.
4
+
5
+ Part of the [gjsify](https://github.com/gjsify/gjsify) project — Node.js and Web APIs for GJS (GNOME JavaScript).
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ gjsify install @gjsify/webaudio
11
+
12
+ # npm or yarn also work (e.g. adding it to an existing project):
13
+ npm install @gjsify/webaudio
14
+ yarn add @gjsify/webaudio
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ```typescript
20
+ import { AudioContext, AudioBuffer, GainNode } from '@gjsify/webaudio';
21
+
22
+ const ctx = new AudioContext();
23
+
24
+ // Decode audio data fetched from disk or network
25
+ const response = await fetch('/sound.ogg');
26
+ const arrayBuffer = await response.arrayBuffer();
27
+ const audioBuffer = await ctx.decodeAudioData(arrayBuffer);
28
+
29
+ // Play it with a gain node
30
+ const source = ctx.createBufferSource();
31
+ source.buffer = audioBuffer;
32
+ const gain = ctx.createGain();
33
+ gain.gain.value = 0.8;
34
+ source.connect(gain);
35
+ gain.connect(ctx.destination);
36
+ source.start();
37
+ ```
38
+
39
+ ## License
40
+
41
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/webaudio",
3
- "version": "0.4.42",
3
+ "version": "0.4.44",
4
4
  "description": "Web Audio API for GJS using GStreamer as audio backend",
5
5
  "type": "module",
6
6
  "module": "lib/esm/index.js",
@@ -42,7 +42,7 @@
42
42
  "audio-api"
43
43
  ],
44
44
  "dependencies": {
45
- "@gjsify/dom-events": "^0.4.42"
45
+ "@gjsify/dom-events": "^0.4.44"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@girs/gjs": "4.0.4",
@@ -51,8 +51,8 @@
51
51
  "@girs/gstapp-1.0": "1.0.0-4.0.4",
52
52
  "@girs/gstaudio-1.0": "1.0.0-4.0.4",
53
53
  "@girs/gstbase-1.0": "1.0.0-4.0.4",
54
- "@gjsify/cli": "^0.4.42",
55
- "@gjsify/unit": "^0.4.42",
54
+ "@gjsify/cli": "^0.4.44",
55
+ "@gjsify/unit": "^0.4.44",
56
56
  "@types/node": "^25.9.1",
57
57
  "typescript": "^6.0.3"
58
58
  },