Giter Site home page Giter Site logo

Comments (3)

robertnhart avatar robertnhart commented on June 11, 2024

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

from signal.

robertnhart avatar robertnhart commented on June 11, 2024

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

from signal.

ryohey avatar ryohey commented on June 11, 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

from signal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.