microbr-decode 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- microbr_decode-0.1.0/LICENSE +21 -0
- microbr_decode-0.1.0/PKG-INFO +130 -0
- microbr_decode-0.1.0/README.md +112 -0
- microbr_decode-0.1.0/pyproject.toml +39 -0
- microbr_decode-0.1.0/pyproject.toml.orig +30 -0
- microbr_decode-0.1.0/src/microbr_decode/__init__.py +132 -0
- microbr_decode-0.1.0/src/microbr_decode/br_format.py +434 -0
- microbr_decode-0.1.0/src/microbr_decode/rdac_brwc.py +641 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 David Jackson
|
|
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.
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: microbr-decode
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Decode BOSS Micro-BR RDAC audio (.BR0 song folders) to WAV
|
|
5
|
+
Keywords: roland,boss,micro-br,rdac,audio,decoder,wav
|
|
6
|
+
Author: David Jackson
|
|
7
|
+
Author-email: David Jackson <pyguy411@gmail.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Conversion
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Project-URL: Homepage, https://github.com/pyguy411/microbr-decode
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# microbr-decode
|
|
20
|
+
|
|
21
|
+
A pure-Python decoder for audio recorded on the **BOSS Micro-BR** digital
|
|
22
|
+
recorder. It reads a memory-card backup (the `BR0` folder containing
|
|
23
|
+
`SONG000X.BR0` folders and their `TAKE_DAT.BR0` / `TAKE_EVT.BR0` files),
|
|
24
|
+
decodes Roland's proprietary RDAC audio, and writes standard 16-bit 44.1 kHz
|
|
25
|
+
WAV files — a mixdown per song plus per-track stems.
|
|
26
|
+
|
|
27
|
+
Not affiliated with, endorsed by, or sponsored by Roland Corporation or BOSS.
|
|
28
|
+
Use it to decode your own recordings.
|
|
29
|
+
|
|
30
|
+
Tested with files recorded on the **BOSS Micro-BR**. The song headers on a
|
|
31
|
+
Micro-BR card identify themselves as `BR-900`, which suggests the two
|
|
32
|
+
recorders share the same file format, so it may also work on BR-900 card
|
|
33
|
+
backups — untested. Other BR-family or VS-family devices are also untested
|
|
34
|
+
and probably won't work as-is.
|
|
35
|
+
|
|
36
|
+
## Status
|
|
37
|
+
|
|
38
|
+
WORKING. Verified against all 9 songs of a full Micro-BR card: 19 WAV files (mixdowns + stems), zero sample mismatches,
|
|
39
|
+
zero wraparound artifacts.
|
|
40
|
+
|
|
41
|
+
Supports RDAC `mode_words` 4–8 and 16 (including uncompressed 16-bit PCM),
|
|
42
|
+
with the 16 KB page framing, multi-track event mapping, and punch-in take
|
|
43
|
+
chains the Micro-BR uses. The format was reverse engineered for
|
|
44
|
+
interoperability with recordings made by the (discontinued) Micro-BR and,
|
|
45
|
+
likely, the related BR-900. Other devices are untested and probably won't
|
|
46
|
+
work as-is.
|
|
47
|
+
|
|
48
|
+
## Installation
|
|
49
|
+
|
|
50
|
+
From PyPI:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
uv tool install microbr-decode
|
|
54
|
+
# or
|
|
55
|
+
pipx install microbr-decode
|
|
56
|
+
# or
|
|
57
|
+
pip install microbr-decode
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
From source:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
uv sync
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
All three make a `microbr-decode` script available on your PATH.
|
|
67
|
+
|
|
68
|
+
## Usage
|
|
69
|
+
|
|
70
|
+
Inspect a card backup:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
microbr-decode inspect path/to/BR0
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Decode every song (mixdowns to `output_dir/SONG000X.wav`, stems to
|
|
77
|
+
`output_dir/SONG000X-track1.wav`, etc.):
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
microbr-decode decode path/to/BR0 -o output_dir
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Decode a single song:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
microbr-decode decode path/to/BR0/SONG0000.BR0 -o output_dir
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Use `--no-split-tracks` to write only the mixdown per song.
|
|
90
|
+
|
|
91
|
+
No dependencies beyond Python 3.10+.
|
|
92
|
+
|
|
93
|
+
## What's inside a Micro-BR card
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
BR0/
|
|
97
|
+
├── CARDPRM.BR1
|
|
98
|
+
├── DISKINF2.BR0
|
|
99
|
+
├── SONG0000.BR0/
|
|
100
|
+
│ ├── ARRANGE3.BR1
|
|
101
|
+
│ ├── EFFECTS3.BR1
|
|
102
|
+
│ ├── SONGINF2.BR0
|
|
103
|
+
│ ├── SONGPRM.BR1
|
|
104
|
+
│ ├── TAKE_DAT.BR0 <- RDAC audio (16 KB pages)
|
|
105
|
+
│ ├── TAKE_DT1.BR0
|
|
106
|
+
│ ├── TAKE_DT2.BR0
|
|
107
|
+
│ └── TAKE_EVT.BR0 <- track/take event map
|
|
108
|
+
├── SONG0001.BR0/
|
|
109
|
+
...
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Development
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
uv sync
|
|
116
|
+
uv run python -m unittest discover -s tests -v
|
|
117
|
+
uv build
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## License
|
|
121
|
+
|
|
122
|
+
MIT — see [LICENSE](LICENSE).
|
|
123
|
+
|
|
124
|
+
## Background
|
|
125
|
+
|
|
126
|
+
The Micro-BR stores audio in Roland's proprietary RDAC compression inside a
|
|
127
|
+
16 KB-paged container. Details of the reverse engineering are in
|
|
128
|
+
[docs/FORMAT_ANALYSIS.md](docs/FORMAT_ANALYSIS.md). Related prior art:
|
|
129
|
+
[randygordon/rdac](https://github.com/randygordon/rdac) (C/Go decoders for
|
|
130
|
+
Roland VS recorders).
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# microbr-decode
|
|
2
|
+
|
|
3
|
+
A pure-Python decoder for audio recorded on the **BOSS Micro-BR** digital
|
|
4
|
+
recorder. It reads a memory-card backup (the `BR0` folder containing
|
|
5
|
+
`SONG000X.BR0` folders and their `TAKE_DAT.BR0` / `TAKE_EVT.BR0` files),
|
|
6
|
+
decodes Roland's proprietary RDAC audio, and writes standard 16-bit 44.1 kHz
|
|
7
|
+
WAV files — a mixdown per song plus per-track stems.
|
|
8
|
+
|
|
9
|
+
Not affiliated with, endorsed by, or sponsored by Roland Corporation or BOSS.
|
|
10
|
+
Use it to decode your own recordings.
|
|
11
|
+
|
|
12
|
+
Tested with files recorded on the **BOSS Micro-BR**. The song headers on a
|
|
13
|
+
Micro-BR card identify themselves as `BR-900`, which suggests the two
|
|
14
|
+
recorders share the same file format, so it may also work on BR-900 card
|
|
15
|
+
backups — untested. Other BR-family or VS-family devices are also untested
|
|
16
|
+
and probably won't work as-is.
|
|
17
|
+
|
|
18
|
+
## Status
|
|
19
|
+
|
|
20
|
+
WORKING. Verified against all 9 songs of a full Micro-BR card: 19 WAV files (mixdowns + stems), zero sample mismatches,
|
|
21
|
+
zero wraparound artifacts.
|
|
22
|
+
|
|
23
|
+
Supports RDAC `mode_words` 4–8 and 16 (including uncompressed 16-bit PCM),
|
|
24
|
+
with the 16 KB page framing, multi-track event mapping, and punch-in take
|
|
25
|
+
chains the Micro-BR uses. The format was reverse engineered for
|
|
26
|
+
interoperability with recordings made by the (discontinued) Micro-BR and,
|
|
27
|
+
likely, the related BR-900. Other devices are untested and probably won't
|
|
28
|
+
work as-is.
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
From PyPI:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
uv tool install microbr-decode
|
|
36
|
+
# or
|
|
37
|
+
pipx install microbr-decode
|
|
38
|
+
# or
|
|
39
|
+
pip install microbr-decode
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
From source:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
uv sync
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
All three make a `microbr-decode` script available on your PATH.
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
51
|
+
|
|
52
|
+
Inspect a card backup:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
microbr-decode inspect path/to/BR0
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Decode every song (mixdowns to `output_dir/SONG000X.wav`, stems to
|
|
59
|
+
`output_dir/SONG000X-track1.wav`, etc.):
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
microbr-decode decode path/to/BR0 -o output_dir
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Decode a single song:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
microbr-decode decode path/to/BR0/SONG0000.BR0 -o output_dir
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Use `--no-split-tracks` to write only the mixdown per song.
|
|
72
|
+
|
|
73
|
+
No dependencies beyond Python 3.10+.
|
|
74
|
+
|
|
75
|
+
## What's inside a Micro-BR card
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
BR0/
|
|
79
|
+
├── CARDPRM.BR1
|
|
80
|
+
├── DISKINF2.BR0
|
|
81
|
+
├── SONG0000.BR0/
|
|
82
|
+
│ ├── ARRANGE3.BR1
|
|
83
|
+
│ ├── EFFECTS3.BR1
|
|
84
|
+
│ ├── SONGINF2.BR0
|
|
85
|
+
│ ├── SONGPRM.BR1
|
|
86
|
+
│ ├── TAKE_DAT.BR0 <- RDAC audio (16 KB pages)
|
|
87
|
+
│ ├── TAKE_DT1.BR0
|
|
88
|
+
│ ├── TAKE_DT2.BR0
|
|
89
|
+
│ └── TAKE_EVT.BR0 <- track/take event map
|
|
90
|
+
├── SONG0001.BR0/
|
|
91
|
+
...
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Development
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
uv sync
|
|
98
|
+
uv run python -m unittest discover -s tests -v
|
|
99
|
+
uv build
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## License
|
|
103
|
+
|
|
104
|
+
MIT — see [LICENSE](LICENSE).
|
|
105
|
+
|
|
106
|
+
## Background
|
|
107
|
+
|
|
108
|
+
The Micro-BR stores audio in Roland's proprietary RDAC compression inside a
|
|
109
|
+
16 KB-paged container. Details of the reverse engineering are in
|
|
110
|
+
[docs/FORMAT_ANALYSIS.md](docs/FORMAT_ANALYSIS.md). Related prior art:
|
|
111
|
+
[randygordon/rdac](https://github.com/randygordon/rdac) (C/Go decoders for
|
|
112
|
+
Roland VS recorders).
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "microbr-decode"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Decode BOSS Micro-BR RDAC audio (.BR0 song folders) to WAV"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
keywords = [
|
|
9
|
+
"roland",
|
|
10
|
+
"boss",
|
|
11
|
+
"micro-br",
|
|
12
|
+
"rdac",
|
|
13
|
+
"audio",
|
|
14
|
+
"decoder",
|
|
15
|
+
"wav",
|
|
16
|
+
]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 4 - Beta",
|
|
19
|
+
"Intended Audience :: End Users/Desktop",
|
|
20
|
+
"Operating System :: OS Independent",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Topic :: Multimedia :: Sound/Audio :: Conversion",
|
|
23
|
+
]
|
|
24
|
+
requires-python = ">=3.10"
|
|
25
|
+
dependencies = []
|
|
26
|
+
|
|
27
|
+
[[project.authors]]
|
|
28
|
+
name = "David Jackson"
|
|
29
|
+
email = "pyguy411@gmail.com"
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
Homepage = "https://github.com/pyguy411/microbr-decode"
|
|
33
|
+
|
|
34
|
+
[project.scripts]
|
|
35
|
+
microbr-decode = "microbr_decode:main"
|
|
36
|
+
|
|
37
|
+
[build-system]
|
|
38
|
+
requires = ["uv_build>=0.13.5,<0.14.0"]
|
|
39
|
+
build-backend = "uv_build"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "microbr-decode"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Decode BOSS Micro-BR RDAC audio (.BR0 song folders) to WAV"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
authors = [
|
|
9
|
+
{ name = "David Jackson", email = "pyguy411@gmail.com" }
|
|
10
|
+
]
|
|
11
|
+
keywords = ["roland", "boss", "micro-br", "rdac", "audio", "decoder", "wav"]
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 4 - Beta",
|
|
14
|
+
"Intended Audience :: End Users/Desktop",
|
|
15
|
+
"Operating System :: OS Independent",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Topic :: Multimedia :: Sound/Audio :: Conversion",
|
|
18
|
+
]
|
|
19
|
+
requires-python = ">=3.10"
|
|
20
|
+
dependencies = []
|
|
21
|
+
|
|
22
|
+
[project.urls]
|
|
23
|
+
Homepage = "https://github.com/pyguy411/microbr-decode"
|
|
24
|
+
|
|
25
|
+
[project.scripts]
|
|
26
|
+
microbr-decode = "microbr_decode:main"
|
|
27
|
+
|
|
28
|
+
[build-system]
|
|
29
|
+
requires = ["uv_build>=0.13.5,<0.14.0"]
|
|
30
|
+
build-backend = "uv_build"
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import sys
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
from microbr_decode.br_format import (
|
|
6
|
+
decode_song_directory,
|
|
7
|
+
inspect_path,
|
|
8
|
+
write_wav_mono_16,
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _inspect(path: Path) -> int:
|
|
13
|
+
try:
|
|
14
|
+
card_root, songs = inspect_path(path)
|
|
15
|
+
except (OSError, ValueError) as error:
|
|
16
|
+
print(f"microbr-decode: {error}", file=sys.stderr)
|
|
17
|
+
return 2
|
|
18
|
+
|
|
19
|
+
print(f"Card directory: {card_root}")
|
|
20
|
+
print(f"Songs found: {len(songs)}")
|
|
21
|
+
for song in songs:
|
|
22
|
+
print(f"\n{song.directory.name}")
|
|
23
|
+
print(f" Song name: {song.song_name or 'unknown'}")
|
|
24
|
+
print(f" Recorder identifier: {song.recorder_model or 'unknown'}")
|
|
25
|
+
if song.audio_format and song.audio_format.hardware_id:
|
|
26
|
+
print(f" Hardware ID: {song.audio_format.hardware_id}")
|
|
27
|
+
if song.invalid_headers:
|
|
28
|
+
print(f" Invalid metadata headers: {', '.join(song.invalid_headers)}")
|
|
29
|
+
for name, size in song.files.items():
|
|
30
|
+
description = "missing" if size is None else f"{size} bytes"
|
|
31
|
+
print(f" {name}: {description}")
|
|
32
|
+
|
|
33
|
+
if song.audio_format:
|
|
34
|
+
fmt = song.audio_format
|
|
35
|
+
print(
|
|
36
|
+
f" Audio format: {fmt.mode_label}, {fmt.sample_rate} Hz, "
|
|
37
|
+
f"page={fmt.page_size}B ({fmt.blocks_per_page} blocks/page)"
|
|
38
|
+
)
|
|
39
|
+
else:
|
|
40
|
+
print(" Audio format: unparsed")
|
|
41
|
+
|
|
42
|
+
if song.active_events:
|
|
43
|
+
tracks: dict[tuple[int, int], list] = {}
|
|
44
|
+
max_blk = 0
|
|
45
|
+
for ev in song.active_events:
|
|
46
|
+
tracks.setdefault((ev.track, ev.vtrack), []).append(ev)
|
|
47
|
+
max_blk = max(max_blk, ev.timeline_start_block + ev.block_count)
|
|
48
|
+
sr = song.audio_format.sample_rate if song.audio_format else 44100
|
|
49
|
+
dur = (max_blk * 16) / sr
|
|
50
|
+
track_desc = ", ".join(
|
|
51
|
+
f"T{t}V{v}({len(evs)} ev)" for (t, v), evs in sorted(tracks.items())
|
|
52
|
+
)
|
|
53
|
+
print(f" Active tracks: {track_desc} (duration={dur:.2f}s)")
|
|
54
|
+
else:
|
|
55
|
+
print(" Active tracks: none")
|
|
56
|
+
|
|
57
|
+
return 0
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def _decode(
|
|
61
|
+
path: Path,
|
|
62
|
+
output_dir: Path | None = None,
|
|
63
|
+
*,
|
|
64
|
+
split_tracks: bool = True,
|
|
65
|
+
) -> int:
|
|
66
|
+
try:
|
|
67
|
+
card_root, songs = inspect_path(path)
|
|
68
|
+
except (OSError, ValueError) as error:
|
|
69
|
+
print(f"microbr-decode: {error}", file=sys.stderr)
|
|
70
|
+
return 2
|
|
71
|
+
|
|
72
|
+
out_root = output_dir if output_dir is not None else Path("decoded_wav")
|
|
73
|
+
decoded_count = 0
|
|
74
|
+
for song_info in songs:
|
|
75
|
+
try:
|
|
76
|
+
decoded = decode_song_directory(song_info.directory)
|
|
77
|
+
except (OSError, ValueError) as error:
|
|
78
|
+
print(f"microbr-decode: skipping {song_info.directory.name}: {error}", file=sys.stderr)
|
|
79
|
+
continue
|
|
80
|
+
|
|
81
|
+
stem = song_info.directory.stem
|
|
82
|
+
sr = decoded.audio_format.sample_rate
|
|
83
|
+
mix_path = out_root / f"{stem}.wav"
|
|
84
|
+
write_wav_mono_16(mix_path, decoded.mixdown, sr)
|
|
85
|
+
dur = len(decoded.mixdown) / sr
|
|
86
|
+
print(f"Decoded {stem} -> {mix_path} ({dur:.2f}s, {len(decoded.tracks)} track(s))")
|
|
87
|
+
|
|
88
|
+
if split_tracks and len(decoded.tracks) > 1:
|
|
89
|
+
for tr in decoded.tracks:
|
|
90
|
+
tr_path = out_root / f"{stem}_T{tr.track}_V{tr.vtrack}.wav"
|
|
91
|
+
write_wav_mono_16(tr_path, tr.samples, sr)
|
|
92
|
+
print(f" Track {tr.track} V{tr.vtrack} -> {tr_path}")
|
|
93
|
+
decoded_count += 1
|
|
94
|
+
|
|
95
|
+
if decoded_count == 0:
|
|
96
|
+
print("microbr-decode: no songs were decoded.", file=sys.stderr)
|
|
97
|
+
return 2
|
|
98
|
+
return 0
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def main() -> None:
|
|
102
|
+
parser = argparse.ArgumentParser(
|
|
103
|
+
prog="microbr-decode",
|
|
104
|
+
description="Inspect and decode BOSS BR / Micro-BR song folders to WAV.",
|
|
105
|
+
)
|
|
106
|
+
subparsers = parser.add_subparsers(dest="command", required=True)
|
|
107
|
+
inspect_parser = subparsers.add_parser(
|
|
108
|
+
"inspect", help="inspect a card directory or one SONG*.BR0 folder"
|
|
109
|
+
)
|
|
110
|
+
inspect_parser.add_argument("path", type=Path)
|
|
111
|
+
decode_parser = subparsers.add_parser(
|
|
112
|
+
"decode", help="decode a song or card directory to 16-bit WAV"
|
|
113
|
+
)
|
|
114
|
+
decode_parser.add_argument("path", type=Path)
|
|
115
|
+
decode_parser.add_argument(
|
|
116
|
+
"-o",
|
|
117
|
+
"--output",
|
|
118
|
+
type=Path,
|
|
119
|
+
default=Path("decoded_wav"),
|
|
120
|
+
help="output directory for WAV files (default: decoded_wav)",
|
|
121
|
+
)
|
|
122
|
+
decode_parser.add_argument(
|
|
123
|
+
"--no-split-tracks",
|
|
124
|
+
action="store_true",
|
|
125
|
+
help="only write the mixed song WAV without separate per-track WAV files",
|
|
126
|
+
)
|
|
127
|
+
args = parser.parse_args()
|
|
128
|
+
|
|
129
|
+
if args.command == "inspect":
|
|
130
|
+
raise SystemExit(_inspect(args.path))
|
|
131
|
+
|
|
132
|
+
raise SystemExit(_decode(args.path, args.output, split_tracks=not args.no_split_tracks))
|