Skip to content

Conversation

@saleniuk
Copy link
Contributor

@saleniuk saleniuk commented Nov 7, 2025

TaskWPB-19814 Add Built-in Audio Amplitude Visualization Support to AVS (Replace Amplituda Dependency)


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

  • updated kalium to the one that uses AVS version that contains our built-in solution for calculating audio waveform which is optimized to make it faster
  • code related to building wave forms is implemented inside kalium and it shares AudioNormalizedLoudnessBuilder along with use case to update “normalized_loudness” after building it
  • “equalize” extension function is updated to scale values in accordance with the global max value which is 255 instead of taking local max from the list, thanks to that all wave masks are unified; also there’s a parameter to choose whether values should start from 0 or 1 (by default from 1 as it’s how we draw it)
  • “average” extension function replaced with “sampling” function which is based on linear interpolation, thanks to that we get the exact number of elements that we want
  • added mapping functions between “waves mask” (list of integers) and “normalized loudness” (array of unsigned bytes saved as ByteArray)
  • fetching waves mask replaced with “get or build” - first it takes value from database, only if null or empty then it builds a new waves mask and updates it in the database
  • changed behavior after sending audio message to close the additional options (currently it was staying and covering newly sent message)
  • added passing waves mask data after recording audio message if it has managed to build before user clicked “send” to not build it again unnecessarily but instead already pass it to the message content data
  • updated AudioMessageSlider to become adaptive/responsive and use sampling function to get proper number of elements on wave form to fit the available width
  • extracted AudioMessageSliderTrack, moved to track composable lambda of Slider and changed the way progress is colored, from selecting subsequent elements to using blend mode on whole wave mask - less recompositions and it fixes situations where whole element was already painted before the slider thumb covered it

Dependencies (Optional)

If there are some other pull requests related to this one (e.g. new releases of frameworks), specify them here.

Needs releases with:

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

How to Test

Send or receive any audio message or asset message with audio file.

Attachments (Optional)

Before After
amplituda_before.mp4
amplituda_after.mp4
record_and_send_before.mp4
record_and_send_after.mp4
short_audio_before short_audio_after
progress_before progress_after

PR Post Submission Checklist for internal contributors (Optional)

  • Wire's Github Workflow has automatically linked the PR to a JIRA issue

PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

…mplituda-with-avs-v2

# Conflicts:
#	app/src/main/kotlin/com/wire/android/ui/home/conversations/model/messagetypes/audio/AudioMessageType.kt
…mplituda-with-avs-v2

# Conflicts:
#	app/src/main/kotlin/com/wire/android/ui/home/conversations/sendmessage/SendMessageViewModel.kt
#	app/src/test/kotlin/com/wire/android/ui/home/conversations/sendmessage/SendMessageViewModelTest.kt
…mplituda-with-avs-v2

# Conflicts:
#	app/src/main/kotlin/com/wire/android/ui/home/conversations/sendmessage/SendMessageViewModel.kt
#	kalium
…mplituda-with-avs-v2

# Conflicts:
#	app/src/main/kotlin/com/wire/android/ui/home/conversations/messages/item/RegularMessageItem.kt
#	kalium
@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

@saleniuk looks like you are rolling back kalium to a previous commitish.

This means that the PR's target branch (develop) is using a newer version of Kalium, and the changes in this PR will rollback Kalium to an older version.

develop This PR
55ee19f3eadcfa2e1f01a9e8c256ecdaf674d682 c506dd0b645cf574776669d7e437ec7751a65187

Is this intentional?

@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

@saleniuk looks like you are rolling back kalium to a previous commitish.

This means that the PR's target branch (develop) is using a newer version of Kalium, and the changes in this PR will rollback Kalium to an older version.

develop This PR
55ee19f3eadcfa2e1f01a9e8c256ecdaf674d682 c506dd0b645cf574776669d7e437ec7751a65187

Is this intentional?

@pull-request-size pull-request-size bot added size/L and removed size/M labels Nov 7, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

@saleniuk looks like you are rolling back kalium to a previous commitish.

This means that the PR's target branch (develop) is using a newer version of Kalium, and the changes in this PR will rollback Kalium to an older version.

develop This PR
55ee19f3eadcfa2e1f01a9e8c256ecdaf674d682 c506dd0b645cf574776669d7e437ec7751a65187

Is this intentional?

@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

@saleniuk looks like you are rolling back kalium to a previous commitish.

This means that the PR's target branch (develop) is using a newer version of Kalium, and the changes in this PR will rollback Kalium to an older version.

develop This PR
55ee19f3eadcfa2e1f01a9e8c256ecdaf674d682 c506dd0b645cf574776669d7e437ec7751a65187

Is this intentional?

@codecov
Copy link

codecov bot commented Nov 7, 2025

Codecov Report

❌ Patch coverage is 39.08046% with 53 lines in your changes missing coverage. Please review.
✅ Project coverage is 47.39%. Comparing base (c179728) to head (10f96ce).

Files with missing lines Patch % Lines
...rsations/attachment/MessageAttachmentsViewModel.kt 0.00% 13 Missing ⚠️
...dia/audiomessage/ConversationAudioMessagePlayer.kt 45.45% 7 Missing and 5 partials ⚠️
...android/media/audiomessage/AudioWavesMaskHelper.kt 55.00% 4 Missing and 5 partials ⚠️
...tions/model/messagetypes/audio/AudioMessageType.kt 0.00% 8 Missing ⚠️
...essagecomposer/recordaudio/RecordAudioViewModel.kt 28.57% 4 Missing and 1 partial ⚠️
...oid/media/audiomessage/RecordAudioMessagePlayer.kt 0.00% 3 Missing ⚠️
...c/main/kotlin/com/wire/android/util/FileManager.kt 0.00% 2 Missing ⚠️
.../conversations/sendmessage/SendMessageViewModel.kt 80.00% 0 Missing and 1 partial ⚠️

❌ Your patch check has failed because the patch coverage (39.08%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4399      +/-   ##
===========================================
+ Coverage    47.31%   47.39%   +0.07%     
===========================================
  Files          532      532              
  Lines        17839    17861      +22     
  Branches      3029     3033       +4     
===========================================
+ Hits          8441     8465      +24     
+ Misses        8499     8485      -14     
- Partials       899      911      +12     
Files with missing lines Coverage Δ
...ndroid/media/audiomessage/AudioMessageViewModel.kt 87.50% <100.00%> (ø)
...android/ui/home/conversations/model/AssetBundle.kt 50.00% <100.00%> (+2.38%) ⬆️
...ome/conversations/usecase/HandleUriAssetUseCase.kt 88.09% <100.00%> (+0.59%) ⬆️
.../conversations/sendmessage/SendMessageViewModel.kt 77.68% <80.00%> (-0.24%) ⬇️
...c/main/kotlin/com/wire/android/util/FileManager.kt 10.00% <0.00%> (-0.17%) ⬇️
...oid/media/audiomessage/RecordAudioMessagePlayer.kt 1.13% <0.00%> (ø)
...essagecomposer/recordaudio/RecordAudioViewModel.kt 64.61% <28.57%> (-0.34%) ⬇️
...tions/model/messagetypes/audio/AudioMessageType.kt 0.00% <0.00%> (ø)
...android/media/audiomessage/AudioWavesMaskHelper.kt 55.00% <55.00%> (+52.05%) ⬆️
...dia/audiomessage/ConversationAudioMessagePlayer.kt 67.79% <45.45%> (+0.73%) ⬆️
... and 1 more

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c179728...10f96ce. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…mplituda-with-avs-v2

# Conflicts:
#	app/src/main/kotlin/com/wire/android/di/accountScoped/MessageModule.kt
#	kalium
Copy link
Contributor

@yamilmedina yamilmedina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small nitpick, can be ignored :D

@sonarqubecloud
Copy link

@saleniuk saleniuk added this pull request to the merge queue Nov 14, 2025
Merged via the queue into develop with commit 9c0d72c Nov 14, 2025
16 of 17 checks passed
@saleniuk saleniuk deleted the refactor/replace-amplituda-with-avs-v2 branch November 14, 2025 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants