Skip navigation links

Package org.simbrain.world.oscworld

(Currently unused) A world which allows sounds to be produced using open sound control.

See: Description

Package org.simbrain.world.oscworld Description

(Currently unused) A world which allows sounds to be produced using open sound control.

Summary

The OpenSound Control (OSC) world adds OSC in and OSC out support to Simbrain. OpenSound Control is a communication protocol which allows musical instruments (especially electronic musical instruments such as synthesizers), computers, and other multimedia devices to share music performance data in realtime over a network. [1]

Simbrain to OSC out

The OSC world can be coupled to a network in order to send OSC messages with a single float argument to external applications. More than one OSC message sender can be configured to produce messages with different OSC Address Patterns [2].

Example

  1. Create a network with at least one neuron
  2. Insert --> New Network
    Right click --> New Neuron

  3. Open an OSC world
  4. Insert --> New World --> OSC World

  5. Create a new OSC out message
  6. File --> Create OSC out message
    Type "/melody" and hit OK.

  7. Couple the neuron's activation to the OSC message's /melody, f attribute
  8. Right click on the /melody, f OSC message --> Set input source --> Network --> Neuron_1 --> Activation
     or
    Right click on the neuron --> Set output target --> OSC World --> OSC Message --> /melody, f

  9. Set up an external OSC application to generate sound from the /melody OSC messages
  10. For example, run the following script in ChucK [3]:

    melody.ck:

    SinOSC melody => dac;
    0.5 => melody.gain;
    
    OscRecv recv;
    9999 => recv.port;
    recv.listen();
    
    recv.event("/melody, f") @=> OscEvent @ melodyEvent;
    
    spork ~ pollMelodyEvent(melodyEvent);
    
    me.yield();
    
    while (true)
    {
        1::second => now;
    }
    
    fun void pollMelodyEvent(OscEvent event)
    {
        while (true)
        {
            event => now;
            while (event.nextMsg())
            {
                1760.0 + (800.0 * event.getFloat()) => melody.freq;
            }
        }
    }
    

    From the command-line:

    $ chuck melody.ck
    

  11. Activation changes in the neuron result in changes to the sound frequency
  12. Double-click on the neuron
    Set Neuron type to Random
    Click OK

    Click Global iterate network update algorithm button

OSC in to Simbrain

The OSC world can be coupled to a network in order to receive OSC messages with a single float argument from external applications. More than one OSC message receiver can be configured to handle messages with different OSC Address Patterns [2].

Example

  1. Create a network with at least one neuron
  2. Insert --> New Network
    Right click --> New Neuron

  3. Open an OSC world
  4. Insert --> New World --> OSC World

  5. Create a new OSC in message
  6. File --> Create OSC in message
    Type "/pulse" and hit OK.

  7. Couple the neuron's activation to the OSC message's /pulse, f attribute
  8. Right click on the /pulse, f OSC message --> Set output target --> Network --> Neuron_1 --> Activation
     or
    Right click on the neuron --> Set input source --> OSC World --> OSC Message --> /pulse, f

  9. Set up an external OSC application to send /pulse OSC messages
  10. For example, run the following script in ChucK [3]:

    pulse.ck:

    OscSend send;
    send.setHost("localhost", 9998);
    
    while (true)
    {
        send.startMsg("/pulse", "f");
        Std.rand2f(0.1, 0.9) => send.addFloat;
    
        1::second => now;
    }
    

    From the command-line:

    $ chuck pulse.ck
    

  11. OSC pulse messages change the neuron's activation
  12. Click Global iterate network update algorithm button

Acknowledgements

The OSC world is based on the JavaOSC library [4].

References

Skip navigation links