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@50: /** Recording audio from your Application is simple. If all you rlm@50: * want 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@50: * irrelevant for sound, but must evenly divide 44,100Hz, which is the rlm@50: * 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@45: public static void main(String[] ignore) throws IOException{ rlm@45: Application app = new HelloAudio(); rlm@45: File audio = File.createTempFile("JME-simple-audio", ".wav"); rlm@45: app.setTimer(new IsoTimer(60)); rlm@45: Capture.captureAudio(app, audio); rlm@45: app.start(); rlm@46: System.out.println(audio.getCanonicalPath()); rlm@45: } rlm@45: }