view src/com/aurellem/capture/examples/HelloAudioRecording.java @ 65:23e3df41db3c

reformatting for web
author Robert McIntyre <rlm@mit.edu>
date Sat, 11 Feb 2012 12:25:26 -0700
parents afc437f637bd
children
line wrap: on
line source
1 package com.aurellem.capture.examples;
3 import java.io.File;
4 import java.io.IOException;
6 import jme3test.helloworld.HelloAudio;
8 import com.aurellem.capture.Capture;
9 import com.aurellem.capture.IsoTimer;
10 import com.jme3.app.Application;
12 /** Recording audio from your Application is simple. If all you want
13 * 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
17 * the 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 */
28 public class HelloAudioRecording {
30 public static void main(String[] ignore) throws IOException{
31 Application app = new HelloAudio();
32 File audio = File.createTempFile("JME-simple-audio", ".wav");
33 app.setTimer(new IsoTimer(60));
34 Capture.captureAudio(app, audio);
35 app.start();
36 System.out.println(audio.getCanonicalPath());
37 }
38 }