Skip to content

Commit 9c7ac18

Browse files
committedOct 18, 2021
v1.0
1 parent d06459d commit 9c7ac18

8 files changed

+164
-7
lines changed
 

‎README.md

+34-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,34 @@
1-
# llusbdac
2-
Low-latency USB DAC for Sony NW-ZX300A
1+
# LLUSBDAC
2+
3+
Low-latency (relatively) USB DAC for Sony NW-ZX300A
4+
5+
## User Guide
6+
7+
* [English](userguide/USERGUIDE_EN.md)
8+
* [中文](userguide/USERGUIDE_ZH.md)
9+
10+
## Features
11+
12+
* Relatively low-latency output (about 50ms)
13+
* Show audio sample rate, bit depth, and CRC32 checksum
14+
* Works as a USB Audio Class 2.0 device
15+
* Only supports PCM audio
16+
17+
<img src="userguide/page1.png" width="216" height="176"/>
18+
19+
## Build
20+
21+
You can use installer to enable [ADB](https://developer.android.com/studio/command-line/adb), then test your build with following commands:
22+
23+
```
24+
./get_toolchain.sh
25+
. setpath
26+
./get_kernel.sh
27+
cd llusbdac
28+
make
29+
make run
30+
```
31+
32+
## License
33+
34+
GPLv2

‎llusbdac_installer.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
import win32event
2121
import wmi
2222

23+
try:
24+
ctypes.windll.user32.SetProcessDPIAware()
25+
except:
26+
pass
27+
2328
def die(status):
2429
win32api.TerminateProcess(win32api.GetCurrentProcess(), status)
2530
def die_after(status, sec):
@@ -507,12 +512,12 @@ def gen_file(file_bytes, target_path):
507512
gen_file(llusbdac_ko, b"/system/lib/modules/llusbdac.ko")
508513
checksum.append(hashlib.sha256(llusbdac_ko).hexdigest().encode() + b" llusbdac.ko")
509514
cmd.append(b"insmod /system/lib/modules/llusbdac.ko")
510-
gen_file(b"\n".join(checksum) + b"\n", b"/system/lib/modules/llusbdac.sha256sum")
515+
gen_file(b"\n".join(checksum) + b"\n", b"/system/lib/modules/llusbdac.sha256")
511516
script.append(b"cat << 'EOF' >> '/system/bin/load_sony_driver'")
512517
script.append(b"")
513518
script.append(b"(")
514519
script.append(b" cd /system/lib/modules")
515-
script.append(b" if busybox sha256sum -c llusbdac.sha256sum; then")
520+
script.append(b" if busybox sha256sum -c llusbdac.sha256; then")
516521
script.append(b" insmod safeloader.ko 'script=\"%s\"'" % b";".join(cmd))
517522
script.append(b" fi")
518523
script.append(b")")
@@ -532,13 +537,13 @@ def gen_file(file_bytes, target_path):
532537

533538
# run launcher
534539
ProgressManager.progress(S["RUN_LAUNCHER"])
535-
si = win32process.STARTUPINFO()
536-
si.dwFlags = win32con.STARTF_USESHOWWINDOW
537-
si.wShowWindow = win32con.SW_MINIMIZE
538540
try:
539541
win32file.DeleteFile(os.path.abspath(package_exe) + ":Zone.Identifier")
540542
except:
541543
pass
544+
si = win32process.STARTUPINFO()
545+
si.dwFlags = win32con.STARTF_USESHOWWINDOW
546+
si.wShowWindow = win32con.SW_MINIMIZE
542547
hProcess, hThread, dwProcessId, dwThreadId = win32process.CreateProcess(package_exe, None, None, None, 0, 0, None, None, si)
543548
def launcher_alive():
544549
return win32process.GetExitCodeProcess(hProcess) == win32con.STILL_ACTIVE

‎userguide/USERGUIDE_EN.md

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# LLUSBDAC User Guide
2+
3+
## Features
4+
5+
LLUSBDAC can change your NW-ZX300A as a USB sound card. The overall latency is about 50 milliseconds. It can also show infomation while playing audio, like sample rate, bit depth, CRC32 checksum, etc. Only PCM audio is supported, DSD audio is not supported.
6+
7+
Installer only supports Windows operating system. However, after installation into the device, it can work without Windows. Supported operating systems are:
8+
9+
* Windows 10, 1703 or higher
10+
* macOS, iOS, iPadOS
11+
* Linux
12+
13+
## Installation
14+
15+
Connect your device to a computer as "USB mass storage device". Then run `llusbdac_installer.exe` and follow instructions on screen.
16+
17+
## Usage
18+
19+
After installation, LLUSBDAC is disabled by default. To enable LLUSBDAC, please switch your device to USB DAC mode. Then press one of physical button "⏮", "⏯", "⏭", three times. After startup, LLUSBDAC will show its user interface. Please connect your device to your computer. The computer will automatically detect a sound card with "LLUSBDAC" in its name, no additional driver is needed.
20+
21+
After enabled, LLUSBDAC will keep working. To disable it, please reboot your device.
22+
23+
## Interface
24+
25+
LLUSBDAC will display information while working. You can use physical button "⏮", "⏯", or "⏭" to switch page. The meaning of each page is:
26+
27+
|Sample|Meaning|
28+
|-|-|
29+
|<img src="page1.png" width="216" height="176"/>|`STATE`: Current state<br>`FORMAT`: Sample rate, bit depth<br>`TIME`: Audio length<br>`SAMPLE`: Audio frames<br>`CRC32`: Checksum<br>`BUFFER`: Buffer time<br>`ERROR`: Count of detected errors|
30+
|<img src="page2.png" width="216" height="176"/>|CRC32 checksum of detected tracks<br>Duplicate items are in green<br>Error items are in red|
31+
|<img src="page3.png" width="216" height="176"/>|Audio length of each track<br>The color meaning is same as last page|
32+
|<img src="page4.png" width="216" height="176"/>|Software version, license information, etc.|
33+
34+
## Checksum Tool
35+
36+
LLUSBDAC's CRC32 checksum is different from other softwares. It trimmed silent samples from calculation. You can use `audio_crc32.exe` to calculate such checksums:
37+
38+
1. Download [ffmpeg](https://www.ffmpeg.org/download.html), put `ffmpeg.exe` along with `audio_crc32.exe`
39+
2. Drag your audio files (or folders) onto the icon of `audio_crc32.exe`
40+
3. A window with calculation progress will show up. It will show results as a table after calculation completed.
41+
42+
Sample results:
43+
44+
```
45+
--------------+-------------------------------------------+-----------------
46+
TIME | S16LE S24_3LE S32LE | FILE
47+
--------------+-------------------------------------------+-----------------
48+
00:04:41.787 | 16:c08f2dfc [24:E805E786] [32:D855963E] | 0012078980.flac
49+
00:04:41.789 | 16:9424690a [24:793B394A] [32:F4EC9102] | 0012078981.flac
50+
00:07:47.040 | 16:94273ba3 [24:4A61B034] [32:189F5CAD] | 0012078982.flac
51+
--------------+-------------------------------------------+-----------------
52+
```
53+
54+
* `TIME`: Length of audio after trimming
55+
* `S16LE`, `S24_3LE`, `S32LE`: The checksum value after converting audio to 16, 24 or 32 bits. Lossless convert is shown as uppercase with brackets. Lossy convert is shown as lowercase without brackets.
56+
* `FILE`: File name of audio file
57+
58+
## Source code
59+
60+
&emsp;&emsp;This program is released under GPLv2. You can get the source code from [GitHub](https://github.com/zhangboyang/llusbdac).

‎userguide/USERGUIDE_ZH.md

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# LLUSBDAC 使用说明
2+
3+
## 功能说明
4+
5+
&emsp;&emsp;LLUSBDAC 可以使 NW-ZX300A 作为 USB 外接声卡,以相对较低的延迟(约为 50 毫秒)输出声音。此外还可显示音频相关信息,如采样率、位深度、CRC32 校验和等。本软件只支持 PCM 格式音频,不支持 DSD 格式音频。
6+
7+
&emsp;&emsp;安装工具仅支持 Windows 系统,但成功安装到设备中后,后续使用过程无须 Windows 系统。使用时支持的系统如下:
8+
9+
* Windows 10, 1703 版本或更高
10+
* macOS, iOS, iPadOS
11+
* Linux
12+
13+
## 安装方法
14+
15+
&emsp;&emsp;将设备以“USB 大容量存储”模式连接至计算机,运行 `llusbdac_installer.exe`,然后按屏幕指示操作即可。
16+
17+
## 使用方法
18+
19+
&emsp;&emsp;安装后 LLUSBDAC 默认处于禁用状态。要使用 LLUSBDAC,请将设备调至 USB DAC 状态后,连按三次物理按钮“⏮”、“⏯”、“⏭”中任意一个。启用后, LLUSBDAC 会在屏幕上覆盖显示图形界面。此时请将设备连接至计算机,计算机会自动识别到标有 LLUSBDAC 字样的声卡,无须安装任何额外驱动程序。
20+
21+
&emsp;&emsp;启用 LLUSBDAC 后,它会一直处于工作状态。若要禁用 LLUSBDAC,只需将播放器设备关机、重新启动即可。
22+
23+
## 界面说明
24+
25+
&emsp;&emsp;在 LLUSBDAC 运行过程中,可按物理按钮“⏮”、“⏯”、“⏭”切换页面。每个页面显示的信息的含义如下:
26+
27+
|页面示例|含义|
28+
|-|-|
29+
|<img src="page1.png" width="216" height="176"/>|`STATE`:当前状态<br>`FORMAT`:音频采样率、位深度<br>`TIME`:音频时长<br>`SAMPLE`:音频样本数<br>`CRC32`:数据校验和<br>`BUFFER`:缓冲时长<br>`ERROR`:检测到的错误数|
30+
|<img src="page2.png" width="216" height="176"/>|已检测出的音轨的 CRC32 校验和<br>重复项以绿色显示<br>错误项以红色显示|
31+
|<img src="page3.png" width="216" height="176"/>|上一页中的对应音轨的时长<br>颜色的意义与上一页相同|
32+
|<img src="page4.png" width="216" height="176"/>|软件版本、许可证等信息|
33+
34+
## 校验和计算工具
35+
36+
&emsp;&emsp;LLUSBDAC 显示的 CRC32 校验和,与一般软件不同,计算时剔除了音频前后的无声音部分。可以使用随附的 `audio_crc32.exe` 计算音频文件的校验和。使用方法如下:
37+
38+
1. 下载 [ffmpeg](https://www.ffmpeg.org/download.html),并将其中的 `ffmpeg.exe``audio_crc32.exe` 放置在同一目录下;
39+
2. 将待计算的音频文件(文件夹)用鼠标拖放到 `audio_crc32.exe` 的图标上;
40+
3. 拖放后会弹出显示计算进度的窗口,计算完毕后,计算结果会以表格形式显示在窗口中。
41+
42+
&emsp;&emsp;计算结果示例:
43+
44+
```
45+
--------------+-------------------------------------------+-----------------
46+
TIME | S16LE S24_3LE S32LE | FILE
47+
--------------+-------------------------------------------+-----------------
48+
00:04:41.787 | 16:c08f2dfc [24:E805E786] [32:D855963E] | 0012078980.flac
49+
00:04:41.789 | 16:9424690a [24:793B394A] [32:F4EC9102] | 0012078981.flac
50+
00:07:47.040 | 16:94273ba3 [24:4A61B034] [32:189F5CAD] | 0012078982.flac
51+
--------------+-------------------------------------------+-----------------
52+
```
53+
54+
* `TIME`:剔除静音后的音频时长
55+
* `S16LE``S24_3LE``S32LE`:将音频转换至 16、24、32 位时,对应的 CRC32 校验和的值;无损转换以大写和方括号标出,有损转换以小写和无括号标出
56+
* `FILE`:音频文件的文件名
57+
58+
## 源代码
59+
60+
&emsp;&emsp;本程序以 GPLv2 许可证发布,源代码可从 [GitHub](https://github.com/zhangboyang/llusbdac) 上获得。

‎userguide/page1.png

3.08 KB
Loading

‎userguide/page2.png

2.34 KB
Loading

‎userguide/page3.png

2.23 KB
Loading

‎userguide/page4.png

2.1 KB
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.