Problem with minim

edited June 2015 in Library Questions

Hi, i need help my processing give-me this error " ==== JavaSound Minim Error ==== ==== Error acquiring TargetDataLine: line with format PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian not supported." and i don't know why, it only gives this on my new notebook. when i run the code it record the first sound and play it, then it record the second sound but first i got that error and the file recorded don''t have any sound, like if the mic turned off after saving the first one

Image with the error:

Processing Code:


//minim Record
import ddf.minim.*;

Minim minim;
AudioInput [] audioIn;
AudioRecorder [] recorder;
AudioPlayer [] history;

int gravacao=0;
int p, i;
float duration, startTime, time, totalDuration;
boolean soUm=false, rec=true, load=false;

void setup() {
size(400, 400, P3D);
soUm=false;
if (gravacao==0) rec=true;
frameRate(30);
}

void draw() {
if (p==gravacao&&time<=0) {
if (soUm==false) {
setupMinim();
gravacao++;
println("gravacao "+gravacao);
rec=true;
soUm=true;
}
if (rec==true) {
recorder[p].beginRecord();
println("Recording");
}
}
if (gravacao>0&&rec==false) {
if (load==false) {
loadFiles();
load=true;
}
if (load==true) {
playfile();
}
}
}

void loadFiles() {
println("Loading");
history= new AudioPlayer[gravacao];
for (i=0; i<gravacao; i++) {
println("i "+i);
history[i]= minim.loadFile ("data/hist"+i+".wav");
}
}

void playfile() {
if (time<=0) {
println("Playing");
history[p].play();
duration=history[p].length();
println("duration "+duration);
p++;
println("p "+p);
startTime = millis()/1000 + duration/1000;
}
time = startTime - millis()/1000;
}

void setupMinim() {
minim = new Minim(this);
audioIn=new AudioInput[gravacao+1];
audioIn [p] = minim.getLineIn();
recorder= new AudioRecorder[gravacao+1];
recorder[p] = minim.createRecorder(audioIn[p], "data/hist"+p+".wav");
}

void keyPressed()
{
if ( key == 'r' )
{
if ( recorder[p].isRecording() ) {
recorder[p].endRecord();
println("Stop Recording");
}
}
if ( key == 's' )
{
recorder[p].save();
println("Done saving.");
soUm=false;
rec=false;
p=0;
load=false;
draw();
}
}

Thanks

Answers

  • edited June 2015

    I discover one thing I said that my code run on other PCs, but only run on mac every windows I try I get the same error

    Any help?

    thanks

  • Answer ✓

    Ok i solve my problem but i still don't understand how the code works on mac and not on windows i add that line of code:

    audioIn [p].close();

    to the:


    if ( key == 's' )
    {
    recorder[p].save();
    audioIn [p].close();
    println("Done saving.");
    soUm=false;
    rec=false;
    p=0;
    load=false;
    draw();
    }

    Maybe it helps someone

  • thanks for sharing this!

    Chrisir

Sign In or Register to comment.