Giter Club home page Giter Club logo

Comments (7)

dmrschmidt avatar dmrschmidt commented on June 11, 2024

Hey @lucashenning,

admittedly counter-intuitively, your expectation for what 0 means and what 1 means is inverted. So 0 is expected for maximum loudness, 1 for silence.

I think I did this originally to align it with dB LUFS, where 0 is the maximum.

from dswaveformimage.

dmrschmidt avatar dmrschmidt commented on June 11, 2024

And by the way thank you for your very well crafted question, appreciate that.

I'm also happy to discuss this further, of course.

from dswaveformimage.

lucashenning avatar lucashenning commented on June 11, 2024

Thanks for the prompt reply @dmrschmidt! Facepalm moment for me, but glad it's working now.

One minor follow-up question, is there a way to increase the wave speed? I think it would be good for the wave to move a little faster to provide real time feedback to the user. I know the full width is 1200 values, is there any way to change this?

This is captured at real time:

micwave.mov

In comparison, this is Apple's native Voice Recorder app (as you can see, the wave is much faster and seems to be more sensitive, this is the result I was hoping for):

RPReplay_Final1705080259.mov

from dswaveformimage.

dmrschmidt avatar dmrschmidt commented on June 11, 2024

Yeah well, it really is counter intuitive I’m realizing. I still kind of feel that it’s reasonable to loosely align it with typical dB values in audio processing, but it should at the very least be clearly documented to avoid confusion. Or maybe even have different setters for dB values and amplitudes. I’ll think about that.

Regarding the speed, that’s really essentially just a function of the „sampling frequency“. In your tap you’re using a buffersize of 1024, which is relatively large I would say for this use case. So if you half or quarter that, you’ll get a more speedy result.

from dswaveformimage.

dmrschmidt avatar dmrschmidt commented on June 11, 2024

I just did a little experiment myself btw with your approach to read the raw volume manually. If you check my implementation of RecordingIndicatorView you'll note that I am using averagePowerForChannel: instead, which I hacked to add the volume same sample 3 times to speed up the view.

I was hoping that with your approach, this hack wouldn't be necessary anymore. However what I found is that the bufferSize is really just a hint. Setting it to 1024 or 128 on my test hardware didn't yield a difference, I always get 4800 samples back. Read it up and its due to hardware optimization and so might differ from model to model. So then I split up the buffer manually, calculated the volume on the sub buffers and added the values, but the result looks jittery because now we're adding up to 40 samples at once.

So you'll likely need to do some extra smoothing via whatever mechanism you choose. You probably don't need scientific precision here, so a hacky approach like I did as described above is probably going to be totally sufficient for you, too.

from dswaveformimage.

lucashenning avatar lucashenning commented on June 11, 2024

Thank you @dmrschmidt - I really appreciate you going the extra mile with your support.

I wasn't able to get averagePowerForChannel for my AVAudioPCMBuffer but I added some interpolated values to the [Float] values and it's working fine for me now.

Thanks again for your help. Feel free to close this issue.

from dswaveformimage.

dmrschmidt avatar dmrschmidt commented on June 11, 2024

My pleasure. Happy to hear you’ve found a workable solution.

from dswaveformimage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.