audiora 1.0.0 → 1.0.1

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.
package/CHANGELOG.md CHANGED
@@ -13,6 +13,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
13
13
 
14
14
  ### Fixed
15
15
 
16
+ ## [1.0.1] - 2026-07-27
17
+
18
+ ### Fixed
19
+
20
+ - Reject image loading when `naturalWidth` is 0 in `waitForImage`, instead of hanging indefinitely.
21
+ - Apply reverb buffer updates after tween completes when `reverb_time` changes.
22
+
23
+ ### Changed
24
+
25
+ - Updated homepage URL in `package.json`.
26
+ - Updated README and API documentation.
27
+
16
28
  ## [1.0.0] - 2026-07-15
17
29
 
18
30
  ### Added
@@ -26,4 +38,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
26
38
  - UI helpers: `FORMAT`, `RANGE_KEYS`, `SELECT_KEYS`, `DEFAULT_PRESET`.
27
39
  - API reference in `docs/API.md`.
28
40
 
41
+ [1.0.1]: https://github.com/whosramoss/audiora/releases/tag/v1.0.1
29
42
  [1.0.0]: https://github.com/whosramoss/audiora/releases/tag/v1.0.0
package/README.md CHANGED
@@ -12,7 +12,7 @@
12
12
  ·
13
13
  <a href="#usage">Usage</a>
14
14
  ·
15
- <a href="#mapping">Mapping</a>
15
+ <a href="https://github.com/whosramoss/audiora/blob/main/docs/API.md">API</a>
16
16
  </p>
17
17
 
18
18
  ## How to install
@@ -23,82 +23,29 @@ npm install audiora
23
23
 
24
24
  ## Usage
25
25
 
26
- Import the instrument, load an image, and either play live or render offline:
26
+ Minimal HTML shell for live playback (two canvases + a play gesture):
27
27
 
28
- ```js
29
- import { Audiora, PRESETS } from "audiora";
28
+ ```html
29
+ <canvas id="map_canvas" width="640" height="360"></canvas>
30
+ <canvas id="wave_canvas" width="640" height="80"></canvas>
31
+ <button id="play">Play</button>
30
32
 
31
- const audiora = new Audiora({
32
- waveCanvas: document.getElementById("wave_canvas"),
33
- mapCanvas: document.getElementById("map_canvas"),
34
- });
33
+ <script type="module">
34
+ import { Audiora, PRESETS } from "audiora";
35
35
 
36
- await audiora.loadImage("/photo.jpg");
37
- audiora.applyParams(PRESETS.Haze, { tween: false });
36
+ const audiora = new Audiora({
37
+ waveCanvas: document.getElementById("wave_canvas"),
38
+ mapCanvas: document.getElementById("map_canvas"),
39
+ });
38
40
 
39
- await audiora.play(); // needs a user gesture in most browsers
41
+ await audiora.loadImage("/photo.jpg");
42
+ audiora.applyParams(PRESETS.Haze, { tween: false });
40
43
 
41
- // offline WAV
42
- const blob = await audiora.toBlob({
43
- params: PRESETS.Bite,
44
- duration: 12,
45
- });
46
- ```
47
-
48
- Importing `audiora` has no side effects — it does not create an `AudioContext` or touch the DOM until you call methods.
49
-
50
- See the **[API reference](https://github.com/whosramoss/audiora/blob/main/docs/API.md)** for constructors, params, presets, scan modes, and TypeScript types.
51
-
52
- ### Live shell (demo)
53
-
54
- The `www/` folder is a Vite app (landing + instrument UI). It is **not** published to npm.
44
+ document.getElementById("play").onclick = () => audiora.play();
55
45
 
56
- ```bash
57
- cd www
58
- npm install
59
- npm run dev
46
+ // offline WAV — no play() needed; renders via OfflineAudioContext
47
+ const blob = await audiora.toBlob({ params: PRESETS.Bite, duration: 12 });
48
+ </script>
60
49
  ```
61
50
 
62
- Open the demo, load an image, tweak presets, and listen. Use `warmUp()` / Play after a click so the browser can resume audio.
63
-
64
- ## Mapping
65
-
66
- Time is shaped by the image: bright areas slightly accelerate the system, darker areas slow it down. Each block is a musical event.
67
-
68
- | Source | Maps to |
69
- | ---------------- | --------------------------------------------------- |
70
- | Hue | Scale degree (pitch), stereo position, micro-detune |
71
- | Lightness | Octave, amplitude, subtle timing / duration |
72
- | Saturation | Velocity weighting |
73
- | Spatial position | Traversal path (`scan_mode`) |
74
-
75
- The goal is coherence of behavior, not literal accuracy of translation. Small parameter changes matter; most adjustments are intentionally subtle.
76
-
77
- Built-in scan modes: `linear`, `vertical`, `zigzag`, `drift`, `spiral`. Timing modes: `expressive`, `stable`.
78
-
79
- ## Presets
80
-
81
- | Name | Role |
82
- | ------------------------ | ----------------------------------------- |
83
- | `Haze` | Default — soft, expressive, higher reverb |
84
- | `Leap` / `Pulse` | Faster, stable phrasing |
85
- | `Bite` / `Spark` / `Raw` | Sharper / drier identities |
86
-
87
- ```js
88
- audiora.applyParams(PRESETS.Haze);
89
- audiora.applyParams(PRESETS.Raw, { tween: false }); // hard cut
90
- ```
91
-
92
- ## TypeScript
93
-
94
- Types ship with the package source entry. No separate `@types` package required.
95
-
96
- ```ts
97
- import { Audiora, type PresetData, type RenderOptions } from "audiora";
98
- ```
99
-
100
- ## Notes
101
-
102
- - First `play()` may show the scan cursor slightly ahead of audio while the context starts; later plays are stable.
103
- - The visual cursor leads audio by a small lookahead window by design.
104
- - At `reverb_mix = 1.0`, stereo pan spread is reduced (fully wet signal) — lower the mix to restore imaging.
51
+ See the **[API reference](https://github.com/whosramoss/audiora/blob/main/docs/API.md)** for constructors, params, presets, scan modes, and TypeScript types.
package/docs/API.md CHANGED
@@ -12,6 +12,8 @@ There are no side-effectful subpaths. Importing `audiora` does not start AudioCo
12
12
 
13
13
  ## `audiora` exports
14
14
 
15
+ Types ship with the package source entry. No separate `@types` package required.
16
+
15
17
  ```ts
16
18
  import {
17
19
  Audiora,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "audiora",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Picture-driven synthesis for the web — maps color and light into pitch, timing, and texture.",
5
5
  "keywords": [
6
6
  "audio",
@@ -29,7 +29,7 @@
29
29
  "type": "git",
30
30
  "url": "git+https://github.com/whosramoss/audiora.git"
31
31
  },
32
- "homepage": "https://github.com/whosramoss/audiora#readme",
32
+ "homepage": "https://audiora.whosramoss.com",
33
33
  "bugs": {
34
34
  "url": "https://github.com/whosramoss/audiora/issues"
35
35
  },
package/src/Audiora.ts CHANGED
@@ -282,6 +282,9 @@ async function resolveImageElement(image: ImageSource): Promise<HTMLImageElement
282
282
 
283
283
  function waitForImage(img: HTMLImageElement): Promise<HTMLImageElement> {
284
284
  if (img.complete && img.naturalWidth > 0) return Promise.resolve(img);
285
+ if (img.complete && img.naturalWidth === 0) {
286
+ return Promise.reject(new Error("Failed to load image"));
287
+ }
285
288
  return new Promise((resolve, reject) => {
286
289
  img.addEventListener("load", () => resolve(img), { once: true });
287
290
  img.addEventListener(
package/src/ui/Tweener.ts CHANGED
@@ -52,7 +52,11 @@ export class Tweener {
52
52
  this.engine.dry!.gain.value = this.engine.dryVal(this.state.reverb_mix);
53
53
  }
54
54
 
55
- if (t < 1) this.raf = requestAnimationFrame(tick);
55
+ if (t < 1) {
56
+ this.raf = requestAnimationFrame(tick);
57
+ } else if (from.reverb_time !== undefined) {
58
+ this.engine.updateReverbBuffer(this.state);
59
+ }
56
60
  };
57
61
 
58
62
  this.raf = requestAnimationFrame(tick);