processing / processing-sound

Audio library for Processing built with JSyn
https://processing.org/reference/libraries/sound/
GNU Lesser General Public License v2.1
149 stars 50 forks source link

Pixmusix allpass #79

Closed pixmusix closed 1 year ago

pixmusix commented 1 year ago

Thanks for the opportunity to work on the processing-sound library. I have tested building (with ant dist) and tested the allpass object and the example. The file docs/allclasses-index.html was also modified but not committed to my branch. Let me know if you need any clarification or if I can assist further.

I'm grateful for all your efforts maintaining this library and a thankyou to @kevinstadler from the git issue. Pixmusix.

kevinstadler commented 1 year ago

Thanks for your code, all looking good! You were right not to commit the HTML (Javadoc) files, they will be automatically generated from /** **/ style comments (all of them, not just the @webref tagged ones) on every library release.

Regarding the parameter name, I wouldn't worry too much about what the parameter is called in JSyn or whether a Sound library beginner would confuse it with another meaning, but just go for whichever a user who knows what an Allpass-filter is would intuitively call it. Do you think 'gain' is a canonical name for the parameter? We could also go for something more obscure like the plain 'a' from the filter equation, as long as users immediately recognize it for what it is.

Best!

pixmusix commented 1 year ago

Hi @kevinstadler

Thanks for your thoughts about what to call the parameter. Yes, 'gain' is a canonical name. Behind the scenes, the parameter is a multiplier of the signal which is why gain is traditionally used. The code I committed uses 'gain'; no changes are necessary.

Thanks. Pix.

pixmusix commented 1 year ago

Hi @kevinstadler. On my mobile I swiped and accidentally closed and re-opened this pull request. Is this pull request still available to you or do I need to make a new one? :)

kevinstadler commented 1 year ago

@pixmusix no worries it's still good to go, we're just waiting to draw up a timetable for the next library release before we take care of all outstanding testing and mergers!

pixmusix commented 1 year ago

Lovely :) Thanks @kevinstadler.

P.S. If you need further support, I'm very happy to assist with processing-sound documentation.

pixmusix commented 1 year ago

@kevinstadler I'm interested to see how the example syntax highlighting will be displayed online. I want to make sure the help page looks good and is easy to follow. When will this page be updated? https://processing.org/reference/libraries/sound/index.html

kevinstadler commented 1 year ago

Thanks, that's very thoughtful of you! The new reference won't be published online until the next library release goes public, at the moment I am pushing changes to the processing-website sound-updates branch. Getting the website to run locally can be a bit cumbersome, so here is what it looks like at the moment: Screenshot 2023-09-26 at 14 29 30

The description is taken straight from the Sound library javadoc, the website examples however are from the website repo's content/references/examples/sound directory. I've only added the full example so far (AllPass/AllPass_0.pde is just a copy of your AllPassFilter example), but it would be nice to have minimal examples for the methods (AllPass_gain_/AllPass_gain_0.pde, AllPass_process_/AllPass_process_0.pde, AllPass_stop_/AllPass_stop_0.pde) if you're feeling motivated to make a pull request..

If you look at other website examples you will find that they are pretty dumb, bare minimal use cases, and not full sketch examples. So for added clarity it might be an idea to also drop the lengthy visualisation part of the AllPass/AllPass_0.pde example...

pixmusix commented 1 year ago

Docs

here is what it looks like at the moment

Thanks for that screenshot.

I agree the description from the jsyn doc is a little technical. I don't mind a the formula being there since an Allpass is a "near the metal audio unit". Fine detail is warranted. My feeling is mostly intermediate level processing users will be reaching for an Allpass. Perhaps, for example, in the context of something like mapping brightness to reverberation.


Further examples

for added clarity it might be an idea to also drop the lengthy visualisation

Sure! That's a good idea. This is the simplest example I can think of.

  1. Create an audio signal that's transient
  2. Process it with a powerful jsyn allpass.
// Create two triangle waves with deconstructive frequencies.
triA = new TriOsc(this);
triA.freq(220);
triB = new TriOsc(this);
triB.freq(410);

// Make an Allpass
allPass = new AllPass(this);
// Give Allpass a high gain to process yucky transience. 
allPass.gain(0.995);

// Start both triangle waves together. 
// This will create a lot of unbridled bright sounds. 
triA.play();
triB.play();
// Processing the sound through this high gained Allpass will warm it up! 
allPass.process(triA);
allPass.process(triB);

I can make a pull request for that tomorrow if you like. :smile:

pixmusix commented 1 year ago

Hi @kevinstadler Ive got a bit of time next weekend to assist with documentation, examples, or further ports from jsyn.

Would you like me to push the example above?

kevinstadler commented 1 year ago

Yes that would be amazing, thank you very much!

If you are able to also add the (extra brief) examples to the processing-website repo, please branch off from (and make pull requests to) the sound-updates branch, since that is the one we will be merging when the new library version goes live.

pixmusix commented 1 year ago

@kevinstadler sounds great.

add the (extra brief) examples

By extra brief are you wanting some three liners? Or are you talking about my attempt at a simple example above? 😀

kevinstadler commented 1 year ago

Something like above is good! I just checked the web reference examples for some of the other core functions and they're often in the 10-20 line range, the main difference to 'full' example sketches like those bundled with the library is that the code snippets typically forego full setup() and loop() sections for sake of brevity, e.g. here: https://processing.org/reference/loadBytes_.html

pixmusix commented 10 months ago

Thanks again @kevinstadler

That pull request has been made to the sound-updates branch. https://github.com/processing/processing-website/pull/511