0

I want to be able to record audio and save it to persistent storage in my j2me application. As I understand j2me does not expose the handset's file system, instead it wants the developer to use the RMS system. I understand the idea behind RMS but cannot seem to think of the best way to implement audio recording using it. I have a continuous stream of bits from the audio input which must be saved, 1) should I make a buffer and then periodically create a new record with the bytes in the buffer. 2) Should I put each sample in a new record? 3) should I save the entire recording file in a byte array and then only write it to the RMS on stop recording?

Is there a better way to achieve this other than RMS?

user434541
  • 1,305
  • 2
  • 13
  • 21

1 Answers1

1

Consider this code below and edit it as necessary it should solve your problem by writing to the phone filesystem directly

getRoots();


FileConnection fc = null;

DataOutputStream dos = null;

fc = (FileConnection)Connector.open("file:///E:/");

if (!fc.exists())

{

fc.mkdir();

}
fc = (FileConnection) Connector.open("file:///E:/test.wav");

if (!fc.exists())

{

fc.create();

}

dos = fc.openDataOutputStream();

dos.write( recordedSoundArray);
axel22
  • 32,045
  • 9
  • 125
  • 137
kezyRoan
  • 11
  • 1