comparison src/com/aurellem/capture/examples/HelloAudioRecording.java @ 56:afc437f637bd

improved formating
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Dec 2011 19:25:27 -0600
parents 8a091a5f48fa
children
comparison
equal deleted inserted replaced
55:b05f629fc296 56:afc437f637bd
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 12 /** Recording audio from your Application is simple. If all you want
13 * want to do is record Audio, then follow the following steps. 13 * to do is record Audio, then follow the following steps.
14 * 14 *
15 * 1.) Set the Application's timer to an IsoTimer. The framerate is 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 16 * irrelevant for sound, but must evenly divide 44,100Hz, which is
17 * frequency at which sound will be recorded. For example 17 * the frequency at which sound will be recorded. For example
18 * IsoTimer(60) is ok, but IsoTimer(61) is not. 18 * IsoTimer(60) is ok, but IsoTimer(61) is not.
19 * 19 *
20 * 2.) Call Capture.captureAudio(yourApplication, target-file) before 20 * 2.) Call Capture.captureAudio(yourApplication, target-file) before
21 * calling yourApplication.start() 21 * calling yourApplication.start()
22 * 22 *
25 * 25 *
26 * @author Robert McIntyre 26 * @author Robert McIntyre
27 */ 27 */
28 public class HelloAudioRecording { 28 public class HelloAudioRecording {
29 29
30 public static void main(String[] ignore) throws IOException{ 30 public static void main(String[] ignore) throws IOException{
31 Application app = new HelloAudio(); 31 Application app = new HelloAudio();
32 File audio = File.createTempFile("JME-simple-audio", ".wav"); 32 File audio = File.createTempFile("JME-simple-audio", ".wav");
33 app.setTimer(new IsoTimer(60)); 33 app.setTimer(new IsoTimer(60));
34 Capture.captureAudio(app, audio); 34 Capture.captureAudio(app, audio);
35 app.start(); 35 app.start();
36 System.out.println(audio.getCanonicalPath()); 36 System.out.println(audio.getCanonicalPath());
37 } 37 }
38 } 38 }