audio-decode 2.0.0 → 2.0.2

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/audio-decode.js CHANGED
@@ -47,7 +47,8 @@ export const decoders = {
47
47
  return (decoders.opus = async buf => buf && createBuffer(await decoder.decodeFile(buf)))(buf)
48
48
  },
49
49
  async wav(buf) {
50
- let {decode} = await import('node-wav')
50
+ let module = await import('node-wav')
51
+ let { decode } = module.default
51
52
  return (decoders.wav = buf => buf && createBuffer(decode(buf)) )(buf)
52
53
  }
53
54
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "audio-decode",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "Decode audio data in node or browser",
5
5
  "main": "audio-decode.js",
6
6
  "type": "module",
@@ -8,13 +8,13 @@
8
8
  "@wasm-audio-decoders/flac": "^0.1.3",
9
9
  "@wasm-audio-decoders/ogg-vorbis": "^0.0.1",
10
10
  "audio-buffer": "^5.0.0",
11
- "audio-type": "^2.0.0",
11
+ "audio-type": "^2.1.1",
12
12
  "mpg123-decoder": "^0.4.3",
13
13
  "node-wav": "^0.0.2",
14
14
  "ogg-opus-decoder": "^1.5.3"
15
15
  },
16
16
  "devDependencies": {
17
- "audio-lena": "^2.0.0",
17
+ "audio-lena": "^2.2.1",
18
18
  "audio-speaker": "^1.5.0",
19
19
  "tst": "^7.1.1"
20
20
  },
package/test.js CHANGED
@@ -4,6 +4,7 @@ import wav from 'audio-lena/wav.js';
4
4
  import mp3 from 'audio-lena/mp3.js';
5
5
  import ogg from 'audio-lena/ogg.js';
6
6
  import flac from 'audio-lena/flac.js';
7
+ import opus from 'audio-lena/opus.js';
7
8
  import t, { is, throws } from 'tst';
8
9
 
9
10
 
@@ -54,6 +55,20 @@ t('flac buffer', async function (t) {
54
55
  is(audioBuffer.duration | 0, 12, 'flac duration')
55
56
  });
56
57
 
58
+
59
+ t('opus buffer', async function (t) {
60
+ console.time('opus first')
61
+ let audioBuffer = await decode(opus)
62
+ console.timeEnd('opus first')
63
+ is(audioBuffer.duration | 0, 12, 'opus duration')
64
+
65
+ console.time('opus second')
66
+ audioBuffer = await decode(opus)
67
+ console.timeEnd('opus second')
68
+ is(audioBuffer.duration | 0, 12, 'opus duration')
69
+ });
70
+
71
+
57
72
  t('malformed data', async t => {
58
73
  let log = []
59
74
  try {