# Modular design? Any ideas on how to handle modules?

**URL:** <https://forum.juce.com/t/modular-design-any-ideas-on-how-to-handle-modules/10602>\
**Category:** General JUCE discussion\
**Created:** [June 13, 2013, 10:43am UTC](https://forum.juce.com/t/modular-design-any-ideas-on-how-to-handle-modules/10602 "2013-06-13T10:43:16Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![williamk](https://avatars.discourse-cdn.com/v4/letter/w/90ced4/32.png) [@williamk](https://forum.juce.com/u/williamk)\
**Post date:** [June 13, 2013, 10:43am UTC](https://forum.juce.com/t/modular-design-any-ideas-on-how-to-handle-modules/10602/1 "2013-06-13T10:43:16Z")

</div>

Guys, after a loooong period of inactivity, I´m back. So my next project will be a synth that allows open-source modular elements, like envelopes, filters, etc … I was hoping that each module would be a Juce Plugin, and polyphony would be handle by the number of audio ports or something like that. So, could I handle this with Juce? Any ideas on this? Just asking, since it doesn´t hurt, and I need all the help I can get. 😉

The whole project will be done with Juce, closed-source, BUT, the Modules will all be open-source. What kind of license I need to attach to those modules, stating that they can be re-used to make new modules, but not re-used for commercial apps?

Best Regards, WilliamK

---

<div class="post-metadata">

**Author:** ![williamk](https://avatars.discourse-cdn.com/v4/letter/w/90ced4/32.png) [@williamk](https://forum.juce.com/u/williamk)\
**Post date:** [June 14, 2013, 11:36am UTC](https://forum.juce.com/t/modular-design-any-ideas-on-how-to-handle-modules/10602/2 "2013-06-14T11:36:14Z")

</div>

So far I´m thinking on just using each module as a synth-plugin (vst?). But I was wondering on using modules like DLL files, but I wonder about cross-platforms in the future, that´s why VST (or whatever) seems like a better idea, thanks to Juce cross-platform plugin scheme.

The problem is polyphonic parameters. For example, a filter could have multiple parameters per voice. So, maybe I will need to do this in some other way. Any ideas?

Wk

---

<div class="post-metadata">

**Author:** ![chkn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chkn/32/3862_2.png) [@chkn](https://forum.juce.com/u/chkn)\
**Post date:** [June 14, 2013, 12:39pm UTC](https://forum.juce.com/t/modular-design-any-ideas-on-how-to-handle-modules/10602/3 "2013-06-14T12:39:08Z")

</div>

this are too many questions in one. it seems you have to make some conceptual work first.

> [@](#):
>
> The problem is polyphonic parameters.

- one plugin instance per voice? (so they can me monophonic)

> [@](#):
>
> stating that they can be re-used to make new modules, but not re-used for commercial apps?

well if they use juce, they have to use licenses which juce provide (but even GPL doesn’t prevent commercial use)

---

<div class="post-metadata">

**Author:** ![williamk](https://avatars.discourse-cdn.com/v4/letter/w/90ced4/32.png) [@williamk](https://forum.juce.com/u/williamk)\
**Post date:** [June 14, 2013, 12:57pm UTC](https://forum.juce.com/t/modular-design-any-ideas-on-how-to-handle-modules/10602/4 "2013-06-14T12:57:07Z")

</div>

Thanks, yes, I will try to describe the idea better.

Using one instance per voice would take too much resources, specially when using low-buffers. Imagine 16 calls to the plugin process, and having 8 modules been called. Its just too much calls. So the idea is to call it once, and the process will handle each voice in a stereo output, which is fast and easy to handle.

The following call can help getting a pointer to a data structure to be used to send voice-based modulation parameters in a faster way.  
File juce\_AudioPluginInstance -\> virtual void\* getPlatformSpecificData()

There´s still a lot to be done, so I´m just trying to think a few things before I spend days and weeks working on something that wouldn´t work. :oops:

Wk

---

<div class="post-metadata">

**Author:** ![chkn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chkn/32/3862_2.png) [@chkn](https://forum.juce.com/u/chkn)\
**Post date:** [June 14, 2013, 1:51pm UTC](https://forum.juce.com/t/modular-design-any-ideas-on-how-to-handle-modules/10602/5 "2013-06-14T13:51:37Z")

</div>

[quote]Using one instance per voice would take too much resources, specially when using low-buffers. Imagine 16 calls to the plugin process, and having 8 modules been called. Its just too much calls. So the idea is to call it once, and the process will handle each voice in a stereo output, which is fast and easy to handle.  
[/quote]  
well you mentioned

[quote] “The problem is polyphonic parameters.” [/quote] Thats why i give you this answer and

> [@](#):
>
> Imagine 16 calls to the plugin process, and having 8 modules been called.

Did you measure it? In proportion what an additional audio-output costs, an additional callback is nothing  
And how do you handle the polyphony, in the end you have to call different methods too, so i can see here no downside.

> [@](#):
>
> File juce\_AudioPluginInstance → virtual void\* getPlatformSpecificData()

it looks you want to make things more complicated, but i only can give you an advise, try to simplify.  
Also to me it looks not sensible, to use a existing standard (like VST) , and then modify it…

---

<div class="post-metadata">

**Author:** ![williamk](https://avatars.discourse-cdn.com/v4/letter/w/90ced4/32.png) [@williamk](https://forum.juce.com/u/williamk)\
**Post date:** [June 14, 2013, 3:16pm UTC](https://forum.juce.com/t/modular-design-any-ideas-on-how-to-handle-modules/10602/6 "2013-06-14T15:16:58Z")

</div>

Good points, thanks bud, I will simplify things up. :oops:

---

<div class="post-metadata">

**Author:** ![otristan](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@otristan](https://forum.juce.com/u/otristan)\
**Post date:** [June 14, 2013, 3:59pm UTC](https://forum.juce.com/t/modular-design-any-ideas-on-how-to-handle-modules/10602/7 "2013-06-14T15:59:58Z")

</div>

[http://www.synthedit.com/](http://www.synthedit.com/) and [http://www.synthedit.com/software-development-kit/](http://www.synthedit.com/software-development-kit/)

?

---

<div class="post-metadata">

**Author:** ![williamk](https://avatars.discourse-cdn.com/v4/letter/w/90ced4/32.png) [@williamk](https://forum.juce.com/u/williamk)\
**Post date:** [June 14, 2013, 4:02pm UTC](https://forum.juce.com/t/modular-design-any-ideas-on-how-to-handle-modules/10602/8 "2013-06-14T16:02:37Z")

</div>

Yes, I know SE, but my idea is to make something different, but I will take a look at their SDK, good idea, thanks.

---

<div class="post-metadata">

**Author:** ![williamk](https://avatars.discourse-cdn.com/v4/letter/w/90ced4/32.png) [@williamk](https://forum.juce.com/u/williamk)\
**Post date:** [June 14, 2013, 6:58pm UTC](https://forum.juce.com/t/modular-design-any-ideas-on-how-to-handle-modules/10602/9 "2013-06-14T18:58:03Z")

</div>

Ok, using a single VST instance per voice does make sense, specially since it would simply the code a lot and make things easier indeed. Plus, adding more voices would just mean allocate more instances, and not have to redo a complete module. :oops:

The VSTs would be GUIless, as things will be handle by the main host via XML configurations along the VST file.

---

<div class="post-metadata">

**Author:** ![williamk](https://avatars.discourse-cdn.com/v4/letter/w/90ced4/32.png) [@williamk](https://forum.juce.com/u/williamk)\
**Post date:** [June 16, 2013, 6:02pm UTC](https://forum.juce.com/t/modular-design-any-ideas-on-how-to-handle-modules/10602/10 "2013-06-16T18:02:53Z")

</div>

Here´s most of what´s going on in terms of projects: [http://www.kvraudio.com/forum/viewtopic.php?p=5390860](http://www.kvraudio.com/forum/viewtopic.php?p=5390860)

Now, since I plan on just using the VST format, I wonder if there´s a way to make VSTs that can´t be scanned by Hosts, or gets ignored somehow, but that I could load from my code. On Windows I can rename the .dll files to something else like .wmod, but what about MAC and Linux? I will investigate a bit more, but any advice would be appreciated, before I paint myself into a corner. :mrgreen:

---

<div class="post-metadata">

**Author:** ![williamk](https://avatars.discourse-cdn.com/v4/letter/w/90ced4/32.png) [@williamk](https://forum.juce.com/u/williamk)\
**Post date:** [August 1, 2013, 11:17pm UTC](https://forum.juce.com/t/modular-design-any-ideas-on-how-to-handle-modules/10602/11 "2013-08-01T23:17:33Z")

</div>

Ok, creating my own VST file that gets a different name structure wasn´t so hard.

` modulesLoaderPlugDesc.pluginFormatName = "vst";
		modulesLoaderErrorMessage = String::empty;
		modulesLoader = new AudioPluginFormatManager();
		wk4000Format = new wusik4000Module();
		modulesLoader->addFormat(wk4000Format);`

[code]class wusik4000Module : public VSTPluginFormat  
{  
bool fileMightContainThisPluginType(const String& fileOrIdentifier)  
{  
const File f(fileOrIdentifier);

#if JUCE\_MAC  
if (f.isDirectory() && f.hasFileExtension(".w4kmodule"))  
return true;

#if JUCE\_PPC  
FSRef fileRef;  
if (makeFSRefFromPath(&fileRef, f.getFullPathName()))  
{  
const short resFileId = FSOpenResFile(&fileRef, fsRdPerm);

```
		if (resFileId != -1)
		{
			const int numEffects = Count1Resources('aEff');
			CloseResFile(resFileId);

			if (numEffects > 0)
				return true;
		}
	}

```

#endif

```
	return false;

```

#elif JUCE\_WINDOWS  
return f.existsAsFile() && f.hasFileExtension(".w4kmodule");  
#elif JUCE\_LINUX  
return f.existsAsFile() && f.hasFileExtension(".w4kmodule");  
#endif  
}  
};[/code]

---

<div class="post-metadata">

**Author:** ![williamk](https://avatars.discourse-cdn.com/v4/letter/w/90ced4/32.png) [@williamk](https://forum.juce.com/u/williamk)\
**Post date:** [August 1, 2013, 11:18pm UTC](https://forum.juce.com/t/modular-design-any-ideas-on-how-to-handle-modules/10602/12 "2013-08-01T23:18:44Z")

</div>

One question, will I be able to name my MAC VST w4kmodule instead of vst? (I don´t have much experience with MAC files)
