rlm@45: package com.aurellem.capture.examples; rlm@45: rlm@45: import java.io.File; rlm@45: import java.io.IOException; rlm@45: rlm@45: import jme3test.helloworld.HelloAudio; rlm@45: rlm@45: import com.aurellem.capture.Capture; rlm@45: import com.aurellem.capture.IsoTimer; rlm@45: import com.jme3.app.Application; rlm@45: rlm@56: /** Recording audio from your Application is simple. If all you want rlm@56: * to do is record Audio, then follow the following steps. rlm@50: * rlm@50: * 1.) Set the Application's timer to an IsoTimer. The framerate is rlm@56: * irrelevant for sound, but must evenly divide 44,100Hz, which is rlm@56: * the frequency at which sound will be recorded. For example rlm@50: * IsoTimer(60) is ok, but IsoTimer(61) is not. rlm@50: * rlm@50: * 2.) Call Capture.captureAudio(yourApplication, target-file) before rlm@50: * calling yourApplication.start() rlm@50: * rlm@50: * That's it! If you have any comments/problems, please PM me on the rlm@50: * jMonkeyEngine forms. My username is bortreb. rlm@50: * rlm@50: * @author Robert McIntyre rlm@50: */ rlm@46: public class HelloAudioRecording { rlm@45: rlm@56: public static void main(String[] ignore) throws IOException{ rlm@56: Application app = new HelloAudio(); rlm@56: File audio = File.createTempFile("JME-simple-audio", ".wav"); rlm@56: app.setTimer(new IsoTimer(60)); rlm@56: Capture.captureAudio(app, audio); rlm@56: app.start(); rlm@56: System.out.println(audio.getCanonicalPath()); rlm@56: } rlm@45: }