Skip to content

Commit 3a1605b

Browse files
committed
Initial
0 parents  commit 3a1605b

File tree

7 files changed

+1297
-0
lines changed

7 files changed

+1297
-0
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
tests/
2+
dr_flac.h
3+
sokol_audio.h
4+
dr_mp3.h
5+
qoaconv
6+
qoaplay

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Dominic Szablewski
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
CC ?= gcc
2+
3+
# QOACONV
4+
# Requires
5+
# - https://github.com/mackron/dr_libs/blob/master/dr_mp3.h
6+
# - https://github.com/mackron/dr_libs/blob/master/dr_flac.h
7+
# Remove -D QOACONV_HAS_DRMP3 and -D QOACONV_HAS_DRFLAC to compile qoaconv
8+
# without MP3/FLAC support
9+
TARGET_CONV ?= qoaconv
10+
CFLAGS_CONV ?= -std=c99 -O3 -D QOACONV_HAS_DRMP3 -D QOACONV_HAS_DRFLAC
11+
LFLAGS_CONV ?= -lm
12+
13+
14+
# QOAPLAY
15+
# Requires
16+
# - https://github.com/floooh/sokol/blob/master/sokol_audio.h
17+
# FIXME: not yet tested on Windows/macOS
18+
TARGET_PLAY ?= qoaplay
19+
CFLAGS_PLAY ?= -std=gnu99 -O3
20+
21+
ifeq ($(OS),Windows_NT)
22+
LFLAGS_PLAY ?= # defined in #pragma() in sokol_audio.h
23+
else
24+
UNAME_S := $(shell uname -s)
25+
ifeq ($(UNAME_S),Darwin)
26+
LFLAGS_PLAY ?= -pthread -framework AudioToolbox
27+
else
28+
LFLAGS_PLAY ?= -pthread -lasound
29+
endif
30+
endif
31+
32+
all: $(TARGET_PLAY) $(TARGET_CONV)
33+
34+
play: $(TARGET_PLAY)
35+
$(TARGET_PLAY):$(TARGET_PLAY).c
36+
$(CC) $(CFLAGS_PLAY) $(TARGET_PLAY).c -o $(TARGET_PLAY) $(LFLAGS_PLAY)
37+
38+
conv: $(TARGET_CONV)
39+
$(TARGET_CONV):$(TARGET_CONV).c
40+
$(CC) $(CFLAGS_CONV) $(TARGET_CONV).c -o $(TARGET_CONV) $(LFLAGS_CONV)
41+
42+
.PHONY: clean
43+
clean:
44+
$(RM) $(TARGET_PLAY) $(TARGET_CONV)

README.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# QOA - The “Quite OK Audio Format” for fast, lossy audio compression
2+
3+
Single-file MIT licensed library for C/C++
4+
5+
See [qoa.h](https://github.com/phoboslab/qoa/blob/master/qoa.h) for
6+
the documentation and format specification.
7+
8+
More info at: https://phoboslab.org/log/2023/02/qoa-time-domain-audio-compression
9+
10+
Audio samples in WAV & QOA format can be found at: https://phoboslab.org/files/qoa-samples/
11+
12+
13+
⚠️ This implementation has not yet been fuzzed. Don't use it with untrusted input.
14+
15+
⚠️ The format is likely to change in the coming weeks. Once it is finalized,
16+
a detailed specification will be published.
17+
18+
⚠️ If you are experimenting with QOA, please _very_ be careful, especially when
19+
wearing headphones. You may unexpectedly produce garbage output that can damage
20+
your ears. I had more than a few close calls.

0 commit comments

Comments
 (0)