dmrschmidt / DSWaveformImage

Generate waveform images from audio files on iOS, macOS & visionOS in Swift. Native SwiftUI & UIKit views.
MIT License
978 stars 109 forks source link

Why can't I use RecordingDelegate for my own AudioRecorder? #53

Closed Medef closed 1 year ago

Medef commented 1 year ago

Hi! I can't inherit from RecordingDelegate and I can't access SCAudioManager. I'm trying to use WaveformLiveCanvas with samples, but I can't figure out how this is implemented in example of yours. At the moment I have this implementation, but it doesn't quite work correctly Thank you in advance for your help! Снимок экрана 2022-12-15 в 16 52 17

dmrschmidt commented 1 year ago

That’s correct. It’s not part of the library itself, as that’s out of scope. It’s just there for illustration purposes.

You can of course copy & paste the code from the example app if you like to use it as a starting point in your app.

Cheers, Dennis On 15. Dec 2022 at 14:51 +0100, medef00 @.***>, wrote:

I can't inherit from RecordingDelegate and I can't access SCAudioManager. I'm trying to use WaveformLiveCanvas with samples, but I can't figure out how this is implemented in example of yours. At the moment I have this implementation, but it doesn't quite work correctly — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

Medef commented 1 year ago

Thank you for your reply. Please tell me, what time interval do you use in your manager? As far as I understand the interval is 0.1 and 3 identical 'linear' values are added to the array. At the moment I have the problem that the wave is constantly changing, when using WaveformLiveCanvas like this

Cheers, Eugene

https://user-images.githubusercontent.com/40383119/208052169-327c135e-0275-487e-a163-c1f9497aec67.mov

dmrschmidt commented 1 year ago

Hey @Medef,

that's interesting... Looks like some offset calculations are getting out of sync. Have you tried using

https://github.com/dmrschmidt/DSWaveformImage/blob/main/Example/DSWaveformImageExample-iOS/SwiftUIExample/SwiftUIExampleView.swift

for comparison? That's basically the same UI element you built. I didn't notice the same issue there. Would you mind trying that out?

Regarding the question, yeah the audio recording is asking iOS for an update every 0.01s. That's not really happening in my experience though, so I triple the value we are getting to make the form scroll a little faster. It didn't "feel" right otherwise.

Medef commented 1 year ago

Hey, @dmrschmidt I had the interval set to 0.1 and there was distortion because of this. Now I set the interval to 0.01 and it works correctly. I can attach my manager, if someone needs as an example

Thank you for your help, I am very grateful for such quick and timely answers

Best wishes, Eugene AudioRecorder.swift.zip

ducduy20 commented 1 year ago

Hey @Medef Can you give me the code that you can use this record in View?

Medef commented 1 year ago

Hey @ducduy20 What exactly are you interested in?