We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSound,  Music Libraries › Minim: Can't play unbuffered WAVS!
Page Index Toggle Pages: 1
Minim: Can't play unbuffered WAVS! (Read 579 times)
Minim: Can't play unbuffered WAVS!
Jan 26th, 2008, 8:39pm
 
Hey,

I recorded some wav files to my hdd.
I'm using the recorable class like that:
____________

in = Minim.getLineIn(Minim.STEREO, 512);
recorder = Minim.createRecorder(in, "myrecording.wav", false);

____________

I set the "buffer" argument to false because I don't want to use the recorder.save() method...i want to stream the recorded files over a network...
The Problem is, the remote AudioPlayer doesn't play "unsaved" (unbuffered) wavs.
____________

groove =  Minim.loadFile("/projects/dev/ISY/myrecording.wav",512);
groove.loop();

____________
 

As soon as i'm using recorder.save() the wavs are played properly. Is there a way to play "unsaved" wavs? My VLC also plays the unsaved ones.

Off topic: Is there another way to stream the effected Audiofiles, NOT writing them to the hdd first....
Re: Minim: Can't play unbuffered WAVS!
Reply #1 - Jan 27th, 2008, 12:13am
 
Yah, when you do unbuffered recording it just means that it is writing to the file as you record, rather than storing it in memory and then writing it out to the file all at once. You still have save() because the file that is being written to needs to be closed.

The thing to do would be to write your own SampleRecorder (http://code.compartmental.net/minim/javadoc/ddf/minim/SampleRecorder.html) that transmits samples over the network, rather than writing to a file, and then create an AudioRecorder directly using the constructor. You might also just write an AudioListener implementation and add it as a listener on the input. When it receives samples it would transmit them over the network.
Re: Minim: Can't play unbuffered WAVS!
Reply #2 - Jan 27th, 2008, 10:19am
 
Thank you...

The lister should be like that right?

-------------------------------------------

class playBack implements AudioSignal, AudioListener{ //Just a simple "re-route" audio class.
float[] left, right;
//Getting.
public void samples(float[] arg0) {
left = arg0;
}

public void samples(float[] arg0, float[] arg1) {
left = arg0;
right = arg1;
}
//Sending back.
public void generate(float[] arg0) {
System.arraycopy(left, 0, arg0, 0, arg0.length);
}

public void generate(float[] arg0, float[] arg1) {
System.out.println(arg0[0]);
if (left!=null && right!=null){
System.arraycopy(left, 0, arg0, 0, arg0.length);
System.arraycopy(right, 0, arg1, 0, arg1.length);
}
}
}

//Here's the runner code:

Minim.start(this);
AudioOutput ap = Minim.getLineOut();
AudioInput ai = Minim.getLineIn();
playBack pb = new playBack();
ai.addListener(pb); //Samples from mic go to pb
ap.addSignal(pb); //ap will playback pb constantly.

-----------------------------------------------------

My only problem ist the neetwork thing Sad
Do you know any code examples for that HOLE thing?

Thx!
Re: Minim: Can't play unbuffered WAVS!
Reply #3 - Jan 27th, 2008, 6:03pm
 
heh network stuff can be tricky... Search these and other java forums, as that'll be unrelated to 'sound, music'.
Page Index Toggle Pages: 1