Skip to content

Commit 3c19e93

Browse files
authored
Update readme.md
1 parent a8af42b commit 3c19e93

1 file changed

Lines changed: 23 additions & 22 deletions

File tree

‎readme.md‎

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -42,28 +42,6 @@ let fromFile = await decode(fileInput.files[0]) // File
4242
let fromUrl = await decode(await fetch(url)) // Response
4343
```
4444

45-
### Synchronous codecs
46-
47-
The umbrella remains async for detection, lazy imports, and `Blob`/`Response` inputs.
48-
Import a codec package directly for synchronous calls.
49-
50-
`wav`, `qoa`, `aiff`, and `caf` are synchronous:
51-
52-
```js
53-
import decode from '@audio/decode-wav'
54-
let pcm = decode(wavBytes)
55-
```
56-
57-
WASM codecs initialize asynchronously, then decode synchronously:
58-
59-
```js
60-
import { decoder } from '@audio/decode-flac'
61-
let dec = await decoder()
62-
let pcm = dec.decode(bytes)
63-
let tail = dec.flush()
64-
dec.free()
65-
```
66-
6745
### Chunked
6846

6947
```js
@@ -100,6 +78,29 @@ Works from a CDN without a bundler. Codecs load on demand via dynamic import, on
10078

10179
For self-hosting, use an import map to point `@audio/decode` and each needed `@audio/decode-*` package to local files. Codec-internal files load by relative path.
10280

81+
82+
### Synchronous codecs
83+
84+
The umbrella remains async for detection, lazy imports, and `Blob`/`Response` inputs.
85+
Import a codec package directly for synchronous calls.
86+
87+
`wav`, `qoa`, `aiff`, and `caf` are synchronous:
88+
89+
```js
90+
import decode from '@audio/decode-wav'
91+
let pcm = decode(wavBytes)
92+
```
93+
94+
WASM codecs initialize asynchronously, then decode synchronously:
95+
96+
```js
97+
import { decoder } from '@audio/decode-flac'
98+
let dec = await decoder()
99+
let pcm = dec.decode(bytes)
100+
let tail = dec.flush()
101+
dec.free()
102+
```
103+
103104
### Metadata
104105

105106
Read tags, pictures, markers and regions without decoding samples. Available for

0 commit comments

Comments
 (0)