# Minim audio recording fails after 6 files are recorded

**URL:** <https://discourse.processing.org/t/minim-audio-recording-fails-after-6-files-are-recorded/17360>\
**Category:** Processing for Pi\
**Created:** [January 26, 2020, 9:39pm UTC](https://discourse.processing.org/t/minim-audio-recording-fails-after-6-files-are-recorded/17360 "2020-01-26T21:39:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bluemoon](https://avatars.discourse-cdn.com/v4/letter/b/bc79bd/32.png) [@bluemoon](https://discourse.processing.org/u/bluemoon)\
**Post date:** [January 26, 2020, 9:39pm UTC](https://discourse.processing.org/t/minim-audio-recording-fails-after-6-files-are-recorded/17360/1 "2020-01-26T21:39:30Z")

</div>

Hi folks, With a one line mod to the Minim RecordAudioInput library example to allow for recording multiple audio files, an error is thrown:  
`==== JavaSound Minim Error ==== ==== Couldn't open the line: line with format PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian not supported.`

The code producing the error is:

```auto
import ddf.minim.*;

Minim minim;
AudioInput in;
AudioRecorder recorder;

void setup()
{
size(512, 200, P3D);

minim = new Minim(this);

in = minim.getLineIn();
// create a recorder that will record from the input to the filename specified
// the file will be located in the sketch's root folder.
recorder = minim.createRecorder(in, "myrecording - "+new java.util.Date()+".wav");

textFont(createFont("Arial", 12));
}

void draw()
{
background(0);
stroke(255);
// draw the waveforms
// the values returned by left.get() and right.get() will be between -1 and 1,
// so we need to scale them up to see the waveform
for(int i = 0; i < in.bufferSize() - 1; i++)
{
line(i, 50 + in.left.get(i)*50, i+1, 50 + in.left.get(i+1)*50);
line(i, 150 + in.right.get(i)*50, i+1, 150 + in.right.get(i+1)*50);
}

if ( recorder.isRecording() )
{
text("Currently recording...", 5, 15);
}
else
{
text("Not recording.", 5, 15);
}
}

void keyReleased()
{
if ( key == 'r' )
{
// to indicate that you want to start or stop capturing audio data, you must call
// beginRecord() and endRecord() on the AudioRecorder object. You can start and stop
// as many times as you like, the audio data will be appended to the end of the buffer
// (in the case of buffered recording) or to the end of the file (in the case of streamed recording).
if ( recorder.isRecording() )
{
recorder.endRecord();
}
else
{
recorder = minim.createRecorder(in, "myrecording - "+new java.util.Date()+".wav");
recorder.beginRecord();
}
}
if ( key == 's' )
{
// we've filled the file out buffer,
// now write it to the file we specified in createRecorder
// in the case of buffered recording, if the buffer is large,
// this will appear to freeze the sketch for sometime
// in the case of streamed recording,
// it will not freeze as the data is already in the file and all that is being done
// is closing the file.
// the method returns the recorded audio as an AudioRecording,
// see the example AudioRecorder >> RecordAndPlayback for more about that
recorder.save();
println("Done saving.");
}
}

```

The only difference between this and the example code is the line: recorder = minim.createRecorder(in, “myrecording - “+new java.util.Date()+”.wav”); placed before: recorder.beginRecord();

I’m using Processing 3.5.3 on a Raspberry Pi.

Any thoughts on how to record more than 6 files?

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [January 27, 2020, 1:34am UTC](https://discourse.processing.org/t/minim-audio-recording-fails-after-6-files-are-recorded/17360/2 "2020-01-27T01:34:36Z")

</div>

no idea, i come over that file limit 6 already, no relation to file size, memory… just the number.

---

<div class="post-metadata">

**Author:** ![bluemoon](https://avatars.discourse-cdn.com/v4/letter/b/bc79bd/32.png) [@bluemoon](https://discourse.processing.org/u/bluemoon)\
**Post date:** [January 28, 2020, 1:07am UTC](https://discourse.processing.org/t/minim-audio-recording-fails-after-6-files-are-recorded/17360/3 "2020-01-28T01:07:50Z")

</div>

Ok, this one is fixed, you need to close() the recorder stream after saving, and not leave it hanging: recorder.save().close();
