-
Notifications
You must be signed in to change notification settings - Fork 109
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
Always treat waveform as List<Float> #1663
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small mistake (please fix before merging!), else LGTM
* | ||
* https://github.com/matrix-org/matrix-spec-proposals/blob/travis/msc/audio-waveform/proposals/3246-audio-waveform.md | ||
*/ | ||
internal fun List<Float>.toMSC3246range(): List<UShort> = map { (it / 1024).toInt().toUShort() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you want to write it * 1024
instead of it / 1024
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed :(
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
Kudos, SonarCloud Quality Gate passed! |
MSC3246 specifies the waveform as a list of ints because:
Though DSP on audio data is almost always done using their floating point representation.
This PR brings the float<->int rescaling in the
matrix
module so that the application code can always work with float waveform samples.