Writing Docs Gigedit SFZ Instrument Scripts NKSP Language NKSP Reference

LinuxSampler 2.2.0

LinuxSampler 2.2.0 and friends were released on May 9th 2021. Almost two years have passed since the previous release. This time there are a load of changes and especially many new features packed into this release.

C++11 / C++14 Requirement

Starting with Gigedit 1.2.0 and libgig 4.3.0 you now need at least a C++11 compliant compiler to build them from source; and for building LinuxSampler 2.2.0 you now need at least a C++14 compliant compiler. Originally it was planned to only raise the minimum compiler requirement to C++11 for LinuxSampler in this release as well, however during this development cycle, some C++14 features came across which helped to reduce code complexity in the LinuxSampler code base tremendously.

Real-Time Instrument Scripts

The NKSP real-time instrument script engine has received tremendous new features and improvements in this release, which are outlined next.

64-Bit NKSP Integers

Instrument script variables of type integer (e.g. declare $foo := 4294967295) are now all 64-bit internally, which prevents unexpected side effects of script authors due to potential integer overflows that easily had happened before when integer script variables were just 32-bit wide.    Find out more ...

NKSP Real Numbers

On NKSP language level there is now support for floating point variables; both scalar types (e.g. declare ~foo := 3.94 ) and floating point arrays (e.g. declare ?foo[] = ( 1.6, 4.7 ) ).    Find out more ...

NKSP Standard Measuring Units

Another huge new NKSP language feature is support for standard measuring units like Hz (Hertz), dB (Decibel), s (seconds), c (cents) in conjuction with arbitrary metric prefixes like kHz, mdB, ms, mc, etc.

For instance previously for pausing a script for one second, you had to write wait(1000000), which still works, but now you can also just write wait(1s).    Find out more ...

NKSP Final Operator

The newly introduced "final" operator ! in NKSP allows to force a synthesis parameter like e.g. volume or pitch to a specific value that should not be overridden by any other modulation source (e.g. neither from patch level, nor LFOs, nor from EGs, ...). This is sometimes helpful for being able to e.g. say in a script, "hey, the volume of this voice should be exactly -3dB, period. I mean it!", which is as simple as change_vol($EVENT_ID, !-3dB)    Find out more ...

New Built-In NKSP Functions

Furthermore there are 23 new built-in NKSP script functions and 6 new NKSP constants/variables.

There also 2 new event handler types for processing MIDI RPN events:

and for MIDI NRPN events:

Find out more ...

NKSP Patch Variables

Instrument scripts give you great flexibility to achieve whatever exotic bahaviour you might have in mind for your sounds. Built-in patch parameters on the other hand, hard coded into the sampler engines and supported already by the underlying file format allow very quick and convenient parameter changes, e.g. simply by few clicks in the Gigedit instrument editor. What about having both?

This is what the new NKSP "patch" variables are for. By simply declaring an instrument script variable with the new NKSP keyword patch you are publishing and exposing that variable as parameter in the instrument editor's patch parameters pane.

Patch variables are shown and adjustable on a per instruments basis. So you can share a script among multiple instruments and override certain script parameters to customize the script behaviour for your individual instruments if needed. Gigedit shows you the default values of each patch variable. After changing a value of some of the variables the respective variable turns into a bold font, so you can immediately see which script parameters you have adjusted for the specific instrument and which not. By selecting one of the overridden variables and hitting the Backspace (⌫) key you can revert those variables back to their default values.

GigaStudio Format Engine

For the GigaStudio/Gigasampler (.gig) format sampler engine several new format extensions have been added. Of course there are also many fixes for the gig engine in this release, but they are too many to list them here. Please refer to the ChangeLog for more details about all the corrections in this release.

LFO Extensions

You now have much more control over LFOs with the gig engine like selecting different LFO waveforms as sine, triangle, saw or square. GigaStudio had this limited to sine only. The default LFO wave form in LinuxSampler's gig engine has also changed to sine for that reason (instead of triangle in previous LinuxSampler versions). Additionally you can now also fine control the start phase of individual LFOs. In the original gig format you were only able to flip the phase.

New Filter Types

Furthermore there are now new audio filter types available for the Giga engine: new lowpass 1/2/4/6-pole, new highpass 1/2/4/6-pole, new bandpass 2-pole, and finally a bandreject 2-pole filter.

You might say that some of those filter types existed before, and they still do and will continue to co-exist, but they simply sound differently. Keep in mind that the audio filters for the Giga engine were very carefully engineered to accurateley replicate the sounds as if being played with Tascam's GigaStudio, so that made and still makes sense. However you might simply like the sound of some of the new filter types more for certain reasons when creating your own gig instruments from scratch.

SFZ Format Engine

On SFZ format engine side there are corrections for the SFZ opcodes loccN/hiccN and xfin_hivel.

LinuxSampler Test Cases

For package maintainers: the LinuxSampler unit tests (which were broken before) have been fixed in this release and work now as expected. It is recommend for them to be run automatically to detect and prevent any OS issues that might cause misbehaviours for users. Just keep in mind the test cases also test the LSCP server which will listen on TCP port 8888 during the tests. So make sure this port cannot be accessed from outside for security reasons.

Gigedit 1.2.0

Our instrument editor for the GigaStudio/Gigasampler format also received many new features. Some of them have already been shown above among the new features in LinuxSampler.

NKSP Standard Measuring Units

The real-time instrument script editor of Gigedit supports now syntax highlighting for LinuxSampler's new standard measuring units (kHz, c, ms, dB, etc.) feature of the NKSP script language.

New "Script" Tab

On the right hand side of Gigedit (the main working area actually) there is now a new tab "Script" which reveals a list of so called NKSP "patch" variables which have been described above among LinuxSampler's new features.

Sample Properties Dialog

A new dialog has been added to access the global settings and meta info of individual samples, similar to the meta info dialog that already existed for individual instruments.

More Flexible Gain

Gain can now be set to any arbitary value between -96 dB .. +96 dB. Previously it was only possible to set gain to max. 0 dB and there was a checkbox which allowed a hard coded boost to exactly +6 dB. The previous appearance replicated the appearance of GigaStudio's original instrument editor.

The previous limitation of having just a single possible value for positive gain was unfortunate, but as it turned out this was actually not a limitation of the original gig file format. And in fact we have not added any gig file format extension for this reason to achieve this new freedom of arbitrary gain settings. So setting a positive gain of e.g. let's say +1.45 dB does not break compatibility of your sounds with GigaStudio.

Convenience Features

And last but not least various minor convenience functions have been added, for instance the default double click behaviour on instruments (which would open their meta info dialog) can now optionally be disabled, window size, position and vertical spliter position are now auto saved and restored (correctly) by default among Gigedit sessions.

And the up/down buttons' steps have been individually adjusted to make more sense for the individual synthesis parameters they control. And regarding the latter: remember that the up/down steppers do actually have two distinct operations per button: a regular left-mouse click for small changes and middle-mouse click for larger changes. Both have been adjusted appropriately for the individual synthesis parameters they control.

libgig 4.3.0

Our fundamental file access C++ library libgig has also received new features and corrections. Most of them deal with the Giga format extensions added by LinuxSampler, so they are obviously also added on libgig side. We are not going to repeat them here, because it should already be obvious from LinuxSampler's new features described above. There are however also new build requirements for libgig as follows.

UUID Function Required

From this release on (besides the new C++11 requirement) presence of some UUID generating function is required, which must be provided by the underlying OS. Previously the presence of an UUID generating function was optional in libgig for many years. Its absence in the past only meant that you were unable to load your own gig files (e.g. created from scratch with Gigedit by yourself) into Tascam's GigaStudio software, it did not mean though any restriction in conjunction with LinuxSampler in the past. The latter has changed in this release. Without UUIDs in gig files you would now also get misbehaviours even while staying entirely in the Linux eco space, and hence this is now a hard build requirement for libgig.

GigaStudio 3 Compatibility Fixes

And as always there are a various fixes in this release, foremost sane output compatibility with GigaStudio 3 was broken, so that GigaStudio version might not have accepted gig files changed by you with the prior version of libgig. This issue is now fixed in this release. Please refer to the ChangeLog for other corrections in this release of libgig.

Serialization Framework

And last but not least libgig's Serialization framework was extended to support now various common C++ STL classes like std::string, std::vector, std::map and std::set out of the box. So no custom code is required aymore to serialize/deserialize such very common native C++ object types, which reduces code complexity for serializing/deserializing complex C++ projects a lot.

Document Updated:  2021-05-09  |  Author:  Christian Schoenebeck