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 semana 3 días
hace 1 semana 3 días
hace 1 semana 3 días
hace 25 semanas 6 días
hace 27 semanas 1 día
hace 33 semanas 6 días
hace 1 año 26 semanas
hace 2 años 38 semanas
hace 2 años 42 semanas
hace 2 años 49 semanas