//mp3-2-swfembedder.java
//@author Alex Zaharis, Dini Martini
//WDFIA 2009
import java.io.IOException;
import java.util.ArrayList;
import com.flagstone.transform.FSMovie;
import com.flagstone.transform.FSShowFrame;
import com.flagstone.transform.util.FSSoundConstructor;
class mp32swfembedder{
public static void main(String[] args){
try{
FSMovie movie = new FSMovie("theproof.swf");
FSSoundConstructor sounder = new FSSoundConstructor("theultrasound.mp3");
float framesPerSecond = 12.0f;
int samplesPerBlock = sounder.getSampleRate() / (int) framesPerSecond;
int numberOfBlocks = sounder.getSamplesPerChannel() / samplesPerBlock;
movie.add(sounder.streamHeader(samplesPerBlock));
for (int i=0; i numberOfBlocks; i++) {
movie.add(sounder.streamBlock(i, samplesPerBlock));
movie.add(new FSShowFrame());
}
movie.encodeToFile("aizak.swf");
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
Libraries can be found here.
Examples can be found here.
No comments:
Post a Comment