Skip to content

Conversation

cactysman
Copy link
Contributor

When I first learned of DCA back in April and checked out the example in this repository, I grew quite frustrated (and many others probably have, too) since none of the DCA files I created myself using the original Go program following its manual worked at all but the nico.dca test file that is included in here happened to work just fine.

I decided to have a closer look at it and realized that, for some obscure reason, its headers use 4 bytes as opposed to the actual int16 type header the original DCA tool produces.

I've done a bit of research, assuming nico.dca might have been created with an older iteration of DCA or something, but I couldn't really find anything specifying a header size other than 2 bytes.

Anyways, this here fixes the writeOpus function in the voice example, now correctly reading DCA0 files.

In the second commit I also included a bit of logic detecting and properly mitigating 4-byte-header DCA0 files in case they're actually more common than how it seems. If that's not desired, I can easily just trim back the branch and update nico.dca to use 2-byte headers instead.

@topi314
Copy link
Member

topi314 commented Sep 28, 2025

While I do appreciate the effort you put into fixing this
I am not exactly sure I want to implement a full spec compliant DCA reader in here

How about just documenting it expects DCA0 4 bytes? 😅

@topi314
Copy link
Member

topi314 commented Sep 29, 2025

just checked this pr again after a good night sleep.
so apparently nico.dca uses 4 bytes (uint32) instead of 2 bytes (int16) headers.
I copied that file from a different repo at that time (including the code to parse it).

Feel free to re-encode it as 2 bytes (int16) header & adjust the code to read that too lol
also please add a comment saying it expects DCA0

@topi314 topi314 merged commit d5695ad into disgoorg:master Oct 6, 2025
1 check passed
@topi314
Copy link
Member

topi314 commented Oct 6, 2025

thanks!

@cactysman cactysman deleted the fix/dca-voice-example branch October 6, 2025 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants