-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Circular buffer with AudioIn #54
Comments
An interesting problem! You don't even need to create your own circular buffer, you can just use the
|
Nice! I tried your averaging suggestion, dividing the width into buckets and averaging the sample values for each, but found the negative and positive values cancel each other out, so below uses the max absolute value of the samples in a bucket:
|
This full version uses the same method, but attempts to only update the new pixels. Still doesn't seem quite right to me though. Any thoughts?
|
The problem is that the Processing I added some new functions to the library and uploaded a test build here, just extract the zip in your The main method of interest for you is:
I've also added two more methods that allow you to view the current state of the underlying circular buffer directly, namely:
The Waveform class will continuously overwrite data in the array, so if you want to find out where the newest data has just been written to you can use the new Hope that helps, let me know if you find anything wrong with the test build! |
So running the following code in draw (with a 1-sec buffer) , I get the following number of (what I think should be) new samples for each of the first 100 frames (sometimes 0, occasionally negative) -- does this look correct? I guess I would need to handle the wraparounds, but the zeros are still perplexing.
|
Getting closer...
|
This will be addressed as a special case of #55 |
Trying to implement a circular buffer that holds (and displays the waveform for) the last k seconds of input from audioIn. I started on a version with java's ArrayDeque, but I'm having trouble getting the data into a continuously scrolling waveform (events in the waveform would move from right to left as they move into the past). Any suggestions or examples I might check would be great.. thanks!
The text was updated successfully, but these errors were encountered: