-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MacOS example making incorrect waveform / bug in transform code #94
Comments
Thanks for the heads-up. This is quite likely, I can only really provide Android support and know nothing about the iOS and MacOS parts. That said, I need to have a look at the docs. Ideally, the MacOS/iOS backends ensure the data we get is little endian, especially if it can vary between devices (as is the case for Android). If the platforms guarantee a specific endiannes, all the better. Any help from your side to that regard is greatly appreciated! |
I don't think you should worry about keeping the API crude. Audio hardly consumes any CPU these days. |
you misunderstand. The issue is not processing power, the issue is my lack of knowledge and testability of Apple's operating systems. Regarding Big Endian on Android: The developers of the JVM were on crack, I believe. Point is, Java uses BE internally. |
Sparc is big-endian, not sure how all that played out internally at Sun. |
I was playing around with the MacOS example. First, I noticed that the waveform seemed very gained/amplified.
Then I noticed the data is actually wrapping around - one example:
-27649.0, -28673.0, -29953.0, -31489.0, 32767.0, 31999.0, 31743.0, 32511.0, -31489.0, -29441.0,
Something is wrong.
I started by looking at your swift code.
I verified the waveform looks good here: let clamped = min(max(-2.0, val), 2.0)
But you could consider clamping at +/-4 instead. (Not sure what is supposed to be max, but I can easily produce values even higher than 4).
Then I removed the .transform(MicStream.toSampleStream) and looked at the data - the bytes are swapped (LSB comes first).
So then I wrote this to handle byte swapping and the two's complement representation:
Data looks good now. I haven't looked carefully at your code, but something is quite wrong with the transform.
Thanks for a very nice piece of software.
The text was updated successfully, but these errors were encountered: