Skip to content

Change default audio format to float32 (#1284) - #1285

Merged
ddennedy merged 6 commits into
masterfrom
default-audio-float32
Aug 30, 2026
Merged

Change default audio format to float32 (#1284)#1285
ddennedy merged 6 commits into
masterfrom
default-audio-float32

Conversation

@ddennedy

@ddennedy ddennedy commented Aug 29, 2026

Copy link
Copy Markdown
Member
ddennedy@pop-os:~/Downloads$ sh audio_null_test.sh

== 1. transparency: no filters, float in, float out ==
default flags:
  PASS  residual -inf dBFS (bit-exact)
mlt_audio_format=f32le:
  PASS  residual -inf dBFS (bit-exact)

== 2. correctness: acompressor vs FFmpeg's own float output ==
reference peak        : 12.589864 dBFS
MLT default peak      : 12.589864 dBFS
MLT f32le peak        : 12.589864 dBFS
default flags:
  PASS  residual -inf dBFS (bit-exact)
mlt_audio_format=f32le:
  PASS  residual -inf dBFS (bit-exact)

== 3. damage: residual written out for listening ==
  ./null-test/residual.wav  peak -inf dBFS
  (normalise it up and play it: this is the distortion the default path adds)

RESULT: all checks passed

@ddennedy ddennedy added this to the v7.42.0 milestone Aug 29, 2026
@ddennedy

Copy link
Copy Markdown
Member Author

@bmatherly This also works in Shotcut after one small change for the peak and waveform meters, which assume 16-bit int

diff --git a/src/sharedframe.cpp b/src/sharedframe.cpp
index 1c5255e0..cb5910eb 100644
--- a/src/sharedframe.cpp
+++ b/src/sharedframe.cpp
@@ -253,7 +253,8 @@ int SharedFrame::get_audio_samples() const
 
 const int16_t *SharedFrame::get_audio() const
 {
-    mlt_audio_format format = get_audio_format();
+    // Scope widgets reading through SharedFrame currently consume signed 16-bit PCM.
+    mlt_audio_format format = mlt_audio_s16;
     int frequency = get_audio_frequency();
     int channels = get_audio_channels();
     int samples = get_audio_samples();

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Changes default and realtime consumer audio paths from S16 to interleaved float32.

Changes:

  • Sets the framework default to f32le.
  • Updates SDL2 consumers for float32 playback and volume handling.
  • Updates RtAudio streams and buffers for float32.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/framework/mlt_consumer.c Changes the default audio format and preserves explicit S16 selection.
src/modules/sdl2/consumer_sdl2.c Uses float32 audio with SDL2.
src/modules/sdl2/consumer_sdl2_audio.c Converts audio-only SDL2 playback to float32.
src/modules/rtaudio/consumer_rtaudio.cpp Converts RtAudio playback to float32.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/framework/mlt_consumer.c
Comment thread src/modules/sdl2/consumer_sdl2.c
Comment thread src/modules/sdl2/consumer_sdl2_audio.c
Comment thread src/modules/rtaudio/consumer_rtaudio.cpp
@bmatherly

Copy link
Copy Markdown
Member

@bmatherly This also works in Shotcut after one small change for the peak and waveform meters, which assume 16-bit int

Thanks for letting me know. I will come up with a general solution for this in Shotcut.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Comment thread src/modules/sdl2/consumer_sdl2.c
Comment thread src/modules/sdl2/consumer_sdl2_audio.c
Comment thread src/modules/rtaudio/consumer_rtaudio.cpp
@ddennedy
ddennedy merged commit 4b44fa9 into master Aug 30, 2026
15 checks passed
@ddennedy
ddennedy deleted the default-audio-float32 branch August 30, 2026 03:21
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

Successfully merging this pull request may close these issues.

3 participants