annotate src/com/aurellem/capture/examples/HelloAudioRecording.java @ 52:d799a0278cc9

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