Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (494)
Games in Android Showcase (113)
games submitted by our members
Games in WIP (563)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  MIDI instruments  (Read 1908 times)
0 Members and 1 Guest are viewing this topic.
Offline CaptainJester

JGO Knight


Medals: 12
Projects: 2
Exp: 14 years


Make it work; make it better.


« Posted 2005-03-22 13:19:47 »

Anyone know how to select/load different instruments into Java's MIDI API.  MidiSystem.getSynthesizer().getAvailableInstruments() returns nothing.  I have tried other ways, including trying to load a Soundbank file.  Nothing has worked.  The API exists to do this, but is it just not implemented?

The default sound is piano and I want to try other instruments, especially guitar.

Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #1 - Posted 2005-03-22 17:30:47 »

It seems that what you want to change is not the synthesizer but the patch, or more specifically, do a 'program change'.
Probably something like:

1  
2  
3  
ShortMessage msg = new ShortMessage();
msg.setMessage(ShortMessage.ROGRAM_CHANGE, 1, 2);
MidiSystem.getReceiver().send(msg, -1);


This will set program 2 on midi channel 1.
Or have a look at MidiChannel.programChange(int bank, int program) or MidiChannel.programChange(int program).
Mind you, I've never used MIDI using JavaSound and I didn't actually test this but maybe this will point you in the right direction  Tongue

Offline CaptainJester

JGO Knight


Medals: 12
Projects: 2
Exp: 14 years


Make it work; make it better.


« Reply #2 - Posted 2005-03-23 00:10:20 »

Thanks.  I 'll give it a try.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline CaptainJester

JGO Knight


Medals: 12
Projects: 2
Exp: 14 years


Make it work; make it better.


« Reply #3 - Posted 2005-03-29 12:06:50 »

At first, I coulnd't figure out how to use the PROGRAM_CHANGE, but I found a table of what the values mean on the Internet, so now I have it.

Thanks erikd.

Offline 20thCenturyBoy

Senior Member


Medals: 3


So much to learn, so little time.


« Reply #4 - Posted 2005-05-22 10:36:25 »

Quote
Anyone know how to select/load different instruments into Java's MIDI API.  MidiSystem.getSynthesizer().getAvailableInstruments() returns nothing.  I have tried other ways, including trying to load a Soundbank file.  Nothing has worked.  The API exists to do this, but is it just not implemented?

The default sound is piano and I want to try other instruments, especially guitar.

You need to open the synth first before calling getAvailableInstruments and loading soundbanks.




"I have never done unit testing and I don’t find it a very useful concept" - Jonathan Blow
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Dwinin (16 views)
2014-09-12 09:08:26

Norakomi (50 views)
2014-09-10 13:57:51

TehJavaDev (58 views)
2014-09-10 06:39:09

Tekkerue (27 views)
2014-09-09 02:24:56

mitcheeb (50 views)
2014-09-08 06:06:29

BurntPizza (34 views)
2014-09-07 01:13:42

Longarmx (20 views)
2014-09-07 01:12:14

Longarmx (23 views)
2014-09-07 01:11:22

Longarmx (22 views)
2014-09-07 01:10:19

mitcheeb (31 views)
2014-09-04 23:08:59
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!