comparison src/com/aurellem/capture/examples/HelloAudioRecording.java @ 50:8a091a5f48fa

documentation for basic use case
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Dec 2011 13:35:13 -0600
parents fc71e797f4fa
children afc437f637bd
comparison
equal deleted inserted replaced
49:121b6d7e4d3f 50:8a091a5f48fa
7 7
8 import com.aurellem.capture.Capture; 8 import com.aurellem.capture.Capture;
9 import com.aurellem.capture.IsoTimer; 9 import com.aurellem.capture.IsoTimer;
10 import com.jme3.app.Application; 10 import com.jme3.app.Application;
11 11
12 /** Recording audio from your Application is simple. If all you
13 * want to do is record Audio, then follow the following steps.
14 *
15 * 1.) Set the Application's timer to an IsoTimer. The framerate is
16 * irrelevant for sound, but must evenly divide 44,100Hz, which is the
17 * frequency at which sound will be recorded. For example
18 * IsoTimer(60) is ok, but IsoTimer(61) is not.
19 *
20 * 2.) Call Capture.captureAudio(yourApplication, target-file) before
21 * calling yourApplication.start()
22 *
23 * That's it! If you have any comments/problems, please PM me on the
24 * jMonkeyEngine forms. My username is bortreb.
25 *
26 * @author Robert McIntyre
27 */
12 public class HelloAudioRecording { 28 public class HelloAudioRecording {
13 29
14 public static void main(String[] ignore) throws IOException{ 30 public static void main(String[] ignore) throws IOException{
15 Application app = new HelloAudio(); 31 Application app = new HelloAudio();
16 File audio = File.createTempFile("JME-simple-audio", ".wav"); 32 File audio = File.createTempFile("JME-simple-audio", ".wav");
17 app.setTimer(new IsoTimer(60)); 33 app.setTimer(new IsoTimer(60));
18 Capture.captureAudio(app, audio); 34 Capture.captureAudio(app, audio);
19 app.start(); 35 app.start();
20 System.out.println(audio.getCanonicalPath()); 36 System.out.println(audio.getCanonicalPath());
21 } 37 }
22
23 } 38 }