docs/guide/audio: HE-AAC section and opts.sbr; audio/caf: SBR only at the described rate
This commit is contained in:
1 parent
9a4cacc40b
commit
028bee3f59
3 files changed
+48
-1
No files matched your search
+15
-1
@@ -102,6 +102,7 @@ the guide's [README](README.md#inputs)). Options:
|
||||
| `maxFrames` | wav, flac, mp3, aiff, au, voc, aac, mpc, ac3 | `Err.LIMIT` past this many frames |
|
||||
| `drc` | ac3 | dynamic range control: 0 = off (default), 1 = as the stream says |
|
||||
| `stereo` | opus | downmix surround streams to stereo |
|
||||
| `sbr` | aac, m4a, the AAC tracks of mp4 / mkv / ts | `false`: decode only the AAC-LC core of HE-AAC (half the rate, mono for HE-AACv2, about 4x faster) |
|
||||
|
||||
```luau
|
||||
local tags = assert(F.audio.open(mp3Bytes)).tags -- opening reads the tags; nothing is decoded yet
|
||||
@@ -112,6 +113,19 @@ local bad, err = F.audio.load("not audio at all")
|
||||
assert(bad == nil and err.code == F.Err.UNKNOWN_FORMAT)
|
||||
```
|
||||
|
||||
### HE-AAC
|
||||
|
||||
HE-AAC (SBR) and HE-AACv2 (SBR + parametric stereo) decode at the full output rate in every AAC path: ADTS, M4A,
|
||||
and the audio tracks of MP4, Matroska and MPEG-TS (HLS radio). ADTS cannot signal SBR, so the decoder looks for SBR
|
||||
and PS data in the first frames, as ffmpeg does; `sampleRate`, `channels` and `frames` report the output.
|
||||
|
||||
```luau
|
||||
local dec = assert(F.audio.open(heAacBytes)) -- HE-AACv2 in ADTS: a 24 kHz mono core
|
||||
assert(dec.sampleRate == 48000 and dec.channels == 2) -- SBR doubles the rate, PS makes it stereo
|
||||
local core = assert(F.audio.open(heAacBytes, { sbr = false })) -- the AAC-LC core only, for slow devices
|
||||
assert(core.sampleRate == 24000 and core.channels == 1 and core.frames * 2 == dec.frames)
|
||||
```
|
||||
|
||||
## Editing: `F.ops.audio`
|
||||
|
||||
Every function returns a new Audio, or `nil, err` for bad arguments. Times are in seconds. Rates and channel counts
|
||||
@@ -192,7 +206,7 @@ Tags are written from `audio.tags`, or from the Decoder's `tags`, wherever the f
|
||||
|
||||
| Read and write | Read only |
|
||||
|---|---|
|
||||
| wav (+ RF64), flac (+ Ogg FLAC), mp3 / mp2, vorbis (.ogg), opus, aiff / aifc, au, voc, caf, m4a (ALAC), qoa, adx, vag, adpcm (raw IMA / MS) | aac (ADTS), m4a / caf AAC, mpc (Musepack SV7 / SV8), ac3 (Dolby Digital), brstm / bcstm / bfstm, KVAG, wav / aifc / caf IMA and MS ADPCM, wavpack (.wv + .wvc), ape, tta |
|
||||
| wav (+ RF64), flac (+ Ogg FLAC), mp3 / mp2, vorbis (.ogg), opus, aiff / aifc, au, voc, caf, m4a (ALAC), qoa, adx, vag, adpcm (raw IMA / MS) | aac (ADTS; AAC-LC, HE-AAC, HE-AACv2), m4a / caf AAC, mpc (Musepack SV7 / SV8), ac3 (Dolby Digital), brstm / bcstm / bfstm, KVAG, wav / aifc / caf IMA and MS ADPCM, wavpack (.wv + .wvc), ape, tta |
|
||||
|
||||
Each format's capabilities are listed in [FORMATS.md](../FORMATS.md). The audio tracks of video files open as
|
||||
Decoders too: see `v.audio` in [video.md](video.md). Music files (MOD, MIDI, ...) render to a Decoder: see
|
||||
|
||||
Reference in new issue
Block a user