Oh, it sounds like we have some race somewhere ..:( adding condition
(that never fired!) to int FileSndFile::write_samples() fixed 24 bit
RAW PCM

Note - I set whole thing to write to ramdisk (/dev/shm) so may be it
exposes some races ... or we need to update libsndfile ..(

On Fri, Jan 19, 2024 at 8:16 PM Andrew Randrianasulu
<randrianas...@gmail.com> wrote:
>
> argh, may be better to just divide by 100 instead of 104 ...
>
> still not sure WHY it needed?
>
> 24-bit raw PCM still broken ..:(
>
> On Fri, Jan 19, 2024 at 6:32 PM Andrew Randrianasulu
> <randrianas...@gmail.com> wrote:
> >
> > try andy dv test file, render only audio as Big Endian, Signed, 16 bits.
> >
> > Load it back and watch too loud audio.
> >
> > note: wav file not tested
From 8828f9d0296291033f19c4eaf80f2faebc642371 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <randrianas...@gmail.com>
Date: Fri, 19 Jan 2024 21:35:20 +0300
Subject: [PATCH 3/3] For some reason putting condition + printf prevent 24 bit
 raw PCM garbage

---
 cinelerra-5.1/cinelerra/filesndfile.C | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/cinelerra-5.1/cinelerra/filesndfile.C b/cinelerra-5.1/cinelerra/filesndfile.C
index 516b0972..2d5dc188 100644
--- a/cinelerra-5.1/cinelerra/filesndfile.C
+++ b/cinelerra-5.1/cinelerra/filesndfile.C
@@ -346,7 +346,9 @@ int FileSndFile::write_samples(double **buffer, int64_t len)
 //if(sample > 1.0 || sample < -1.0) printf("FileSndFile::write_samples %f\n", sample);
 //printf("FileSndFile::write_samples %d %d\n", asset->bits, BITSFLOAT);
 			if(asset->bits != BITSFLOAT) CLAMP(sample, -1.0, (32767.0 / 32768.0));
-			if(asset->format == FILE_PCM && asset->bits == BITSLINEAR16) sample = sample/100;
+			if(asset->format == FILE_PCM && asset->bits == BITSLINEAR16)
+			sample = sample/100;
+			if (sample > 1.0f) printf("non-normalized sample value\n");
 			temp_double[j * asset->channels + i] = sample;
 		}
 	}
-- 
2.35.8

-- 
Cin mailing list
Cin@lists.cinelerra-gg.org
https://lists.cinelerra-gg.org/mailman/listinfo/cin

Reply via email to