mirror of
https://github.com/samsonjs/media.git
synced 2026-04-01 10:35:48 +00:00
Name [-1,1] the "nominal" range of float samples
Float values are allowed to be > 0dbfs, it is just not nominal as it will might distort the signal when played without attenuation. This is also consistent with [AudioTrack.write(FloatBuffer)](https://developer.android.com/reference/android/media/AudioTrack#write(float[],%20int,%20int,%20int)) that explicitly allows it up to 3dbfs. PiperOrigin-RevId: 321345077
This commit is contained in:
parent
890c4adbed
commit
422f451cf9
1 changed files with 1 additions and 1 deletions
|
|
@ -116,7 +116,7 @@ import java.nio.ByteBuffer;
|
|||
// 32 bit floating point -> 16 bit resampling. Floating point values are in the range
|
||||
// [-1.0, 1.0], so need to be scaled by Short.MAX_VALUE.
|
||||
for (int i = position; i < limit; i += 4) {
|
||||
// Clamp to avoid integer overflow if the floating point values exceed their allowed range
|
||||
// Clamp to avoid integer overflow if the floating point values exceed their nominal range
|
||||
// [Internal ref: b/161204847].
|
||||
float floatValue =
|
||||
Util.constrainValue(inputBuffer.getFloat(i), /* min= */ -1, /* max= */ 1);
|
||||
|
|
|
|||
Loading…
Reference in a new issue