Comments (7)
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.
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.
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.
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.
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.
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.
My pleasure. Happy to hear you’ve found a workable solution.
from dswaveformimage.
Related Issues (20)
- xcode 15 not support. Stored properties cannot be marked unavailable with '@available' HOT 1
- Striped style with gradient HOT 2
- Stored properties cannot be marked unavailable with '@available' HOT 3
- Stored properties cannot be marked unavailable with '@available' HOT 1
- Thread 1: EXC_BAD_ACCESS (code=2, address=0x2829857c4) HOT 1
- WaveForm Flickering HOT 2
- Extra argument position in call error in MacOS HOT 1
- I need to show loader till complete image generating from audio URL. HOT 2
- Update version in cocoapod HOT 2
- crash in iOS 17 HOT 10
- Error on macOS HOT 7
- Can't Run Example HOT 3
- LTR Support HOT 1
- Getting crash While entering foreground from background HOT 23
- unable to create wave view with audio server url HOT 1
- Stored properties cannot be marked unavailable with '@available' HOT 4
- Android alternative HOT 1
- Support for stereo/multiple channels HOT 1
- Support for older versions of macOS HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dswaveformimage.