473,325 Members | 2,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

midi synth works with jdk but not jre

63
Can someone tell me why this code works with "Java\jdk1.6.0_07\bin\java.exe" but does not work with "Java\jre1.6.0_07\bin\java.exe"

Expand|Select|Wrap|Line Numbers
  1. import javax.sound.midi.*;
  2.  
  3.  
  4. public class sound
  5. {
  6.     public static void main(String[] args)
  7.     {
  8.         try
  9.         {
  10.             Synthesizer synthesizer = MidiSystem.getSynthesizer();
  11.             synthesizer.open();
  12.  
  13.             synthesizer.getChannels()[0].noteOn(60, 63);
  14.             Thread.currentThread().sleep(1000);
  15.             synthesizer.getChannels()[0].noteOff(60);
  16.         }
  17.         catch(MidiUnavailableException e)
  18.         {
  19.             System.out.println("Midi Unavailable");
  20.             System.exit(1);
  21.         }
  22.         catch(Exception ex)
  23.         {
  24.             System.out.println("Exception");
  25.         }
  26.     }
  27. }
  28.  
No exceptions are thrown with the jdk or jre, but the jre does not produce the sound.



My plan is to get a synthesizer working as a applet without needing everyone who uses it to download library files. Is there anyway I can do that?
Aug 26 '08 #1
5 1547
JosAH
11,448 Expert 8TB
Do you have a 'soundbank.gm' file available in your lib/audio directory?

kind regards,

Jos
Aug 26 '08 #2
iLL
63
I'm trying to use the default soundbank. Is that only available through the JDK?

Edit: Ignore that. Let me check.
Aug 26 '08 #3
iLL
63
No I don't have it in there.

Should it be there on install? Can I assume that other people will have it?

If not, is it legal to upload it to a server and use that as my soundbank, or is that copyright infringement?
Aug 26 '08 #4
JosAH
11,448 Expert 8TB
No I don't have it in there.

Should it be there on install? Can I assume that other people will have it?

If not, is it legal to upload it to a server and use that as my soundbank, or is that copyright infringement?
You need it to be stored there; I don't remember whether or not I put it there
myself or if it were there already. Don't worry about any copyrights: if you have
such a file already you're free to store it whereever you want.

Read Sun's audio tutorial; they mention that file and explain the gory details.

kind regards,

Jos
Aug 26 '08 #5
iLL
63
Thanks for your help
Aug 26 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Ben | last post by:
Hi, I need to extract the outgoing pcm audio data while playing midi. With the getData() method of a SoundbankResource object, I can only catch sampled audio data stored in a soundbank. Is...
0
by: Max M | last post by:
If anybody is interrested in Midi, but are not on the Python Midi list, I will just notify that I have released the first version of a high level midi package for Python. It is fully functional....
0
by: sleeds | last post by:
Does anyone know how I can raise or lower the volume via code for the MIDI SYNTH Volume in VB.net?
2
by: Mad Scientist Jr | last post by:
any sample code or information would be most appreciated i have been wanting to learn MIDI programming but would rather learn it in my current language (either vb.net or c#)
11
by: Kuba Araszkiewicz | last post by:
Hello! I have to write a program, which would convert midi files to notes, notes to midi files and which would make one MIDI file from two different. I'm totally lame in C (and any other...
0
by: tom | last post by:
Hallo, I need help on MIDI file, and precisely about retrieving few note values (mainly the "Velocity" value, corrisponding to the intensity of a played note) while the MIDI is playing.
1
by: tim | last post by:
Someone using Python Midi Package from http://www.mxm.dk/products/public/ lately? I want to do the following : write some note events in a midi file then after doing that, put some controllers...
1
by: Will Hurt | last post by:
hiya, can you tell me of a python module available for linux which allows me to access midi i/o data. ie i want to get hold of raw midi input coming in from an external controller. ive managed...
0
by: Sonicfreak17 | last post by:
OK... ive been EVERYWHERE online to find a way to do this: i want to be able to make .wav files with midi data- not so much premade midi files- but just sending on the fly midi notes and recording...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.