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

Width issue #6

Closed
cortnum opened this issue Feb 21, 2018 · 2 comments
Closed

Width issue #6

cortnum opened this issue Feb 21, 2018 · 2 comments

Comments

@cortnum
Copy link

cortnum commented Feb 21, 2018

Hi,

This is an otherwise amazing framework, however there is one big issue that is plauging me, which prevents us from using this in our app.

When I set a width for the waveform, it does not properly fill out the image. It is as if it just appends a bunch of "silence" for the extra width, until I hit a certain width, where it starts rendering correctly again until it once more appends "silence" when making the image bigger.

I have attached screenshots of widths 260 (which shows only silence), 264 (which is almost perfect) and 300 (which shows "appended silence").

screenshot

screenshot

screenshot

Here is our code:

    AudioExporter.instance.exportSongToM4A(song: self.song!, completionHandler: { (success) in
        let waveformImageDrawer = WaveformImageDrawer()
        let waveformSize = CGSize(width: 264, height: sequenceHeight)
        let scale = UIScreen.main.scale

        DispatchQueue.main.async {
            print("export finished: \(success)")
            if success {
                if let trackWaveformImage = waveformImageDrawer.waveformImage(fromAudioAt: self.song!.exportUrlM4A(),
                                                                              size: waveformSize,
                                                                              color: UIColor.white,
                                                                              backgroundColor: UIColor.clear,
                                                                              style: .filled,
                                                                              position: .middle,
                                                                              scale: scale) {
                    
                    DispatchQueue.main.async {
                        let trackWaveformImageView = UIImageView(frame: CGRect(origin: CGPoint(x: x, y: y), size: waveformSize))
                        trackWaveformImageView.image = trackWaveformImage
                        trackWaveformImageView.contentMode = .scaleToFill
                        
                        self.waveformViews.append(trackWaveformImageView)
                        self.sequenceScrollView.addSubview(trackWaveformImageView)
                        self.sequenceScrollView.bringSubview(toFront: self.scrubberImageView)
                    }
                }
            } else {
                //TODO: Nothing?
            }
        }
    })

Any help would be appreciated

Cheers,

/Mikkel

@dmrschmidt
Copy link
Owner

dmrschmidt commented Oct 11, 2018

Hey Mikkel,

sorry for the uber-late reply. I haven't been paying a lot of attention to github and the notification here drowned among all the others unfortunately. I'm assuming it is way too late to ask, but would it still be possible to provide me with one of the audio assets you used, which produced this problem so I can replicate it and fix the issue?

I'd very much appreciate it :) Thanks, Dennis

@dmrschmidt
Copy link
Owner

closed with #8 and #12

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