The Sonic Landscape

MaxLink with Max/Msp

Posted on | July 30, 2010 | 1 Comment

Quick update on my current project.

I’ve recently been experimenting with the MaxLink (processing library) as a quick way to communicate between Processing and Max/Msp. I may look into using the OSC library as an alternative, but so far i’ve managed to generate the sine wave signals using Max/Msp which sound slightly better than using the minim library.

I’ve only used Max/Msp a few times in university but decided to try and use it again to generate the sinewave signals, although unfortunately the mxj.jk.link (Max/Msp object) didn’t have a max.help file associated with it.

I managed to create an array of 13 inlets for the mxj.jk.link object, and edited my processing code to send each of my Pachube values to each inlet on the max patch. StatsInSound Stats In Sound

The result is better than i expected. The sinewave signals  are very pure in tone with no audible clicks. Again i’ve panned each of the sine wave signals from left to right and managed to display the waves using the scope~ object (max/msp).

Here is my progress so far (click the image below for a larger view)

MAXLINK Pachube 5 300x172 MaxLink with Max/Msp

Comments

One Response to “MaxLink with Max/Msp”

  1. mudit uppal
    November 26th, 2011 @ 2:15 pm

    Hey, can you help me out here.. Well using minim library in eclipse. Code running fine. Output is like a keyboard with sounds..
    What i wanna do is send this sound to max msp and process it there through the max msp patch.. How can i do that? Please help!

    package music.instruments.MTPiano;

    import java.util.HashMap;
    import com.cycling74.max.*;
    import java.util.Map;

    import processing.core.PApplet;
    import ddf.minim.AudioOutput;
    import ddf.minim.Minim;

    public class NotePlayer {

    private PApplet app;

    public NotePlayer(PApplet app) {
    this.app = app;
    keys = new HashMap();
    }

    public enum Key {
    KEY_TYPE_C,
    KEY_TYPE_C_SUST,
    KEY_TYPE_D,
    KEY_TYPE_D_SUST,
    KEY_TYPE_E,
    KEY_TYPE_F,
    KEY_TYPE_F_SUST,
    KEY_TYPE_G,
    KEY_TYPE_G_SUST,
    KEY_TYPE_A,
    KEY_TYPE_A_SUST,
    KEY_TYPE_B,
    KEY_TYPE_C_UP,
    KEY_TYPE_INVALID
    }

    private Map keys;

    public void playNote(Key k) {
    closeMinim(k);

    Minim minim = new Minim(app);
    AudioOutput out = minim.getLineOut(Minim.MONO, 2048);

    NoteMinim nm = new NoteMinim();
    nm.setMinim(minim);
    nm.setAudioOutput(out);

    keys.put(k, nm);

    if (k == Key.KEY_TYPE_A) {
    out.playNote(“A”);
    } else if (k == Key.KEY_TYPE_B) {
    out.playNote(“B”);
    } else if (k == Key.KEY_TYPE_C) {
    out.playNote(“C”);
    } else if (k == Key.KEY_TYPE_D) {
    out.playNote(“D”);
    } else if (k == Key.KEY_TYPE_E) {
    out.playNote(“E”);
    } else if (k == Key.KEY_TYPE_F) {
    out.playNote(“F”);
    } else if (k == Key.KEY_TYPE_G) {
    out.playNote(“G”);
    } else if (k == Key.KEY_TYPE_C_SUST) {
    out.playNote(“C#”);
    } else if (k == Key.KEY_TYPE_D_SUST) {
    out.playNote(“D#”);
    } else if (k == Key.KEY_TYPE_F_SUST) {
    out.playNote(“F#”);
    } else if (k == Key.KEY_TYPE_G_SUST) {
    out.playNote(“G#”);
    } else if (k == Key.KEY_TYPE_A_SUST) {
    out.playNote(“A#”);
    } else if (k == Key.KEY_TYPE_C_UP) {
    out.playNote(“C5″);
    }

    if (out.isMuted()) {
    out.unmute();
    }
    /*
    summer.pan();

    // create a SquareWave with a frequency of 440 Hz,
    // an amplitude of 1 and the same sample rate as summer
    SquareWave square;
    if (k == NotePlayer.Key.KEY_TYPE_C) {
    square = new SquareWave(240, 1, 44100);
    } else {
    square = new SquareWave(440, 1, 44100);
    }
    // create a LowPassSP filter with a cutoff frequency of 200 Hz
    // that expects audio with the same sample rate as summer
    LowPassSP lowpass = new LowPassSP(200, 44100);

    // now we can attach the square wave and the filter to our output
    summer.addSignal(square);
    summer.addEffect(lowpass);

    if (summer.isMuted()) {
    summer.unmute();
    }*/
    }

    public void stopNote(Key k) {

    }

    private void closeMinim(Key k) {
    if (keys.containsKey(k)) {
    NoteMinim nm = keys.get(k);
    nm.getAudioOutput().mute();
    nm.getAudioOutput().close();
    nm.getMinim().stop();
    }
    }

    private class NoteMinim {
    private AudioOutput out;
    private Minim minim;

    public AudioOutput getAudioOutput() {
    return out;
    }

    public void setAudioOutput(AudioOutput out) {
    this.out = out;
    }

    public Minim getMinim() {
    return minim;
    }

    public void setMinim(Minim minim) {
    this.minim = minim;
    }
    }
    }

Leave a Reply





*

  • Pages

  • Admin

  • Archives

  • %d bloggers like this: