Compare commits

...

3 commits

Author SHA1 Message Date
DataHoarder 439ad19af8
Fix libopus decoding, optimize vorbis nocgo decoding allocations
All checks were successful
continuous-integration/drone/push Build is passing
2023-01-29 14:21:11 +01:00
DataHoarder 713602c748
Fix vo-aacenc 2023-01-29 14:09:24 +01:00
DataHoarder ee8e045e15
Added cmd/decode information on README 2023-01-29 14:00:18 +01:00
4 changed files with 27 additions and 4 deletions

View file

@ -197,6 +197,25 @@ This tag enables the [libalac](https://git.gammaspectra.live/S.O.N.G/go-alac) su
This library has vast security issues, enable on your own risk. An alternate codec for decoding might be added in the future.
## Utilities
### `cmd/decode`
Example application that decodes files and provides some general information about the decoded streams, and produces an MD5 hash of the sample data.
Run via `$ go run git.gammaspectra.live/S.O.N.G/Kirika/cmd/decode -input "resources/samples/cYsmix - Haunted House/11. The Great Rigid Desert.flac"`
Example output:
```
2023/01/29 12:58:27 File: resources/samples/cYsmix - Haunted House/11. The Great Rigid Desert.flac
2023/01/29 12:58:27 Available decoders:
2023/01/29 12:58:27 flac: reference libFLAC 1.3.3 20190804 (S.O.N.G/goflac) (analyzer)
2023/01/29 12:58:27 Decoding as int32 24-bit @ 44100Hz 2 channel(s)
2023/01/29 12:58:27 Decoded 17323031 sample(s)
2023/01/29 12:58:27 Processed 4230 blocks(s) (avg 4095.28 sample(s) per block)
2023/01/29 12:58:27 Duration 6m32.812494331s
2023/01/29 12:58:27 MD5 hash: c1a62472ca433e6c4b02e842a8348660
2023/01/29 12:58:27 Check via $ ffmpeg -hide_banner -loglevel error -i "resources/samples/cYsmix - Haunted House/11. The Great Rigid Desert.flac" -vn -c:a pcm_s24le -f md5 -
2023/01/29 12:58:27 Took 385.02864ms
```
## Licenses

View file

@ -5,7 +5,9 @@ package aac
import (
"fmt"
"git.gammaspectra.live/S.O.N.G/Kirika/audio"
"git.gammaspectra.live/S.O.N.G/Kirika/audio/format"
"git.gammaspectra.live/S.O.N.G/Kirika/vector"
aac "git.gammaspectra.live/S.O.N.G/voaac-go"
"io"
)

View file

@ -10,6 +10,7 @@ import (
"git.gammaspectra.live/S.O.N.G/Kirika/audio/filter"
"git.gammaspectra.live/S.O.N.G/Kirika/audio/format"
libopus "git.gammaspectra.live/S.O.N.G/go-pus"
"golang.org/x/exp/slices"
"io"
"time"
)
@ -68,7 +69,7 @@ func (f Format) Open(r io.ReadSeekCloser) (audio.Source, error) {
}
if n > 0 {
source.IngestFloat32(buf[:n*channelCount])
source.IngestFloat32(slices.Clone(buf[:n*channelCount]))
}
}
}()

View file

@ -7,6 +7,7 @@ import (
"git.gammaspectra.live/S.O.N.G/Kirika/audio"
"git.gammaspectra.live/S.O.N.G/Kirika/audio/format"
libvorbis "github.com/jfreymuth/oggvorbis"
"golang.org/x/exp/slices"
"io"
)
@ -36,9 +37,9 @@ func (f Format) Open(r io.ReadSeekCloser) (audio.Source, error) {
go func() {
defer source.Close()
for {
buffer := make([]float32, 8192)
buffer := make([]float32, 8192)
for {
n, err := reader.Read(buffer)
if err != nil {
@ -46,7 +47,7 @@ func (f Format) Open(r io.ReadSeekCloser) (audio.Source, error) {
}
if n > 0 {
source.IngestFloat32(buffer[:n])
source.IngestFloat32(slices.Clone(buffer[:n]))
}
}
}()