Looking for example BELL code using Wellen library

I’m using the Wellen audio library to create sounds for my second ever Processing project, so apologies if this is an easy question - I’m still a novice programmer. The library was updated in January to include a small but useful selection of DSP instruments - such as InstrumentInternalLibrary.BELL - and I can’t figure out how to use these to play sounds. So if you are also using Wellen and know how to do this I’d be really grateful if you could share the code here. Thanks.


Welcome to the forum! :slight_smile:

I’ve never used the library myself but quoting the reference :

public class InstrumentInternalLibrary extends java.lang.Object

a collection of DSP instruments.

these instruments can be used to replace the default instrument ( i.e InstrumentInternal ) e.g by using the method Tone.replace_instrument(InstrumentInternal) .

all instruments are extended from InstrumentInternal , however some the original functionality is extended, changed or even removed.

note that these instruments only work with the internal tone engine. however, due to the modular nature of the library these instruments can also be integrated into DSP applications.

So taking the basic example from the examples folder :

package wellen.examples.basics;

import processing.core.PApplet;
import wellen.Tone;

// Import the required class
import wellen.InstrumentInternalLibrary;

public class ExampleBasics05Instruments extends PApplet {

     * this example demonstrates how to use *instruments* to play multiple notes at the same time.

    public void settings() {
        size(640, 480);

    public void setup() {
        // Use the BELL instrument since it's a static class

    public void draw() {
        ellipse(width * 0.5f, height * 0.5f, Tone.is_playing() ? 100 : 5, Tone.is_playing() ? 100 : 5);

    public void mousePressed() {
        int mNote = 45 + (int) random(0, 12);
        Tone.note_on(mNote, 80);
        Tone.note_on(mNote + 7, 80);
        Tone.note_on(mNote - 5, 80);

    public void mouseReleased() {

    public static void main(String[] args) {

I didn’t tested this but it should work just by looking at the documentation. :wink:

Thanks josephh - I’d got pretty much as far as that myself looking at the examples, but using your code ran into the same error at setup() where it tells me “InstrumentInternalLibrary.BELL cannot be resolved to a variable”. Dennis P Paul, who created Wellen, is very active with updates so I’m hoping the next release will include more examples that explain these latest features!

Hi again,

My bad I think that it’s not the right import statement, rather use :

// To import all the static instrument classes (discouraged)
import wellen.InstrumentInternalLibrary.*;

// or

// To import only the BELL static class (preferable)
import wellen.InstrumentInternalLibrary.BELL;

Then use it :


Also if the author doesn’t provide not much information, feel free to send him a message or open an issue on the GitHub repo!

Hope it helps :wink: