Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wario Master of Disguise soundfont doesnt work #290

Open
ExGuestCJ opened this issue Nov 28, 2023 · 3 comments
Open

Wario Master of Disguise soundfont doesnt work #290

ExGuestCJ opened this issue Nov 28, 2023 · 3 comments

Comments

@ExGuestCJ
Copy link

Describe the bug
This soundfont doesnt work, when i add it and open it, theres a message saying "todo" and then it doesnt let me use it

Expected behavior
Being able to use the soundfont

Screenshots
image

@robertnhart
Copy link
Collaborator

It looks like Signal can't handle a soundfont with 24-bit samples.

As a workaround, you might be able to use a soundfont editor to make a 16-bit version of the soundfont.

For example, in the Polyphone soundfont editor, you can open the soundfont, change the "Samples" dropdown box from "24 bits" to "16 bits", then save as a new soundfont. That seems to make it into a 16-bit soundfont which works in Signal.

polyphone-16-bit

@robertnhart
Copy link
Collaborator

I did a quick look at the sf2 format by reading this document:

SoundFont2 Structure - sdta Chunk

It looks like an sf2 file can store either 16-bit sounds or 24-bit sounds. When 24-bit sounds are used, it looks like they are actually stored as 16-bit sounds plus data for the additional 8 bits.

The "TODO" error message comes the following place in this file:

node_modules\@ryohey\sf2parser\src\Parser.ts

function parseSdtaList(chunk: Chunk, data: Uint8Array): Chunk {
  const chunkList = getChunkList(chunk, data, "LIST", "sdta")

  if (chunkList.length !== 1) {
    throw new Error("TODO")
  }

  return chunkList[0]
}

(see source code at npm @ryohey/sf2parser Code src/Parser.ts or GitHub ryohey/sf2synth.js Parser.ts)

According to my tests, it looks like you can remove if (chunkList.length !== 1) { throw new Error("TODO") } so this function will always return chunkList[0] and it seems to just use the highest 16 bits of 24-bit sounds.

If you want to try out this change, I wrote some code you can use to patch Signal using the browser console or a JavaScript bookmark: Signal Customizations

@ryohey
Copy link
Owner

ryohey commented May 20, 2024

thanks @robertnhart I will fix it.

we can ignore 8bit lsb as you say i can find some real codes which handles correctly. I might do same thing that treats samples as 32bit

https://github.com/FluidSynth/fluidsynth/blob/master/src/sfloader/fluid_sffile.c#L2206

https://github.com/FluidSynth/fluidsynth/blob/f9bde410216766c1117cd07b349740e9804773ca/src/rvoice/fluid_rvoice.h#L228

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants