Skip to content

Instantly share code, notes, and snippets.

View pbloem's full-sized avatar

Peter Bloem pbloem

View GitHub Profile
@pbloem
pbloem / Synth.java
Last active May 17, 2024 21:45
A simple java program, showing how to play a tune.
import java.util.Arrays;
import java.util.List;
import javax.sound.midi.MidiSystem;
import javax.sound.midi.Synthesizer;
import javax.sound.midi.MidiChannel;
/**
* A little example showing how to play a tune in Java.
*
Process p = runtime.exec(
"arch -i386 /usr/bin/python " + script,
new String[]{
"PATH=/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin:/usr/texbin",
"PYTHONPATH=/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages"},
target);
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
BufferedReader ebr = new BufferedReader(new InputStreamReader(p.getErrorStream()));
public class Data
{
@Module(name="test")
public static class Test
{
@In(name="test")
public int test;
@Main
public void body()