Skip to content
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 HOAUgens #146

Merged
merged 33 commits into from
Jun 18, 2018
Merged

added HOAUgens #146

merged 33 commits into from
Jun 18, 2018

Conversation

florian-grond
Copy link
Contributor

Hello, I have added the HOAUgens to the SC3plugins. The Plugins include Ambisonics encoding, transforming (rotation, beamforming, mirroring) and decoding up to the 5th order. Any feedback very welcome, Florian

Copy link

@nhthn nhthn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoa, thanks florian! this is awesome!

one problem: i'm pretty sure we also need the FAUST source files to comply with GPL.

@florian-grond
Copy link
Contributor Author

The FAUST code has been implemented by Pierre Lecomte and is here on GitHub:
https://github.com/sekisushai/ambitools

@nhthn
Copy link

nhthn commented Jun 2, 2017

could you add a README to HOAUgens that links to the repo? after that we're set

@florian-grond
Copy link
Contributor Author

done!

Copy link

@nhthn nhthn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@bagong bagong assigned bagong and unassigned bagong Jun 2, 2017
bagong
bagong previously requested changes Jun 2, 2017
Copy link
Contributor

@bagong bagong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has not been added to the build, it seems? ;)

I checked on VS2015, unfortunately the old

error C2375: 'api_version': redefinition; different linkage

is back. Florian, looks like you didn't use the latest Faust compiler? Check my comment in #143 and the ensuing discussion. Likely once you've regenerated the sources with a recent Faust version and added you Plugins in source/CMakeLists.txt everything is file. Thanks!

also added them to the CMakeLists.txt where I also added:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fbracket-depth=512")
since the Faust autogenerated code creates deep bracket nestings for
higher orders
@florian-grond
Copy link
Contributor Author

Hi bagong, I recompiled some of the HOAUgens with the most recent FAUST version, also added HOAUGens to CMakeLists.txt where I also added:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fbracket-depth=512")
as some of the autogenerated code for higher orders generates deep nesting.
Do I need to make a new PR?

Copy link
Member

@telephon telephon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for these UGens, they will be a game changer for many of us. And everyone will be buying lots of speakers!

I suppose this is generated SuperCollider class code, but still I have some suggestions of simplifications. I think they will make the code easier to debug, too, and arguably easier to use.

Isn't it easier to pass an array around?

@@ -1,4 +1,4 @@
HOARotatorAz2 : MultiOutUGen
FaustHOAAzimuthRotator2 : MultiOutUGen
{
*ar { | in1, in2, in3, in4, in5, in6, in7, in8, in9, azimuth(0.0) |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@reading this, I was wondering if it wouldn't be better to just pass an array? Like

*ar { | inputs, azimuth(0.0) |
    if(inputs.size < 9) { Error("not enough inputs").throw };
    ^this.multiNewList('audio', inputs ++ azimuth)
}

And if you define numInputChannels in each class (see comment further below), you can make this more general:

if(inputs.size < this.numInputChannels) { Error("not enough inputs").throw };

@@ -25,6 +25,6 @@ HOARotatorAz1 : MultiOutUGen
^this.initOutputs(4, rate)
}

name { ^"HOARotatorAz1" }
name { ^"FaustHOAAzimuthRotator1" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is redundant, it's defined in UGen as:

name {
		^this.class.name.asString;
	}

@@ -1,4 +1,4 @@
HOARotatorAz3 : MultiOutUGen
FaustHOAAzimuthRotator3 : MultiOutUGen
{
*ar { | in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, azimuth(0.0) |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

… same here and all of them, why not array?.

^this.multiNew('control', in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31, in32, gain)
}

checkInputs {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could make all of these UGens inherit from one AbstractFaustHOAUGen.
for each UGen, you can make a method like this:

*numInputChannels { ^32 }

and then the code below would be:

 this.class.numAudioInputs.do({|i| 

once and for all of them.

^this.multiNew('control', in1, in2, in3, in4, pitch, roll, yaw)
}

checkInputs {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment above


checkInputs {
if (rate == 'audio', {
4.do({|i|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

… and so on …

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all these useful comments!
The C++ and the .sc files are all autogenerated from a HOA FAUST implementation made by Pierre Lecomte:
https://github.com/sekisushai/ambitools
so I plan not to change much on that level. But, once the plugins work, I'll publish an HOA Quark that wraps all this in PseudoUgens, with documentation and tutorials:
https://github.com/florian-grond/SC-HOA
so that we don't need to deal with this low level:
http://musinf.univ-st-etienne.fr/lac2017/pdfs/13_C_D_141345N.pdf

Let me know if this answers most of your concerns.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and to answer more specifically the array question, this will be dealt with in the PseudoUGens, i.e. the b-format will be an array.

@bagong
Copy link
Contributor

bagong commented Jun 5, 2017

@florian-grond , I'll wait checking the Windows side until you've decided the rest is final, okay? Give me an okay once you've considered other reviews. @LFSaw , maybe you want to have a look, this is Faust-land ;)

@nhthn
Copy link

nhthn commented Jun 5, 2017

let's not spend too much time perfecting the design here. sc3-plugins is a junkyard and it's okay for stuff to be unstable and incomplete

@telephon
Copy link
Member

telephon commented Jun 5, 2017

@snappizz well if Florian likes, he can of course do it. I've deliberately only commented. No duty!

@telephon
Copy link
Member

telephon commented Jun 5, 2017

… junkyard is not a very precise description. It reminds me a little bit of the broken window theory

@miguel-negrao
Copy link
Member

sc3-plugins is a junkyard

I was surprised by this also... I wasn't aware that sc3-plugins was that unmaintained.

@florian-grond
Copy link
Contributor Author

Well, my plan was not to throw junk into the yard ;-) It is just that Pierre's FAUST lib is very useful, it is 1) structured the way it is. Pierre Lecomte who implemented it did not have SC in mind when he built it, but 2) FAUST generated code just looks that way. Also, I think the SC class files of Faust generated code should not be modified, I believe LFSaw, was of that opinion too at some point.
I think that might be a good moment to discuss how to integrate FAUST generated code in the plugins, as there might be more of this comming in the future.

@telephon
Copy link
Member

telephon commented Jun 5, 2017

@florian-grond ah good! Would you like to make a separate issue out of this, where we discuss this?

@nhthn
Copy link

nhthn commented Jun 5, 2017

sorry for going off topic here, but let's be honest with ourselves -- most stuff hasn't been touched in years, and there's no shortage of basic quality issues like uninitialized Ctor samples, unprotected calls to RTAlloc, and failure to interpolate control-rate arguments :/

i've personally hit my share of sc3-plugins landmines and just haven't had the motivation to fix them myself. i mostly use core these days.

@LFSaw
Copy link
Member

LFSaw commented Jun 5, 2017

Hey there! First of all, this is awesome :)

some things:

@florian-grond
Copy link
Contributor Author

@LFSaw good idea to include the sources. In the HOA case they are generated from a master .dsp script dynamically so there is not one .dsp file per cpp source. I believe a link to Pierre Lecomte's repository should be enough with a clear description of how to use his script.
This is why your template for JPVerb etc only applies in part.

@telephon @LFSaw splitting the plugins from a Quark and additional resources is very much inspired by the ATK, the Quark will also have extensive Tutorial and Guides etc. I actually did not document the UGens as they are very many and autogenerated.

@LFSaw
Copy link
Member

LFSaw commented Jun 5, 2017

@snappizz , if this is your feeling, then, well... that's your feeling about it.
Personally, I think we need a plugins-system that integrates into SC as does the Quarks system. So that people can provide their ideas of language extensions the way they think they want, possibly inviting others to review them, and, on the other hand, giving people the freedom to in(/ex)clude portions where they see them fit. So actually, we'd need integration of plugins into the quarks system :)

@bagong
Copy link
Contributor

bagong commented Jun 5, 2017

@LFSaw , once @brianlheim 's path-handling reform is brought to the planned point that plugin binaries can be found anywhere where class-files can be found, that should be quite easy.

@florian-grond
Copy link
Contributor Author

I think bagong is still waiting for telephon to approve or disapprove

@telephon
Copy link
Member

telephon commented Jun 5, 2017

@bagong are you waiting for me?

@bagong
Copy link
Contributor

bagong commented Jun 5, 2017

@florian-grond , I think @telephon is among the "liberals" here, as am I ;) So I take your comment as the okay I was waiting for. I am just checking if it builds on Windows, as we have a cross-platform commitment, no intention to act as gatekeeper, just using these fabulous buttons from Github ;)

Thinking a bit into the future: the option to have plugin binaries in class-folders is in reach now. So is the option to use travis and apveyor as build-engines for binaries that could be downloaded into Quarks. SC3 plugins could then be reduced to a binaries repository where we make sure that things build and are cross-platform. And maybe a few tests ;)

@LFSaw
Copy link
Member

LFSaw commented Jun 5, 2017 via email

@bagong
Copy link
Contributor

bagong commented Jun 5, 2017

@florian-grond , the good news, it builds now with VS2015. But I get duplicate classes errors? Weird that they only show on Windows:

ERROR: duplicate Class found: 'FaustHOAAzimuthRotator1' 
C:\Users\Rainer\AppData\Local\SuperCollider\Extensions\SC3plugins\HOAUGens\Classes\HOAAzimuthRotator1.sc
C:\Users\Rainer\AppData\Local\SuperCollider\Extensions\SC3plugins\HOAUGens\Classes\HOA_Azimuth_Rotator1.sc

ERROR: duplicate Class found: 'FaustHOAAzimuthRotator2' 
C:\Users\Rainer\AppData\Local\SuperCollider\Extensions\SC3plugins\HOAUGens\Classes\HOAAzimuthRotator2.sc
C:\Users\Rainer\AppData\Local\SuperCollider\Extensions\SC3plugins\HOAUGens\Classes\HOA_Azimuth_Rotator2.sc

ERROR: duplicate Class found: 'FaustHOAAzimuthRotator3' 
C:\Users\Rainer\AppData\Local\SuperCollider\Extensions\SC3plugins\HOAUGens\Classes\HOAAzimuthRotator3.sc
C:\Users\Rainer\AppData\Local\SuperCollider\Extensions\SC3plugins\HOAUGens\Classes\HOA_Azimuth_Rotator3.sc

ERROR: duplicate Class found: 'FaustHOAAzimuthRotator4' 
C:\Users\Rainer\AppData\Local\SuperCollider\Extensions\SC3plugins\HOAUGens\Classes\HOAAzimuthRotator4.sc
C:\Users\Rainer\AppData\Local\SuperCollider\Extensions\SC3plugins\HOAUGens\Classes\HOA_Azimuth_Rotator4.sc

ERROR: duplicate Class found: 'FaustHOAAzimuthRotator5' 
C:\Users\Rainer\AppData\Local\SuperCollider\Extensions\SC3plugins\HOAUGens\Classes\HOAAzimuthRotator5.sc
C:\Users\Rainer\AppData\Local\SuperCollider\Extensions\SC3plugins\HOAUGens\Classes\HOA_Azimuth_Rotator5.sc
````

@djiamnot
Copy link

Thanks @patrickdupuis for clarification. I was, in fact, using a "contaminated" copy of the sc3-plugins.

@telephon telephon dismissed patrickdupuis’s stale review June 18, 2018 19:08

there is a compile flag that defaults to OFF

@telephon telephon merged commit 98df066 into supercollider:master Jun 18, 2018
@patrickdupuis
Copy link
Contributor

Whoa! I didn't see that coming 😄

@telephon
Copy link
Member

was it ok? I am sorry, if that was too quick. I had assumed all was actually done.

@florian-grond
Copy link
Contributor Author

florian-grond commented Jun 18, 2018 via email

@patrickdupuis
Copy link
Contributor

@telephon yes, it is fine. I had just added a README to the PR before you merged.

@LFSaw
Copy link
Member

LFSaw commented Jun 18, 2018

so, default flag for this is "Off"?

@telephon
Copy link
Member

Because the temperature is rising, I was worried that it would get stale before we could eat it ...

@telephon
Copy link
Member

so, default flag for this is "Off"?

as it seems, yes. Should it perhaps be ON?

@LFSaw
Copy link
Member

LFSaw commented Jun 18, 2018

no, leave it Off please. For now at least (since it does not compile on all platforms)

@telephon
Copy link
Member

yes, that was my thinking.

@florian-grond
Copy link
Contributor Author

florian-grond commented Jun 18, 2018 via email

@telephon
Copy link
Member

actually, trying to switch it on in my usual build folder seems not to work. Maybe I'm doing something wrong.

cmake -DSC_PATH=/Volumes/xyz/supercollider -HOA_UGENS=ON ..

and then

cmake -L

shows me

HOA_UGENS:BOOL=OFF

@patrickdupuis
Copy link
Contributor

try with a second build folder called build2 and see if you get the same result.

@telephon
Copy link
Member

still the same

@patrickdupuis
Copy link
Contributor

Oh! it's -DHOA_UGENS (you forgot the D)

@mossheim
Copy link
Contributor

The HOAUGens are unable to build using MSVC due a limitation in the depth of bracket nesting that is permitted by this compiler.

Almost all the plugins do build with MSVC, it's only three that have a problem. Is there any plan to provide a convenient way to skip the bad ones (HOADecBinaural3/4/5)? Such as just excluding those plugins when MSVC is detected? How do you expect anyone to provide a testable build otherwise? Same with RPi, sounds above like HOADecBinaural5 doesn't build there and the rest could be used.

@patrickdupuis
Copy link
Contributor

Yes - this is what @florian-grond is thinking about doing as a next step. For now, though, this is the way it had to be in order to move this PR forward. Maybe we should open an issue?

@mossheim
Copy link
Contributor

For now, though, this is the way it had to be in order to move this PR forward.

??? Is there a link to a discussion? There is no consensus in the discussion above.

@jamshark70
Copy link
Contributor

At least the PR appears to be incomplete. AFAICS the readme does not explain the new cmake option nor that HOAUGens in their current state should not be expected to build in Visual C or perhaps on RPi as well.

Without this documentation as a bare minimum (or full compatibility), merging was premature.

@patrickdupuis
Copy link
Contributor

I agree that this shouldn't have been merged as is. I was intending to discuss this PR at the next dev meeting and reaching a consensus.

At this point, we should be suggesting necessary changes (maybe in #197) so we can make them happen.

@telephon
Copy link
Member

Sorry, my misunderstanding. I had understood that the cmake option is off by default, and the changes in themselves were very well maintained with a clear responsibility.

So as far as I can tell, what is really missing is a few sentences of documentation of this option and its limitations.

@florian-grond
Copy link
Contributor Author

florian-grond commented Jun 19, 2018 via email

@patrickdupuis
Copy link
Contributor

@florian-grond let's leave this thread and move the discussion to #197.

@nhthn
Copy link

nhthn commented Jun 20, 2018

i, for one, am fine with this merge. since the ugens are turned off by the default in the build system, it won't cause problems for users who don't specifically install them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.