dkbuilder: from circuit to LV2 plugin

Programming applications for making music on Linux.

Moderators: khz, MattKingUSA

tramp
Established Member
Posts: 1374
Joined: Mon Jul 01, 2013 8:13 am

Re: dkbuilder: from circuit to LV2 plugin

Postby tramp » Thu Feb 21, 2019 10:03 am

You could also go to /guitarix-git/trunk/tools/build-faust and reduce the optimization level
Currently it use -O3, but -O2 will be good as well.
If needed, remove some of the other flags as well.

in special it is the -ftree-loop-linear option which enable the Graphite loop transformation
On the road again.

tramp
Established Member
Posts: 1374
Joined: Mon Jul 01, 2013 8:13 am

Re: dkbuilder: from circuit to LV2 plugin

Postby tramp » Fri Feb 22, 2019 3:31 pm

I've just pushed a update to the dkbuilder, which allow now to build multiple nonlinear tables (per plugin) and gives some control over the generator options, true, otherwise, the automated conditions will be used. Just found it nice for the case were multiple parts in a circuit creates nonlinear responses, found it helps a lot for dynamic responses.
On the road again.

Dominique
Established Member
Posts: 54
Joined: Sat May 26, 2018 10:24 am

Re: dkbuilder: from circuit to LV2 plugin

Postby Dominique » Sat Feb 23, 2019 5:02 pm

It begin to work well. Thank you!

The guitarix plugins are building and working fone. With the lv2 plugin, I get:

Code: Select all

./build-plug.py -i VoxWahV847.sch --buildlv2 -n VoxWahV847
<snip>build lv2_plugin from: ['VoxWahV847.sch']
VoxWahV847
Please select a Plugin type from the list
 1) DelayPlugin         14) BandpassPlugin    27) FlangerPlugin
 2) ReverbPlugin      15) CombPlugin       28) PhaserPlugin
 3) DistortionPlugin  16) EQPlugin       29) ReverbPlugin
 4) WaveshaperPlugin  17) MultiEQPlugin       30) SimulatorPlugin
 5) DynamicsPlugin    18) ParaEQPlugin       31) ReverbPlugin
 6) AmplifierPlugin   19) HighpassPlugin    32) SpatialPlugin
 7) CompressorPlugin  20) LowpassPlugin       33) SpectralPlugin
 8) EnvelopePlugin    21) GeneratorPlugin   34) PitchPlugin
 9) ExpanderPlugin    22) ConstantPlugin    35) UtilityPlugin
10) GatePlugin         23) InstrumentPlugin  36) AnalyserPlugin
11) LimiterPlugin     24) OscillatorPlugin  37) ConverterPlugin
12) FilterPlugin      25) ModulatorPlugin   38) FunctionPlugin
13) AllpassPlugin     26) ChorusPlugin       39) MixerPlugin
#? 4
Plugin type WaveshaperPlugin
generate voxwahv847.cc and copy to gx_voxwahv847.lv2
copy gx_sceleton.lv2 to gx_voxwahv847.lv2 and rename/replace strings to voxwahv847
. . \033[1;34m, done\033[0m
. . \033[1;34m, clean up\033[0m
generate resource files,\033[0m
c++ -I. -I./dsp -I./plugin -fPIC -DPIC -O2 -Wall -funroll-loops -ffast-math -fomit-frame-pointer -fstrength-reduce -fdata-sections -Wl,--gc-sections -msse3 -mfpmath=sse plugin/gx_sceleton.cpp  -I. -shared -lm  -o gx_sceleton.so
plugin/gx_sceleton.cpp:68:10: erreur fatale: sceleton.cc : Aucun fichier ou dossier de ce type
 #include "sceleton.cc"    // dsp class generated by faust -> dsp2cc
          ^~~~~~~~~~~~~
compilation terminée.
make: *** [Makefile:99: gx_sceleton] Error 1

tramp
Established Member
Posts: 1374
Joined: Mon Jul 01, 2013 8:13 am

Re: dkbuilder: from circuit to LV2 plugin

Postby tramp » Sat Feb 23, 2019 6:15 pm

This looks like a problem with the rename package.
You need this one: https://packages.gentoo.org/packages/dev-perl/rename
On the road again.

User avatar
SpotlightKid
Established Member
Posts: 81
Joined: Sun Jul 02, 2017 1:24 pm

Re: dkbuilder: from circuit to LV2 plugin

Postby SpotlightKid » Sat Feb 23, 2019 6:18 pm

On some systems (e.g. Arch) the rename script is installed as "perl-rename", on some as just "rename".

tramp
Established Member
Posts: 1374
Joined: Mon Jul 01, 2013 8:13 am

Re: dkbuilder: from circuit to LV2 plugin

Postby tramp » Sun Feb 24, 2019 4:31 am

I've implemented basic error handling now, so that we get a hint if something fail.

To the VoxWahV847.sch
The wah (variable resistor) should be a logarithmic controller. That could be implemented by adding

Code: Select all

,a=3

to the value field. The value for 'a' set the logarithmic order, lower value = lower order, moves the sweep point counter clockwise, higher value = higher order, moves the sweep point clockwise.
For the VoxWah I found orders between 2 - 6 suitable, depends on were you like to have the sweep point.

variable resistors could as well be inverted, by

Code: Select all

,inv=1

in the value field. Together with the logarithmic scale, this gives you a width range of how the controller react on movements.
On the road again.

Dominique
Established Member
Posts: 54
Joined: Sat May 26, 2018 10:24 am

Re: dkbuilder: from circuit to LV2 plugin

Postby Dominique » Sun Feb 24, 2019 11:39 pm

It work now. It was necessary to change the rename call into make_lv2_bundle.sh and make_lv2_X11bundle.sh to perl-rename.

The rename command is from sys-apps/util-linux, which imply it must be found in many linux distribution. Maybe it would be best to implement some test into these 2 scripts, and if perl-rename exist, to use it instead of rename.

tramp
Established Member
Posts: 1374
Joined: Mon Jul 01, 2013 8:13 am

Re: dkbuilder: from circuit to LV2 plugin

Postby tramp » Mon Feb 25, 2019 5:51 am

Hi Dominique

"rename" is a bit defragmented across distributions, it seems. :?

On debian, rename is the rename tool from perl, the rename from util-linux is here called rename.ul
Here on debian there is no perl-rename, but we've a additional prename, which is as well the tool from perl.

Also, the rename tool from util-linux use a different syntax, so you can't cross use them.

However, I've now implemented a check for which rename version the script found, if any, and set the syntax accordingly to the rename tool in use.
If non will found, a meaningful error message will displayed.
On the road again.

Dominique
Established Member
Posts: 54
Joined: Sat May 26, 2018 10:24 am

Re: dkbuilder: from circuit to LV2 plugin

Postby Dominique » Mon Feb 25, 2019 6:20 am

Hi Hermann,Thanks for your good work.

I was not aware of that rename situation between distributions, but hopefully never used it into the scripts I published. I am always using mv to rename files. Also I found than using sh in scripts can be a little bit tricky because debian use dash when gentoo use sh, and it is a few differences between them (dash seam to be more restrictive sometime). For that reason, for anything but very simple and basic scripts, I prefer to depend on bash.

tramp
Established Member
Posts: 1374
Joined: Mon Jul 01, 2013 8:13 am

Re: dkbuilder: from circuit to LV2 plugin

Postby tramp » Mon Feb 25, 2019 7:28 am

Dominique wrote: I am always using mv to rename files.


Eh good hint.
I've added renaming with mv now as last resort, if non of the usual rename tools been found.
On the road again.

Dominique
Established Member
Posts: 54
Joined: Sat May 26, 2018 10:24 am

Re: dkbuilder: from circuit to LV2 plugin

Postby Dominique » Tue Feb 26, 2019 6:28 pm

Thank you! It look to work fine. It is a typo into BigMuffPi.sch. I get

Code: Select all

Traceback (most recent call last):
  File "./build-plug.py", line 258, in <module>
    main(sys.argv[1:])
  File "./build-plug.py", line 255, in main
    dk.build()
  File "./build-plug.py", line 201, in build
    c1.read_gschem(workfile)
  File "./analog.py", line 515, in read_gschem
    exec mk_netlist.read_netlist(filename) in v
  File "<string>", line 67
    D(4): dict(Is=10e-12, mUt=30e-3V),
                                   ^
SyntaxError: invalid syntax


If I remove the "V" at the end of the D4 value, it work fine.

tramp
Established Member
Posts: 1374
Joined: Mon Jul 01, 2013 8:13 am

Re: dkbuilder: from circuit to LV2 plugin

Postby tramp » Wed Feb 27, 2019 5:59 am

Yea, a typo, I've fixed now in git, thanks.

Talking about Diodes, I've modified the Model a bit by adding a value field for the Emission coefficient. (The old definition dict still works as well) This makes it easier to use the values given on Data sheets, when you would simulate a special Diode model. Also I've added a couple of Diode models to circ.py, which allow now to use them by just enter the name of the model in the value field, instead fill in all the values.
I've done the same for transistors.
The same is true for tubes.
You could check which models been supported on top of the file circ.py
New models could as well easily be added there.
So for newly created schematics, it will be much easier to use different versions of those Components.
On the road again.

Dominique
Established Member
Posts: 54
Joined: Sat May 26, 2018 10:24 am

Re: dkbuilder: from circuit to LV2 plugin

Postby Dominique » Wed Feb 27, 2019 1:09 pm

What are the models for the diodes and transistors, the ones from spice or ngspice, or some other?
And for the tubes, is it the Koran model or another one?

When making oscillator simulation for my theremin viewtopic.php?f=52&p=102700
I found than the best suited model for that is the one from Ayumi. To work with ngspice, it need some syntax related modification and the last ngspice code from its git repository. I also found that paper https://www.bnl.gov/isd/documents/79916.pdf Modeling and Simulation of the Power Amplifier of the RHIC, which describe a simulation with a high power pentode model based on the constant current curves. That have the main advantage to provide a simple model with much less dispersion of the dynamic tube parameters than with a model based on the constant voltages curves, and that even when the tube is driven in extreme conditions with a lot of grid current.

For audio simulation, it doesn't matter for hifi, but for guitar amplifier simulation, it could be good to have such models. The main issue is than we dispose only of the constant voltage curves for such low power tubes, and it is a time consuming task to extrapolate the constant current curves from these.

tramp
Established Member
Posts: 1374
Joined: Mon Jul 01, 2013 8:13 am

Re: dkbuilder: from circuit to LV2 plugin

Postby tramp » Wed Feb 27, 2019 1:49 pm

Dominique wrote:What are the models for the diodes and transistors, the ones from spice or ngspice, or some other?
And for the tubes, is it the Koran model or another one?


The tube's been based on the Koran model, yes. Diodes and transistors using nodal DK method based on the Master Thesis of Jaromír Mačák.
The Thesis is here:
https://www.vutbr.cz/www_base/zav_prace ... e_id=60090

here is a other Thesis related to the DK method:
https://www.researchgate.net/profile/Pi ... Method.pdf

Dominique wrote:When making oscillator simulation for my theremin viewtopic.php?f=52&p=102700


Here we hit a border, as oscillator simulation didn't work very well with the dk builder.
On the road again.

Dominique
Established Member
Posts: 54
Joined: Sat May 26, 2018 10:24 am

Re: dkbuilder: from circuit to LV2 plugin

Postby Dominique » Wed Feb 27, 2019 6:16 pm

Thanks for the explanation and the links.

Is it possible to use the dkbuilder with 2 inputs and 1 input schematic like a VCA?

Another question is that I don't understand if the "--table n" option must be used just to show a diagram, or if dkbuilder need it for some circuits to be correctly converted to plugins, and if so, how can I know when it is needed?


Return to “Developer's Section”

Who is online

Users browsing this forum: No registered users and 1 guest