Skip to content

Add 32-bit signed PCM (“32bits”) output support (synth API + WASAPI) #1737

@jimhen3ry

Description

@jimhen3ry

Related discussion

Discussion #1734

Is your feature request related to a problem?

The Windows WASAPI driver in exclusive mode is unable to use the full resolution of a 24 bit DAC if the audio hardware does not accept samples in IEEE floating point format.

Describe the solution you'd like

This issue proposes adding end-to-end support for signed 32-bit linear PCM output in FluidSynth, exposed via audio.sample-format="32bits", with an initial focus on the WASAPI driver.

The goal is to allow the synth rendering API to deliver 32-bit integer PCM directly to drivers that can negotiate and transport this format (notably WASAPI exclusive mode), while preserving existing behavior for all other formats and drivers.

Describe alternatives you've considered

Allow the WASAPI driver to probe for and use hardware transport formats that support 24 bits or better when audio.sample-format is set to "float".

Additional context

The following tasks are proposed:

  • Refactor integer output rendering to a shared C++11 templated implementation
    • Port the current fluid_synth_write_s16(_channels) implementation to C++ using the existing DSP carve-out pattern (C ABI wrappers + C++ implementation).
    • Preserve existing 16-bit behavior bit-for-bit, including dithering.
  • Add fluid_synth_write_s32(_channels) to the public synth rendering API
    • Signed 32-bit PCM (int32_t)
    • round + clip conversion from internal floating-point samples
    • no dithering
    • API shape parallel to the existing s16 and float variants.
  • Add support for audio.sample-format="32bits" in fluid_wasapi.c
    • Select the 32-bit PCM render path when requested.
    • Ensure correct format negotiation in shared and exclusive modes.
  • Extend fluid_wasapi_device_enumerate.c to probe and report 32-bit PCM support
    • Probe 32-bit PCM formats where appropriate (notably in exclusive mode).
    • Reflect support in the device / format enumeration results.
  • Confirm driver behavior for unrecognized audio.sample-format values
    • WASAPI: handled as part of tasks 3–4.
    • Android drivers: confirmed to fall back to 16-bit PCM; no behavior change proposed.
    • Other drivers: no action required.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions