Indent with tabs, align with spaces
As far as I can see in the code, you just need to fix a few macros: SOX_UNSIGNED_8BIT_TO_SAMPLE SOX_SIGNED_8BIT_TO_SAMPLE SOX_UNSIGNED_16BIT_TO_SAMPLE SOX_SIGNED_16BIT_TO_SAMPLE SOX_UNSIGNED_24BIT_TO_SAMPLE SOX_SIGNED_24BIT_TO_SAMPLE It seems quite easy to fix, I don't see any issues with it. The fact that the sox_sample_t is signed is not an issue at all, it requires just an additional bit operation and that's it. If I make a patch, will you accept it?
As far as I can see in the code, you just need to fix a few macros: SOX_UNSIGNED_8BIT_TO_SAMPLE SOX_SIGNED_8BIT_TO_SAMPLE SOX_UNSIGNED_16BIT_TO_SAMPLE SOX_SIGNED_16BIT_TO_SAMPLE SOX_UNSIGNED_24BIT_TO_SAMPLE SOX_SIGNED_24BIT_TO_SAMPLE It seems quite easy to fix, I don't see any issues with it. The fact that the sox_sample_t is signed is not an issue at all, just an additional bit operation and that's it. If I make a patch, will you accept it?
As far as I can see in the code, you just need to fix the macros like SOX_UNSIGNED_16BIT_TO_SAMPLE and others. It seems quite easy to fix. If I make a patch, will you accept it?
There is loss of information. Yeah, if you convert uint8 -> uint16 -> uint8 using current buggy method, you will get the same result. But it will happen just because conversion from uint16 to uint8 is lossy, and the new precision is not enough to represent the difference which was caused by current buggy conversion from uint8 to uint16. float32 has enough precision to represent the difference. When you use current method, uint8 -> uint16 -> float32 will have measurable difference from uint8 -> float32....
There is loss of information. Yeah, if you convert uint8 -> uint16 -> uint8 using current buggy method, you will get the same result. But it will happen just because conversion from uint16 to uint8 is lossy, and the new precision is not enough to represent the difference which was caused by current buggy conversion from uint8 to uint16. float32 has enough precision to represent the difference. When you use current method, uint8 -> uint16 -> float32 will have reasonable difference from uint8 -> float32....
But there is loss of information. uint8 -> float and uint8 -> uint16 -> float will give you different results, but it shouldn't. The maximum amplitude will be a bit smaller. Actually, I created this ticket exactly because I proposed to my friend to use SoX to convert stream of 8-bit samples to 16-bit, and then he complained me that it affected the sound somehow. It was confusing, but later we understood what was the reason. Conversion from 8-bit to 16-bit shouldn't cause any difference to the signal....
But there is loss of information. uint8 -> float and uint8 -> uint16 -> float will give you different results, but it shouldn't. Actually, I created this ticket exactly because I proposed to my friend to use SoX to convert stream of 8-bit samples to 16-bit, and then he complained me that it affected the sound somehow. It was confusing, but later we understood what was the reason. Conversion from 8-bit to 16-bit shouldn't cause any difference to the signal. Now, when you convert uint8 to uint16, and...