Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9149611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:30:02+00:00 2026-06-17T11:30:02+00:00

I am making a simple application to playback MIDI files in Java. I am

  • 0

I am making a simple application to playback MIDI files in Java.
I am using the javax.sound.midi library.

I can retrieve my MIDI Out Device correctly (USB to MIDI Cable).

But when I playback the sequence it always plays in the default sound synthesizer which is the host OS’s General Midi (Soundfont) playback.

The problem I am having is changing the default MIDI Out.

When I execute

Receiver MidiOutReceiver; //instantiated earlier
Sequencer MidiOutSequencer = MidiSystem.getSequencer();
MidiOutSequencer.open();
MidiOutSequencer.start();

I hear the MIDI sequence reproduction out of the speakers.

After referring to the documentation


3.10.
The “Java Sound Sequencer” is implicitly connected to the default Synthesizer,
3.5.
In your program you can obtain a Synthesizer instance yourself and connect
it to a sequencer explicitly using a Transmitter / Receiver pair.
So you know which Synthesizer is used.
In case you obtained a Sequencer that is pre-connected to a Synthesizer,
you can find out the Synthesizer by using the method getTransmitters().

But there is not mention of how to explicitly use this Transmitter / Receiver pair and instantiate the Sequencer object with the new Default Synthesizer.

I have the correct Transmitter and Receiver.
But they are not playing out of the MIDI out.

Also when I try

MidiSystem.getTransmitter().setReceiver(MidiOutReceiver);

It does not seem to change anything.

How do I explicitly use this Receiver / Transmitter Pair with a Synthesizer so that the Default Sequencer will use my MIDI out port?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T11:30:03+00:00Added an answer on June 17, 2026 at 11:30 am

    I overlooked something simple. The default Sequencer returned by MidiSystem.getSequencer(); has a Transmitter which in turn has a setReceiver() method to add a MIDI Out device. But you must have the correct MIDI Out device. I had chosen a wrong device by accident.

    So first the correct output device is chosen by looking through the DeviceInfos array, picking the correct device, then instatiating the the Sequencer with the correct Receiver.

    MidiDevice.Info[] MidiDeviceInfos = MidiSystem.getMidiDeviceInfo();
    //find the suitable device number here, based on some criteria
    MidiDevice MidiOutDevice = MidiSystem.getMidiDevice(MidiDeviceInfos[DEVICE_NUMBER]);
    Receiver MidiOutReceiver = MidiOutDevice.getReceiver();
    Sequencer MidiOutSequencer = MidiSystem.getSequencer();
    //Add the new MIDI out device here.
    MidiOutSequencer.getTransmitter().setReceiver(MidiOutReceiver);
    MidiOutSequencer.open();
    

    Now you can open() a file and play() it, but since the default MIDI Out device is also used you may hear General MIDI/Soundfont MIDI sounds too. This threw me off at first but now the MIDI device will also be sending the opened sequence out of your added Receiver.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I'm making a fairly simple web application using JAVA EE specs (I've
I am making a simple Twitter update application using MGTwitterEngine And I can't seem
Making a simple application, so when the user logs out of Windows, it of
I am making a simple application that uses a NSSlider, which can be put
I'm making a simple game using the Windows Phone Silverlight and XNA Application type
I am making a simple application which requires colored output. How can I make
I'm making a simple Kakuro application in Java Swing and I have used JButton
I am making a simple chat application and I am trying to find out
I am making a simple rack application that grant access to secured files after
I'm making a simple mobile radio application using Adobe Flash CS6 and ActionScript 3.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.