@rimelabs/sdk 0.1.0-alpha.2 → 0.1.0-alpha.3

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
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.0-alpha.3](https://github.com/rimelabs/rime-sdk/compare/typescript-v0.1.0-alpha.2...typescript-v0.1.0-alpha.3) (2026-09-28)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * match ITU mu-law quantization for negative PCM ([#10](https://github.com/rimelabs/rime-sdk/issues/10)) ([e03dcb3](https://github.com/rimelabs/rime-sdk/commit/e03dcb3424cab5a9b7d6bc9b1c37b3b72540e3a6))
9
+
3
10
  ## [0.1.0-alpha.2](https://github.com/rimelabs/rime-sdk/compare/typescript-v0.1.0-alpha.1...typescript-v0.1.0-alpha.2) (2026-09-28)
4
11
 
5
12
  - Add `model: "mistv3"` for Mist v3 speech, voice discovery, and language discovery.
package/dist/audio.js CHANGED
@@ -20,7 +20,8 @@ const total = raw.reduce((a, b) => a + b, 0);
20
20
  const coefficients = raw.map((x) => x / total);
21
21
  function mulaw(sample) {
22
22
  sample = Math.max(-32768, Math.min(32767, sample));
23
- const sign = sample < 0 ? 128 : 0, magnitude = Math.min(Math.abs(sample), 32635) + 132;
23
+ // G.711 uses one's complement for negative PCM before quantization.
24
+ const sign = sample < 0 ? 128 : 0, magnitude = Math.min(sample < 0 ? ~sample : sample, 32635) + 132;
24
25
  const exponent = Math.max(0, Math.floor(Math.log2(magnitude)) - 7);
25
26
  return ~(sign | (exponent << 4) | ((magnitude >> (exponent + 3)) & 15)) & 255;
26
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rimelabs/sdk",
3
- "version": "0.1.0-alpha.2",
3
+ "version": "0.1.0-alpha.3",
4
4
  "description": "Rime streaming text-to-speech SDK for Node.js",
5
5
  "license": "MIT",
6
6
  "repository": {