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?

4

1 回答 1

1

考虑下面的代码并根据需要对其进行编辑,它应该可以通过直接写入手机文件系统来解决您的问题

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);
于 2011-06-13T23:40:01.327 回答