Closed george-norton closed 10 months ago
Hmm, having written all that maybe the mapping to -0.5..0.5 makes more sense..
What is the status of this?
I think it is the beginning of a discussion rather than something that will be merged soon. I am not clear what the correct behaviour is, and I hear clipping with the change applied, so for sure the preamp needs tweaking.
@george-norton Hmm the firmware in general needs optimization IMO, rewrite it in Rust ;), I'm joking but to really take advantage of all the power the headphones have packed into them there needs to be optimizations overall.
I believe there is an out by one error in the sample normalization code, it doesn't account for the sign bit in the sample.
The min sample value is
0x8000
(-32768
) and the max value is0x7FFF
(32767
), these should map to fixed point values0xF0000000
(-1
) and0x0FFFE000
(0.999969482
) but currently they end up as0xF8000000
(−0.5
) and0x7FFF000
(0.499984741
). In practice this doesn't have much of an effect as when converting back to a sample we also take the wrong bits, but numbers which originated as floats/doubles are twice as big as expected relative to the samples. I suspect there is no major effect with the filter coefficients, but the preamp scaling is probably a bit off.
I think your reasoning makes sense. I also just have this haunting feeling in the back of my head that, for some reason, this might cause distortion. I don't know why. I'll give it a try and see what I find.
Yes, I am hearing clipping. Not looked into it yet, not sure if it is just the preamp that needs fixing up, or if the filters really are producing values that overflow at some point..
I believe there is an out by one error in the sample normalization code, it doesn't account for the sign bit in the sample.
The min sample value is
0x8000
(-32768
) and the max value is0x7FFF
(32767
), these should map to fixed point values0xF0000000
(-1
) and0x0FFFE000
(0.999969482
) but currently they end up as0xF8000000
(−0.5
) and0x7FFF000
(0.499984741
). In practice this doesn't have much of an effect as when converting back to a sample we also take the wrong bits, but numbers which originated as floats/doubles are twice as big as expected relative to the samples. I suspect there is no major effect with the filter coefficients, but the preamp scaling is probably a bit off.