TonieToolbox 0.1.0__py3-none-any.whl
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.
- TonieToolbox/__init__.py +5 -0
- TonieToolbox/__main__.py +145 -0
- TonieToolbox/audio_conversion.py +194 -0
- TonieToolbox/constants.py +14 -0
- TonieToolbox/dependency_manager.py +378 -0
- TonieToolbox/filename_generator.py +94 -0
- TonieToolbox/logger.py +57 -0
- TonieToolbox/ogg_page.py +588 -0
- TonieToolbox/opus_packet.py +219 -0
- TonieToolbox/tonie_analysis.py +522 -0
- TonieToolbox/tonie_file.py +411 -0
- TonieToolbox/tonie_header.proto +11 -0
- TonieToolbox/tonie_header_pb2.py +99 -0
- tonietoolbox-0.1.0.dist-info/METADATA +301 -0
- tonietoolbox-0.1.0.dist-info/RECORD +19 -0
- tonietoolbox-0.1.0.dist-info/WHEEL +5 -0
- tonietoolbox-0.1.0.dist-info/entry_points.txt +2 -0
- tonietoolbox-0.1.0.dist-info/licenses/LICENSE.md +674 -0
- tonietoolbox-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,301 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: TonieToolbox
|
3
|
+
Version: 0.1.0
|
4
|
+
Summary: Convert audio files to Tonie box compatible format
|
5
|
+
Home-page: https://github.com/Quentendo64/TonieToolbox
|
6
|
+
Author: Quentendo64
|
7
|
+
Author-email: Quentendo64 <quentin@wohlfeil.at>
|
8
|
+
License-Expression: GPL-3.0-or-later
|
9
|
+
Project-URL: Homepage, https://github.com/Quentendo64/TonieToolbox
|
10
|
+
Project-URL: Bug Tracker, https://github.com/Quentendo64/TonieToolbox/issues
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
12
|
+
Classifier: Programming Language :: Python :: 3.6
|
13
|
+
Classifier: Programming Language :: Python :: 3.7
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
17
|
+
Classifier: Operating System :: OS Independent
|
18
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Conversion
|
19
|
+
Requires-Python: >=3.6
|
20
|
+
Description-Content-Type: text/markdown
|
21
|
+
License-File: LICENSE.md
|
22
|
+
Requires-Dist: protobuf<=3.19.0
|
23
|
+
Dynamic: author
|
24
|
+
Dynamic: home-page
|
25
|
+
Dynamic: license-file
|
26
|
+
Dynamic: requires-python
|
27
|
+
|
28
|
+
# TonieToolbox
|
29
|
+
### WIP - Work in Progress
|
30
|
+
Happy Testing :-P
|
31
|
+
|
32
|
+
A Python tool for converting audio files to Tonie box compatible format (TAF - Tonie Audio Format).
|
33
|
+
|
34
|
+
|
35
|
+
## Table of Contents
|
36
|
+
|
37
|
+
- [Overview](#overview)
|
38
|
+
- [Features](#features)
|
39
|
+
- [Requirements](#requirements)
|
40
|
+
- [Installation](#installation)
|
41
|
+
- [Install from PyPI (Recommended)](#install-from-pypi-recommended)
|
42
|
+
- [Install from Source](#install-from-source)
|
43
|
+
- [Usage](#usage)
|
44
|
+
- [Basic Usage](#basic-usage)
|
45
|
+
- [Advanced Options](#advanced-options)
|
46
|
+
- [Common Usage Examples](#common-usage-examples)
|
47
|
+
- [Technical Details](#technical-details)
|
48
|
+
- [TAF File Structure](#taf-tonie-audio-format-file-structure)
|
49
|
+
- [File Analysis](#file-analysis)
|
50
|
+
- [File Comparison](#file-comparison)
|
51
|
+
- [Related Projects](#related-projects)
|
52
|
+
- [Contributing](#contributing)
|
53
|
+
|
54
|
+
## Overview
|
55
|
+
|
56
|
+
TonieToolbox allows you to create custom audio content for Tonie boxes by converting various audio formats into the specific file format required by Tonie devices.
|
57
|
+
|
58
|
+
## Features
|
59
|
+
|
60
|
+
The tool provides several capabilities:
|
61
|
+
|
62
|
+
- Convert single or multiple audio files into a Tonie-compatible format
|
63
|
+
- Analyze and validate existing Tonie files
|
64
|
+
- Split Tonie files into individual opus tracks
|
65
|
+
- Compare two TAF files for debugging differences
|
66
|
+
- Support various input formats through FFmpeg conversion
|
67
|
+
|
68
|
+
## Requirements
|
69
|
+
|
70
|
+
- Python 3.6 or higher
|
71
|
+
- FFmpeg (for converting non-opus audio files).
|
72
|
+
- opus-tools (specifically `opusenc` for encoding to opus format)
|
73
|
+
|
74
|
+
Make sure FFmpeg and opus-tools are installed on your system and accessible in your PATH.
|
75
|
+
If the requirements are not found in PATH. TonieToolbox will download the missing requirements.
|
76
|
+
|
77
|
+
## Installation
|
78
|
+
|
79
|
+
### Install from PyPI (Recommended)
|
80
|
+
|
81
|
+
```
|
82
|
+
pip install tonietoolbox
|
83
|
+
```
|
84
|
+
|
85
|
+
This will install TonieToolbox and its dependencies, making the `tonietoolbox` command available in your terminal.
|
86
|
+
|
87
|
+
### Install from Source
|
88
|
+
|
89
|
+
```
|
90
|
+
# Clone the repository
|
91
|
+
git clone https://github.com/Quentendo64/TonieToolbox.git
|
92
|
+
cd TonieToolbox
|
93
|
+
|
94
|
+
# Install dependencies
|
95
|
+
pip install protobuf
|
96
|
+
```
|
97
|
+
|
98
|
+
## Usage
|
99
|
+
|
100
|
+
### Basic Usage
|
101
|
+
|
102
|
+
**Convert a single audio file to Tonie format:**
|
103
|
+
|
104
|
+
If installed via pip:
|
105
|
+
```
|
106
|
+
tonietoolbox input.mp3
|
107
|
+
```
|
108
|
+
|
109
|
+
If installed from source:
|
110
|
+
```
|
111
|
+
python TonieToolbox.py input.mp3
|
112
|
+
```
|
113
|
+
|
114
|
+
This will create a file named `input.taf` in the `.\output` directory.
|
115
|
+
|
116
|
+
**Specify output filename:**
|
117
|
+
|
118
|
+
```
|
119
|
+
tonietoolbox input.mp3 my_tonie.taf
|
120
|
+
```
|
121
|
+
|
122
|
+
This will create a file named `my_tonie.taf` in the `.\output` directory.
|
123
|
+
|
124
|
+
**Convert multiple files:**
|
125
|
+
|
126
|
+
You can specify a directory to convert all audio files within it:
|
127
|
+
|
128
|
+
```
|
129
|
+
tonietoolbox input_directory/
|
130
|
+
```
|
131
|
+
|
132
|
+
Or use a list file (.lst) containing paths to multiple audio files:
|
133
|
+
|
134
|
+
```
|
135
|
+
tonietoolbox playlist.lst
|
136
|
+
```
|
137
|
+
|
138
|
+
### Advanced Options
|
139
|
+
|
140
|
+
Run the following command to see all available options:
|
141
|
+
|
142
|
+
```
|
143
|
+
tonietoolbox --help
|
144
|
+
```
|
145
|
+
|
146
|
+
Output:
|
147
|
+
```
|
148
|
+
usage: TonieToolbox.py [-h] [--ts TIMESTAMP] [--ffmpeg FFMPEG] [--opusenc OPUSENC]
|
149
|
+
[--bitrate BITRATE] [--cbr] [--append-tonie-tag TAG]
|
150
|
+
[--no-tonie-header] [--info] [--split] [--recursive] [--compare FILE2]
|
151
|
+
[--detailed-compare] [--debug] [--trace] [--quiet] [--silent]
|
152
|
+
SOURCE [TARGET]
|
153
|
+
|
154
|
+
Create Tonie compatible file from Ogg opus file(s).
|
155
|
+
|
156
|
+
positional arguments:
|
157
|
+
SOURCE input file or directory or a file list (.lst)
|
158
|
+
TARGET the output file name (default: ---ID---)
|
159
|
+
|
160
|
+
optional arguments:
|
161
|
+
-h, --help show this help message and exit
|
162
|
+
--ts TIMESTAMP set custom timestamp / bitstream serial / reference .taf file
|
163
|
+
--ffmpeg FFMPEG specify location of ffmpeg
|
164
|
+
--opusenc OPUSENC specify location of opusenc
|
165
|
+
--bitrate BITRATE set encoding bitrate in kbps (default: 96)
|
166
|
+
--cbr encode in cbr mode
|
167
|
+
--append-tonie-tag TAG append [TAG] to filename (must be an 8-character hex value)
|
168
|
+
--no-tonie-header do not write Tonie header
|
169
|
+
--info Check and display info about Tonie file
|
170
|
+
--split Split Tonie file into opus tracks
|
171
|
+
--compare FILE2 Compare input file with another .taf file for debugging
|
172
|
+
--detailed-compare Show detailed OGG page differences when comparing files
|
173
|
+
|
174
|
+
Logging Options:
|
175
|
+
--debug Enable debug logging
|
176
|
+
--trace Enable trace logging (very verbose)
|
177
|
+
--quiet Show only warnings and errors
|
178
|
+
--silent Show only errors
|
179
|
+
```
|
180
|
+
|
181
|
+
### Common Usage Examples
|
182
|
+
|
183
|
+
#### Analyze a Tonie file:
|
184
|
+
|
185
|
+
```
|
186
|
+
tonietoolbox --info my_tonie.taf
|
187
|
+
```
|
188
|
+
|
189
|
+
#### Split a Tonie file into individual opus tracks:
|
190
|
+
|
191
|
+
```
|
192
|
+
tonietoolbox --split my_tonie.taf
|
193
|
+
```
|
194
|
+
|
195
|
+
#### Compare TAF files:
|
196
|
+
|
197
|
+
Compare two TAF files for debugging purposes:
|
198
|
+
|
199
|
+
```
|
200
|
+
tonietoolbox file1.taf --compare file2.taf
|
201
|
+
```
|
202
|
+
|
203
|
+
For detailed comparison including OGG page differences:
|
204
|
+
|
205
|
+
```
|
206
|
+
tonietoolbox file1.taf --compare file2.taf --detailed-compare
|
207
|
+
```
|
208
|
+
|
209
|
+
#### Custom timestamp options:
|
210
|
+
|
211
|
+
```
|
212
|
+
tonietoolbox input.mp3 --ts 1745078762 # UNIX Timestamp
|
213
|
+
tonietoolbox input.mp3 --ts 0x6803C9EA # Bitstream time
|
214
|
+
tonietoolbox input.mp3 --ts ./reference.taf # Reference TAF for extraction
|
215
|
+
```
|
216
|
+
|
217
|
+
#### Set custom bitrate:
|
218
|
+
|
219
|
+
```
|
220
|
+
tonietoolbox input.mp3 --bitrate 128
|
221
|
+
```
|
222
|
+
|
223
|
+
## Technical Details
|
224
|
+
|
225
|
+
### TAF (Tonie Audio Format) File Structure
|
226
|
+
|
227
|
+
The Tonie Audio Format (TAF) consists of several parts:
|
228
|
+
|
229
|
+
#### 1. Tonie Header (0x1000 bytes)
|
230
|
+
|
231
|
+
Located at the beginning of the file, structured as:
|
232
|
+
|
233
|
+
- A 4-byte big-endian integer specifying the header length
|
234
|
+
- A Protocol Buffer encoded header (defined in `tonie_header.proto`)
|
235
|
+
- Padding to fill the entire 4096 bytes (0x1000)
|
236
|
+
|
237
|
+
The Protocol Buffer structure contains:
|
238
|
+
```protobuf
|
239
|
+
message TonieHeader {
|
240
|
+
bytes dataHash = 1; // SHA1 hash of the audio data
|
241
|
+
uint32 dataLength = 2; // Length of the audio data in bytes
|
242
|
+
uint32 timestamp = 3; // Unix timestamp (also used as bitstream serial number)
|
243
|
+
repeated uint32 chapterPages = 4 [packed=true]; // Page numbers for chapter starts
|
244
|
+
bytes padding = 5; // Padding to fill up the header
|
245
|
+
}
|
246
|
+
```
|
247
|
+
|
248
|
+
#### 2. Audio Data
|
249
|
+
|
250
|
+
The audio data consists of:
|
251
|
+
- Opus encoded audio in Ogg container format
|
252
|
+
- Every page after the header has a fixed size of 4096 bytes (0x1000)
|
253
|
+
- First page contains the Opus identification header
|
254
|
+
- Second page contains the Opus comments/tags
|
255
|
+
- Remaining pages contain the actual audio data
|
256
|
+
- All pages use the same bitstream serial number (timestamp from header)
|
257
|
+
|
258
|
+
#### 3. Special Requirements
|
259
|
+
|
260
|
+
For optimal compatibility with Tonie boxes:
|
261
|
+
- Audio must be stereo (2 channels)
|
262
|
+
- Sample rate must be 48 kHz
|
263
|
+
- Pages must be aligned to 4096 byte boundaries
|
264
|
+
- Bitrate of 96 kbps VBR is recommended
|
265
|
+
|
266
|
+
### File Analysis
|
267
|
+
|
268
|
+
When using the `--info` flag, TonieToolbox checks and displays detailed information about a .TAF (Tonie Audio File):
|
269
|
+
|
270
|
+
- SHA1 hash validation
|
271
|
+
- Timestamp/bitstream serial consistency
|
272
|
+
- Opus data length verification
|
273
|
+
- Opus header validation (version, channels, sample rate)
|
274
|
+
- Page alignment and size validation
|
275
|
+
- Total runtime
|
276
|
+
- Track listing with durations
|
277
|
+
|
278
|
+
### File Comparison
|
279
|
+
|
280
|
+
When using the `--compare` flag, TonieToolbox provides a detailed comparison of two .TAF files:
|
281
|
+
|
282
|
+
- File size comparison
|
283
|
+
- Header size verification
|
284
|
+
- Timestamp comparison
|
285
|
+
- Data length validation
|
286
|
+
- SHA1 hash verification
|
287
|
+
- Chapter page structure analysis
|
288
|
+
- OGG page-by-page comparison (with `--detailed-compare` flag)
|
289
|
+
|
290
|
+
This is particularly useful for debugging when creating TAF files with different tools or parameters.
|
291
|
+
|
292
|
+
## Related Projects
|
293
|
+
|
294
|
+
This project is inspired by and builds upon the work of other Tonie-related open source projects:
|
295
|
+
|
296
|
+
- [opus2tonie](https://github.com/bailli/opus2tonie) - A command line utility to convert opus files to the Tonie audio format
|
297
|
+
- [teddycloud](https://github.com/toniebox-reverse-engineering/teddycloud) - Self-hosted alternative to the Tonie cloud for managing custom Tonies
|
298
|
+
|
299
|
+
## Contributing
|
300
|
+
|
301
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
@@ -0,0 +1,19 @@
|
|
1
|
+
TonieToolbox/__init__.py,sha256=4GrSzQXn-JcheFR01mD-meQl4SSYK9OajTU8wImEFKQ,96
|
2
|
+
TonieToolbox/__main__.py,sha256=88bs0yCm9Sue7AXIHC37vCDF19fUZGroL_6635P-_Io,7011
|
3
|
+
TonieToolbox/audio_conversion.py,sha256=Vw6hFbYZYdt1A9zPlRfQNX7sI1iI-bo0xJM7EEnjDP4,7700
|
4
|
+
TonieToolbox/constants.py,sha256=vjSJTX9TDWV9W7rXERd6W0HO5UyiVFYYlCKAf0nwxJM,1991
|
5
|
+
TonieToolbox/dependency_manager.py,sha256=ZHUhXWnOrRjFq0sI1RKfrg7tMIL3BCsHNmERuZ5ZZqM,14368
|
6
|
+
TonieToolbox/filename_generator.py,sha256=RqQHyGTKakuWR01yMSnFVMU_HfLw3rqFxKhXNIHdTlg,3441
|
7
|
+
TonieToolbox/logger.py,sha256=Up9fBVkOZwkY61_645bX4tienCpyVSkap-FeTV0v730,1441
|
8
|
+
TonieToolbox/ogg_page.py,sha256=-ViaIRBgh5ayfwmyplL8QmmRr5P36X8W0DdHkSFUYUU,21948
|
9
|
+
TonieToolbox/opus_packet.py,sha256=OcHXEe3I_K4mWPUD55prpG42sZxJsEeAxqSbFxBmb0c,7895
|
10
|
+
TonieToolbox/tonie_analysis.py,sha256=4eOzxHL_g0TJFhuexNHcZXivxZ7eb5xfb9-efUZ02W0,20344
|
11
|
+
TonieToolbox/tonie_file.py,sha256=dbtNGFNGxu_sfJl2due3Kz5VNJqnUqDC2A6r_WCxxJI,15127
|
12
|
+
TonieToolbox/tonie_header.proto,sha256=WaWfwO4VrwGtscK2ujfDRKtpeBpaVPoZhI8iMmR-C0U,202
|
13
|
+
TonieToolbox/tonie_header_pb2.py,sha256=s5bp4ULTEekgq6T61z9fDkRavyPM-3eREs20f_Pxxe8,3665
|
14
|
+
tonietoolbox-0.1.0.dist-info/licenses/LICENSE.md,sha256=rGoga9ZAgNco9fBapVFpWf6ri7HOBp1KRnt1uIruXMk,35190
|
15
|
+
tonietoolbox-0.1.0.dist-info/METADATA,sha256=I797RNgbCkKAM2iYK4ty3GP4Mmsl-Pic4AKw3NMCAtQ,8933
|
16
|
+
tonietoolbox-0.1.0.dist-info/WHEEL,sha256=lTU6B6eIfYoiQJTZNc-fyaR6BpL6ehTzU3xGYxn2n8k,91
|
17
|
+
tonietoolbox-0.1.0.dist-info/entry_points.txt,sha256=oqpeyBxel7aScg35Xr4gZKnf486S5KW9okqeBwyJxxc,60
|
18
|
+
tonietoolbox-0.1.0.dist-info/top_level.txt,sha256=Wkkm-2p7I3ENfS7ZbYtYUB2g-xwHrXVlERHfonsOPuE,13
|
19
|
+
tonietoolbox-0.1.0.dist-info/RECORD,,
|