Questions tagged [javax.sound.midi]

Provides interfaces and classes for I/O, sequencing, and synthesis of MIDI (Musical Instrument Digital Interface) data.

The javax.sound.midi API provides interfaces and classes for I/O, sequencing, and synthesis of MIDI (Musical Instrument Digital Interface) data.

For further details, see:

85 questions
6
votes
1 answer

Virtual synthesizer in Android (based on jar) - native jni?

I am trying to load & use virtual (soft) synthesizer of java in Android. I read Gervill jar is to be used for this. Other building block is javax-sound present in my project as an aar file (as is it not present in trimmed Java package of…
5
votes
2 answers

Newer version of JRE doesn't load soundbank but older version does

I have the following code that tries to load a soundbank. I've tested the code on Windows 7 with JRE 1.6.03 and 1.6.43. The old version of the JRE (1.6.03) works fine but the new version throws an exception. What's going on? public Main() { try…
gsgx
  • 12,020
  • 25
  • 98
  • 149
4
votes
2 answers

MidiSystem.getMidiDevice(...) returns unexpected class

I'm trying to write a simple program using javax.sound.midi that reads, edits, and then plays midi files through FluidSynth. Here is a snippet of my code: Synthesizer synth; // Look through the available midi devices for a software synthesizer …
kroppian
  • 127
  • 1
  • 6
4
votes
1 answer

Opening MIDI Synth before creating JFrame causes JVM to hang

While writing a program to MIDI with a Swing interface, I experienced a hang, such that kill -9 is required. It is 100% reproducible by running the following program as java MidiSwingProblem hang0 import…
200_success
  • 7,286
  • 1
  • 43
  • 74
4
votes
1 answer

How to get midi file type (0/1/2) in java?

I am parsing a MIDI file using: Sequence sequence = MidiSystem.getSequence(paFile); How do I distinguish the SMF file type? I have not found any method returning it. Is it safe to assume, that sequence with only one track is type 0 and with…
Leprechaun
  • 852
  • 6
  • 25
3
votes
1 answer

Can't change instrument in Java MIDI program, InvalidMidiDataException:channel out of range

I can't change instrument with javax.sound.midi.ShortMessage.setMessage() method. Channel 0-15 is piano, excluding 9 which is for drum. But 8-15 should be Chromatic Percussion. When i set channel to 16 or more (range is from 0 to 127), i get…
3
votes
1 answer

Receive midi input with javax.sound.midi

I would like to have a program that could do something when it gets a midi input. For instance when I click button 1 on my controller it should print "You clicked btn 1" and when I click button 2 it should print "You clicked btn 2". I tried using…
Gustav
  • 93
  • 9
3
votes
1 answer

How to implement a Midi Synthesizer in Java

Hy i want to implement a Midi Synthesizer in Java. (Synthesizer = new Device that represents one or Multiple Instruments) What i implemented is a javax.sound.midi.Receiver: package at.bachmann.se.midi.smc; import…
maxbit89
  • 748
  • 1
  • 11
  • 31
3
votes
1 answer

MIDI instruments sound different when exported to .jar file

I have made a java program that synthesises sounds using the MIDI package in the java sound API, however, when I export it to a .jar file, the sound played is quite different to what it is when I run it in eclipse. Does anyone know why it is doing…
xulo
  • 440
  • 3
  • 9
3
votes
3 answers

How to close a midi device?

How do i close a midi device in java? I have tried re-initialising the MidiHandler object, but the device stays open until the program terminates. Also, if i unplug my midi controller while the program is running, it wont send notes after it is…
user3194972
  • 145
  • 1
  • 6
3
votes
1 answer

Java set MIDI Out receiver

Hey I am trying to send MIDI data from a Java class to a MIDI device connected via USB. I did this once like 2 years ago and it worked, but I somehow can't find the project anymore. The example Java code runs fine; myMsg = new ShortMessage(); …
user2875404
  • 3,048
  • 3
  • 25
  • 47
3
votes
2 answers

Midi file to midi event

import javax.sound.midi.*; import javax.swing.*; import java.awt.*; /** * Created by Jonik on 09.01.2015. */ public class MiniMusicPlayer1 { static JFrame f = new JFrame("My first video clip"); static MyDrawPanel ml; int t = 2; …
Jonik
  • 141
  • 3
  • 14
2
votes
0 answers

How to reduce thread's start() method execution time in java

I was trying to implement a real time executing application in which a thread is the initiator, which will call java midi to play some music (i.e. execution statements implemented in the overriden run() method of Runnable interface). But thread…
2
votes
1 answer

JFugue parser exception in the value of duration, in the case of 'notes sharing same duration'

I'm working with JFugue , when i tried to execute the code Player myPlayer = new Player(); myPlayer.play( ":DEFAULT(duration=.25)"); Pattern test=new Pattern(" m327.0 m348.8 ( m392.4/0.25 m413.393 m392.4 )/0.5 m348.8…
2
votes
2 answers

Java result 1 error

I wanted to create a midi file which consist of these notes. I took this code from internet. If i can find out the problem to this i can go further. When i run this application i only get an error call "java result 1" error. What i need is after i…
user3805160
  • 87
  • 2
  • 11
1
2 3 4 5 6