summaryrefslogtreecommitdiffstats
path: root/README.md
blob: e66141a08951365701781ef90b42237ee83398fa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# atracdenc - ATRAC Decoder Encoder
It is free LGPL implementation of ATRAC1, ATRAC3 encoders.

Building:

You need:
* C++17 compiler.
* CMake >= 3.1.
* PCM input/output backend:
  * `libsndfile` on Linux and MSYS2.
  * Media Foundation on Windows with MSVC.
* Python 3 (optional, only required to run the integration tests).

If the source was cloned with git, fetch submodules first:

```
git submodule update --init --recursive
```

The PCM backend can be selected with `ATRACDENC_PCM_IO_BACKEND`.
Supported values are `auto`, `mediafoundation`, and `libsndfile`.
The default is `mediafoundation` for MSVC Windows builds and `libsndfile`
everywhere else.

Linux, Debian/Ubuntu based:

```
sudo apt update
sudo apt install -y build-essential cmake libsndfile1-dev python3 googletest libgtest-dev

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DATRACDENC_PCM_IO_BACKEND=libsndfile
cmake --build build -j"$(nproc)"
ctest --test-dir build --output-on-failure
```

The binary is created at `build/src/atracdenc`.

Windows, MSYS2 MinGW64:

Run the commands from the `MSYS2 MinGW x64` shell.

```
pacman -S --needed \
    git \
    mingw-w64-x86_64-cmake \
    mingw-w64-x86_64-gcc \
    mingw-w64-x86_64-gtest \
    mingw-w64-x86_64-libsndfile \
    mingw-w64-x86_64-ninja \
    mingw-w64-x86_64-python

cmake -S . -B build-msys2 -G Ninja \
    -DCMAKE_BUILD_TYPE=Release \
    -DATRACDENC_PCM_IO_BACKEND=libsndfile
cmake --build build-msys2
ctest --test-dir build-msys2 --output-on-failure
```

The binary is created at `build-msys2/src/atracdenc.exe`.

To create a redistributable directory with required MSYS2 runtime DLLs and
license files:

```
bash tools/package-msys2-runtime.sh build-msys2/src/atracdenc.exe dist-msys2
```

Windows, MSVC:

Install Visual Studio or Visual Studio Build Tools with the C++ desktop
workload. Run the commands from an `x64 Native Tools Command Prompt for VS`.

```
cmake -S . -B build-msvc -G "Visual Studio 17 2022" -A x64 ^
    -DATRACDENC_PCM_IO_BACKEND=mediafoundation
cmake --build build-msvc --config Release
ctest --test-dir build-msvc -C Release --output-on-failure
```

The binary is created at `build-msvc/src/Release/atracdenc.exe`.

Usage:

By default the output container is selected from the output file extension.
Use `--container {aea|oma|riff|rm|raw}` to select it explicitly.
Valid combinations are ATRAC1: AEA/RAW, ATRAC3: OMA/RIFF/RM/RAW,
and ATRAC3PLUS: OMA/RIFF/RAW.

ATRAC1:
```
./atracdenc -e atrac1 -i ~/01.wav -o /tmp/01.aea
```

ATRAC3:
```
./atracdenc -e atrac3 -i ~/01.wav -o /tmp/01.oma
```

ATRAC3PLUS:
```
./atracdenc -e atrac3plus -i ~/01.wav -o /tmp/01.oma
```


More information on the [atracdenc man page](https://code.mastervirt.ru/atracdenc/about/man/atracdenc.1)

Limitations:
 - Only 44100 16bit wav input file