tones - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

tones

OsellaOsella Posts: 13Member
is there a Java class for basic musical commands like qbasic has?

Comments

  • Iceman24Iceman24 Posts: 119Member
    : 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.

  • OsellaOsella Posts: 13Member
    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.
    :
    :

  • strongheartstrongheart Posts: 44Member
    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.
    : :
    : :
    :
    :

Sign In or Register to comment.