-
-
Notifications
You must be signed in to change notification settings - Fork 682
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
added feature of manually setting "BUFFERSIZE" in amplitude analysis #419
Conversation
hey @therewasaguy ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
As far as new features go, a key decision from the recent p5 Contributors Conference is that "p5.js will not add any new features except those that increase access" (more here)
So let's keep in mind that as p5 contributors. New features add complexity and we should focus on making the existing features as stable and accessible as can be.
That said, if this new feature came with a unit test, that would help :)
@therewasaguy |
@@ -4,13 +4,15 @@ | |||
|
|||
var soundFile; | |||
var amplitude; | |||
var bufferSize = 2048; // a value which can be multiple of 2 , eg. 256 , 512 , 1024 , 2048 ..etc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like this comment should be updated to read "power of 2"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ya ofcourse !!
|
||
// Set to 2048 for now. In future iterations, this should be inherited or parsed from p5sound's default | ||
this.bufferSize = safeBufferSize(2048); | ||
this.bufferSize = safeBufferSize(bufferSize); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the comment above this line should be deleted or updated. I'm curious if you considered the other options mentioned in the comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@therewasaguy
actually comment must be modified 😄
and
as far as inheritance part is concerned i think , i need to modify p5.sound pass a optional argument "bufferSize " like i did in here , but right now let's leave it and i will make it another pr !
what do you say ?
*/ | ||
|
||
p5.Amplitude.prototype.setBufferSize = function(s) { | ||
if (s%2==0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's a good practice to use triple equals so that we check for type as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually i have modified it in my local repo , i will be pushing it with your recommendations keeping in mind 😃
@therewasaguy |
hey @endurance21, I've added a card for this to our GSoC backlog. It would need resolving of merge conflicts and the changes mentioned above, but before doing that...it sounds like we're on the same page that this feature isn't as much of a priority right now. How do you feel about closing this so that we can focus? |
solves #417
not only feature is added but also example have been updated !
areas of impact
examples/amplitude_analysis/sketch.js
lib/p5.sound.js
lib/p5.sound.js.map
lib/p5.sound.min.js
lib/p5.sound.min.js.map
src/amplitude.js