superpoweredSDK / Low-Latency-Android-iOS-Linux-Windows-tvOS-macOS-Interactive-Audio-Platform

🇸Superpowered Audio, Networking and Cryptographics SDKs. High performance and cross platform on Android, iOS, macOS, tvOS, Linux, Windows and modern web browsers.
https://superpowered.com
1.32k stars 284 forks source link

Time stretching issue with some specific files #755

Closed Polovkin closed 12 months ago

Polovkin commented 1 year ago

Superpowered version: 2.6.0

Describe the bug We use Superpower for our experemintal iOS app. The main function is to change the playback speed in real-time. Recently, we encountered a problem where some files, when accelerated to the end of playback, are immediately played back with artifacts, even if the speed is returned to normal.

Steps to Reproduce We have tried to replicate this issue on all platforms, including other applications that use Superpower. These tracks also exhibit the same issue. To reproduce the issue, it is sufficient to take the iOS example from Superpowered Performance IOS Example and replace the standard track with the problematic one.

Expected behavior It is expected that all tracks should play back normally

Actual behavior When launching the player, the track plays normally. However, if the playback speed is changed to any value of acceleration, artifacts appear in the track until the end of playback.

Device information Please list which devices have this bug.

Additional context Here's an example of artifacts in the web version of Superpowered. The artifacts are the same on other platforms. Simply changing the speed to any value will cause them to appear. The track begins playing at around 20 seconds. https://polovkin.github.io

Problem tracks attached

balazsbanto commented 1 year ago

Hi,

Thank you for the well descriptive ticket, we appreciate it!

I tried to reproduce the artifacts that you are mentioning with the Superpowered Performance app and the web app that you nicely created, but I was not able to. To me it seems that the time stretching effect is applied correctly.

Maybe you could use the SuperpoweredRecorder to record one of the test tracks with the applied time stretching effect on, and point out the time internal where you hear the aforementioned artifacts.

Polovkin commented 1 year ago

Thank you for the response.

I cut out the silence in the track (Wagner - Siegfried’s March) so that the artifacts could be heard immediately. I made some changes to the web version - added descriptions and added a new track. Additionally, I added a recording using SuperpoweredRecord, where the artifactes are well audible.

  1. The artifacts that I hear (and my team hears) are similar to micro-interruptions in the track. The Artifacts are particularly noticeable when playing the trumpet at the beginning of the track.
  2. What I meant is that if you change the playback speed just once to any value > 1, these artifacts will be present until the end of the track.
  3. The steps are as follows:
    • Download problem track
    • Replace the default track.mp3 in the iOS example
    • Press play and change the playback speed to any value greater than 1 Please make it louder if possible, and you will definitely hear distortions
balazsbanto commented 1 year ago

Thank you! We also noticed the artifacts you hearing, we are investigating the issue.

balazsbanto commented 1 year ago

Hello,

We have investigated the issue further, and unfortunately we cannot provide a quick fix for this. The time stretcher algorithm is quite complex, and it will take a longer time to mitigate this. We will let you know when we will have a fix for this!

Sorry for the inconvenience, and thank you for your patience!

Polovkin commented 1 year ago

Thank you for your response! My team and I have spent a lot of time studying the issue, but we lack sufficient experience in such algorithms. I would be very interested to know what this could be in general.

If we manage to fix this or if we already understand what the problem is, could you briefly tell me in which area the problem arises? In the track? In the algorithm, or somewhere else?

Thank you!

balazsbanto commented 1 year ago

Unfortunately I can't share implementation details. Currently the algorithm does not handle correctly long instrumental notes, which is the case with classical tracks.

We will get back to you once we fix this issue!

Polovkin commented 1 year ago

Actually, we're not interest in algorithm disclosure (sorry, for misunderstanding). Please, help us to clarify on how to avoid these 'clipping' or artifacts in the input tracks: what exact parameters and metrics provoke this issues (e.g. frequencies, pitch-rate, MIDI-library that used to make an input file, etc.)? So, could we avoid this issue by customizing the input files?

balazsbanto commented 1 year ago

Unfortunately you cannot avoid this issues for now, the clipping will occur in tracks with long notes, without transients.

ivannador commented 12 months ago

Closing this, fix will be provided in a future release.