MIDI
Reproducir Sonidos en Java
public class Midi
{
public static void main (String[] args)
{
int freq = Integer.parseInt(args[0]);
int volu = Integer.parseInt(args[1]);
Synthesizer syn = null;
try
{
syn = MidiSystem.getSynthesizer();
}
catch(MidiUnavailableException ext)
{
System.out.println("Exception");
}
catch(Exception ext)
{
System.out.println("Exception");
}
try
{
syn.open();
}
catch(MidiUnavailableException exc)
{
System.out.println("Exception");
}
MidiChannel[] canales;
MidiChannel canal;
for(int i=0;i<=1;i++)
{
canales = syn.getChannels();
canal = canales[9];
canal.noteOn(freq,volu);
try
{
Thread.sleep(500);
}
catch(InterruptedException exp)
{
System.out.println("Exception");
}
canal.noteOff(freq);
}
for(int i=0;i<=6;i++)
{
canales = syn.getChannels();
canal = canales[9];
canal.noteOn(freq,volu);
try
{
Thread.sleep(250);
}
catch(InterruptedException exp)
{
System.out.println("Exception");
}
canal.noteOff(freq);
}
try
{
Thread.sleep(700);
}
catch(InterruptedException exp)
{
System.out.println("Exception");
}
for(int i=0;i<=6;i++)
{
canales = syn.getChannels();
canal = canales[9];
canal.noteOn(freq,volu);
try
{
Thread.sleep(250);
}
catch(InterruptedException exp)
{
System.out.println("Exception");
}
canal.noteOff(freq);
}
syn.close();
}
}
- DarkTacho's blog
- Inicie sesión o regístrese para enviar comentarios



Comentarios recientes
hace 1 hora 26 mins
hace 6 horas 24 mins
hace 7 horas 8 mins
hace 8 horas 7 mins
hace 8 horas 11 mins
hace 8 horas 54 mins
hace 9 horas 43 mins
hace 11 horas 1 min
hace 23 horas 27 mins
hace 1 día 2 horas