Java

Moderators: zibadian
Number of threads: 7836
Number of posts: 18235

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
tones Posted by Osella on 1 Sept 2003 at 3:42 AM
is there a Java class for basic musical commands like qbasic has?
Report
Re: tones Posted by Iceman24 on 1 Sept 2003 at 8:07 AM
: is there a Java class for basic musical commands like qbasic has?
:

http://innix.com/jfugue/

Iceman



Unix is user friendly. It's just very particular about who its friends are.

Report
Re: tones Posted by Osella on 2 Sept 2003 at 6:28 AM
thanks for the link Iceperson.
I need a little more help I'm afraid.
I've begun with the first programming example, and I'm trying to compile it from the command line as it says.:


1 error:
C:\>javac -classpath c:\jfugue MyMusicApp.java
MyMusicApp.java:9: cannot resolve symbol
symbol : method play ()
location: class org.jfugue.Pattern
pattern.play();
1 error

and then there's a circumflex-thingy pointing at the dot of .play (which I can't find on my keyb)

I believe my java is uptodate- I got the latest one from Sun a month or so ago....

And I'm assuming I've done the classpath thing right as I had even more errors before (eg if I tried to javac without the jfugue classpath)..

thanks for your patience

Osella



: is there a Java class for basic musical commands like qbasic has?
: :
:
: http://innix.com/jfugue/
:
: Iceman
:
:
:
: Unix is user friendly. It's just very particular about who its friends are.
:
:

Report
Re: tones Posted by strongheart on 2 Sept 2003 at 11:03 AM
For a quick solution, try using java.applet.AudioClip class.


// there is a folder named waves in the same folder that has the html
String path= "waves/tone.wav" ;
AudioClip clip;

// For an applet
clip= myapplet.getAudioClip(getDocumentBase(), path );

// For anything else - I think it even works with consol screen no gui
clip = Applet.newAudioClip(URL url) ;

the Applet.newAudioClip(URL url) is a static method in Applet. so you could use it without creating an applet instance.
The url might be
URL url =new File(path).toURL();
URL url= this.getClass().getResource (path);
where path is either the fully qualified pathname of the tone file(.wav .au and midi only) or relative to the classes classloader.

If you need more media types look at the JMF (Java Media Foundation) packages from sun (java.sun.com search JMF )

Look up Roedy Green's example of tone generation by byte manipulation.
http://mindprod.com/zips/java/sound12.zip
http://mindprod.com/zips/java/sound.txt // info
very nice, but may not be portable as-is (as it uses com.sun classes -I think)
but is extensible to JMF Player with some work.


~S~












: thanks for the link Iceperson.
: I need a little more help I'm afraid.
: I've begun with the first programming example, and I'm trying to compile it from the command line as it says.:
:
:
: 1 error:
: C:\>javac -classpath c:\jfugue MyMusicApp.java
: MyMusicApp.java:9: cannot resolve symbol
: symbol : method play ()
: location: class org.jfugue.Pattern
: pattern.play();
: 1 error
:
: and then there's a circumflex-thingy pointing at the dot of .play (which I can't find on my keyb)
:
: I believe my java is uptodate- I got the latest one from Sun a month or so ago....
:
: And I'm assuming I've done the classpath thing right as I had even more errors before (eg if I tried to javac without the jfugue classpath)..
:
: thanks for your patience
:
: Osella
:
:
:
: : is there a Java class for basic musical commands like qbasic has?
: : :
: :
: : http://innix.com/jfugue/
: :
: : Iceman
: :
: :
: :
: : Unix is user friendly. It's just very particular about who its friends are.
: :
: :
:
:




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.