Page 1 of 1

Tutorial: How to create an audio Smooth module. Part 2

Posted: Mon Jul 27, 2020 7:14 pm
by jorge
Part 1 introduces the task of creating an audio Smooth module and shows some of the features of VisualSwift.

In summary we want to create the following diagram as a reusable VisualSwift module with a GUI:


3-How to create a custom Module with GUI

Start by double-tapping an empty part of the schematic:


A custom module will start with one of VStack, HStack or ZStack depending on how you want to align the View elements inside it: Vertically, Horizontally or in overlapping layers respectively.

For our custom Smooth module lets use a VStack:


When you go inside the newly created VStack component, you should see two components called "Content" and "mods" :


From the yellow output of the Content component we can connect yellow View components in series and they will appear in the GUI panel of the parent VStack aligned vertically.

For example if we connect two knobs, the VStack would show them vertically aligned:


In our case we'll only require one Knob to control the smoothness. The smooth module also needs an audio input and an audio output which will be components inside it and will show corresponding connectors on the parent:


Don't forget to rename it to "Smooth" which will be important when dragging it to the Custom toolbox:


We now have a shell for the custom Smooth module but didn't create the audio schematic yet.

Now you should understand the following schematic which consists of a fully functional reusable Smooth module with GUI:


The important parts of the schematic above are:

1) A Content component connected to a Knob component through yellow View connectors which make the Knob appear in the parent's canvas.
2) Poly audio input and output connectors to be used for inserting this module inside more complex schematics.
3) Two PolyMult and one PolyAdd components that recreate the Faust diagram at the top of this post.
4) The Modular and Hierarchical nature of VisualSwift with higher level custom components being implemented from internal schematics with child components.
5) The importance of connector types with the yellow View connectors used for GUI, light gray Poly audio components for streams of audio, green Float and Trigger connectors for events with timestamp to be inserted with sample precision inside the audio streams.

4-How to store the custom module for future use

To store the Smooth module in your custom toolbox simply open the Custom side panel and drag from the duplicate top right corner of the smooth module and drop in the "Drop Here" square:


5-Using the new module

The Smooth module should now stay in the Custom toolbox and you can drag it into a new schematic without having to worry about what's inside it.

The following schematic shows the Smooth. module in action rounding the corners of a Square waveform:

The Smooth module is very simple but the powerful Modular and Hierarchical concepts are the same for more complex modules like for example a full synthesiser that one developer creates in VisualSwift and shares for others to use.