Skip to content
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

Waveforms rendered don't look consistent on different resolution devices #140

Open
CheemaAneet opened this issue Mar 30, 2020 · 3 comments

Comments

@CheemaAneet
Copy link

CheemaAneet commented Mar 30, 2020

Hi @fulldecent ,

Let me begin by wishing you good health, hope you're well and keeping safe in these times.

There are a couple of strange issues that we are noticing rendering audio samples on various resolution devices that we look to support,

Firstly, there are times we don't see the center line(silent sections in the track) on different resolutions,

For you're reference, here are screen shots from two different devices of the same waveform

Screenshot taken from iPhone 11 pro - Center line not visible

Screenshot 2020-03-30 at 2 58 59 PM

Screenshot taken from iPhone 11 - Center line renders fine

Screenshot 2020-03-30 at 3 00 10 PM

Secondly, Here's are a couple more screenshots hightlighting the other issue that we are facing,

Screenshot from iPhone 11 pro - Waveforms rendered have some shadowy overlaps at certain portions in the track, the initial few samples are drawn fine but the rest of it seem to be off.

Screenshot 2020-03-30 at 2 53 44 PM

Screenshot from iPhone 11 - Waveforms rendered look fine without any shadowy overlaps

Screenshot 2020-03-30 at 2 56 38 PM

How is it that some resolutions render just fine, while others don't.

Whats likely causing this behaviour ?

Thanks & looking forward to hearing from you... Stay safe !!

@CheemaAneet
Copy link
Author

@fulldecent thoughts ?

@fulldecent
Copy link
Owner

Hello and thank you for sharing. I do appreciate that you are sending screenshots from hardware devices, as this library is sensitive to hardware acceleration and some DPI intricacies.

I wonder if this is being caused by not enough pixels getting rendered.

We have some specific configuration options available for this:

Currently they are marked private:

https://github.com/fulldecent/FDWaveformView/blob/master/Sources/FDWaveformView/FDWaveformView.swift#L119-L141

    /// The portion of extra pixels to render left and right of the viewable region
    private var horizontalBleedTarget = 0.5

    /// The required portion of extra pixels to render left and right of the viewable region
    /// If this portion is not available then a re-render will be performed
    private var horizontalBleedAllowed = 0.1 ... 3.0

    /// The number of horizontal pixels to render per visible pixel on the screen (for anti-aliasing)
    private var horizontalOverdrawTarget = 3.0

    /// The required number of horizontal pixels to render per visible pixel on the screen (for anti-aliasing)
    /// If this number is not available then a re-render will be performed
    private var horizontalOverdrawAllowed = 1.5 ... 5.0

    /// The number of vertical pixels to render per visible pixel on the screen (for anti-aliasing)
    private var verticalOverdrawTarget = 2.0

    /// The required number of vertical pixels to render per visible pixel on the screen (for anti-aliasing)
    /// If this number is not available then a re-render will be performed
    private var verticalOverdrawAllowed = 1.0 ... 3.0

    /// The "zero" level (in dB)
    fileprivate let noiseFloor: CGFloat = -50.0

Would you please modifying these to see if there is an impact on your rendering across hardware devices?

Also would you please upload an audio specimen if possible?

If you are seeing good results by modifying those values it would be a great motivation to switch them from private to public variables.

@fulldecent
Copy link
Owner

Please let me know if the above does help. If so, we can make these configurations public or at least document the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants