Search in sources :

Example 1 with Minim

use of ddf.minim.Minim in project Minim by ddf.

the class AudioRecordingStreamLoop method Start.

void Start(String[] args) {
    fileFolder = args[0];
    minim = new Minim(this);
    AudioRecordingStream recording = minim.loadFileStream(args[1]);
    int loopCount = 1;
    // return -1 for the current test mp3, which means i probably need to test with a wav
    long expectedReads = recording.getSampleFrameLength() * (loopCount + 1);
    long reads = 0;
    recording.loop(loopCount);
    while (recording.isPlaying() && reads < expectedReads) {
        if (reads == 743041) {
            System.out.println("..");
        }
        recording.read();
        ++reads;
        if (recording.getLoopCount() == -1) {
            System.err.println("Loop count became -1 after " + reads + " reads!");
            break;
        }
    }
    if (expectedReads != reads) {
        System.err.println("Expected " + expectedReads + " reads, and made " + reads);
    } else if (recording.isPlaying()) {
        System.err.println("Recording is still playing after expected number of read.");
    }
}
Also used : AudioRecordingStream(ddf.minim.spi.AudioRecordingStream) Minim(ddf.minim.Minim)

Example 2 with Minim

use of ddf.minim.Minim in project Minim by ddf.

the class MultipleAudioPlayers method Start.

void Start(String[] args) {
    fileFolder = args[0];
    minim = new Minim(this);
    for (int i = 0; i < 17; ++i) {
        AudioPlayer player = minim.loadFile(args[1]);
        if (player == null) {
            System.out.println("File loading failed on attempt " + i);
            break;
        }
    }
    minim.stop();
}
Also used : AudioPlayer(ddf.minim.AudioPlayer) Minim(ddf.minim.Minim)

Example 3 with Minim

use of ddf.minim.Minim in project Most-Pixels-Ever-Processing by shiffman.

the class Threshold method setup.

// --------------------------------------
public void setup() {
    // make a new Client using an XML file
    client = new TCPClient(this, "mpe" + ID + ".xml");
    // the size is determined by the client's local width and height
    size(client.getLWidth(), client.getLHeight());
    if (client.getID() == 0) {
        minim = new Minim(this);
        in = minim.getLineIn(Minim.MONO, 256);
    }
    smooth();
    background(255);
    resetEvent(client);
    // IMPORTANT, YOU MUST START THE CLIENT!
    client.start();
}
Also used : TCPClient(mpe.client.TCPClient) Minim(ddf.minim.Minim)

Example 4 with Minim

use of ddf.minim.Minim in project Most-Pixels-Ever-Processing by shiffman.

the class Volume method setup.

//--------------------------------------
public void setup() {
    // make a new Client using an XML file
    client = new TCPClient(this, "mpe" + ID + ".xml");
    // the size is determined by the client's local width and height
    size(client.getLWidth(), client.getLHeight());
    if (client.getID() == 0) {
        minim = new Minim(this);
        in = minim.getLineIn(Minim.STEREO, 512);
    }
    smooth();
    background(255);
    resetEvent(client);
    // IMPORTANT, YOU MUST START THE CLIENT!
    client.start();
}
Also used : TCPClient(mpe.client.TCPClient) Minim(ddf.minim.Minim)

Example 5 with Minim

use of ddf.minim.Minim in project Most-Pixels-Ever-Processing by shiffman.

the class WaveForm method setup.

//--------------------------------------
public void setup() {
    // make a new Client using an XML file
    client = new TCPClient(this, "mpe" + ID + ".xml");
    // the size is determined by the client's local width and height
    size(client.getLWidth(), client.getLHeight());
    if (client.getID() == 0) {
        minim = new Minim(this);
        in = minim.getLineIn(Minim.MONO, 256);
    }
    smooth();
    resetEvent(client);
    // IMPORTANT, YOU MUST START THE CLIENT!
    client.start();
}
Also used : TCPClient(mpe.client.TCPClient) Minim(ddf.minim.Minim)

Aggregations

Minim (ddf.minim.Minim)6 TCPClient (mpe.client.TCPClient)3 AudioPlayer (ddf.minim.AudioPlayer)2 AudioRecordingStream (ddf.minim.spi.AudioRecordingStream)1