Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2003

Tip: Looking for answers? Try searching our database.

Playing (MIDI) sounds from Java applet  (Shepard's Tones)

Thread view: 
SOB-like MIDIs - 17 Oct 2003 01:35 GMT
The applet for endlessly rising/falling scale
(auditory illusion)
on this page is fantastic!

http://www.cs.ubc.ca/nest/imager/contributions/flinn/Illusions/ST/st.html

How is this done?
(I'm assuming it uses MIDI.)

Is this sound applet playable from any
java-enabled browser on any Windows system?

How about on Mac or Unix?

I'm asking because I want to write
Java programs that plays simple
2-part inventions by Bach.

Thanks.

http://geocities.com/SOBlikeMIDIs/
Cedric - 17 Oct 2003 11:23 GMT
> The applet for endlessly rising/falling scale
> (auditory illusion)
[quoted text clipped - 4 lines]
> How is this done?
> (I'm assuming it uses MIDI.)

Sorry, but it uses .AU files ( download and use Jode, then you got:

...
   public void init(AppletStarter appletstarter) {
    applet = appletstarter;
    URL url = appletstarter.getCodeBase();
    int i = 1;
    STone2 = new AudioClip[12];
    for (int i_0_ = 0; i_0_ < 12; i_0_++) {
       appletstarter.setLabel("Loading audio clip " + i + " of 36 ...");
       i++;
       String string = "st-c2/st" + (i_0_ + 1) + ".au";
       STone2[i_0_] = appletstarter.getAudioClip(url, string);
       if (STone2[i_0_] == null)
        System.out.println("Couldn't load audio clip " + url + string);
    }
    STone3 = new AudioClip[12];
    for (int i_1_ = 0; i_1_ < 12; i_1_++) {
       appletstarter.setLabel("Loading audio clip " + i + " of 36 ...");
       i++;
       String string = "st-c3/st" + (i_1_ + 1) + ".au";
       STone3[i_1_] = appletstarter.getAudioClip(url, string);
       if (STone3[i_1_] == null)
        System.out
           .println("Couldn't create audio clip " + url + string);
    }
    STone6 = new AudioClip[12];
    for (int i_2_ = 0; i_2_ < 12; i_2_++) {
       appletstarter.setLabel("Loading audio clip " + i + " of 36 ...");
       i++;
       String string = "st-c6/st" + (i_2_ + 1) + ".au";
       STone6[i_2_] = appletstarter.getAudioClip(url, string);
       if (STone6[i_2_] == null)
        System.out
           .println("Couldn't create audio clip " + url + string);
    }
    appletstarter.appletLoaded();
   }
...
)

Scooby-Ced
Nathan Zumwalt - 17 Oct 2003 16:52 GMT
A link to the source code is provided:

http://www.cs.ubc.ca/nest/imager/contributions/flinn/Illusions/Applets/source.html

-Nathan

> > The applet for endlessly rising/falling scale
> > (auditory illusion)
[quoted text clipped - 47 lines]
>
> Scooby-Ced
Ben - 22 Oct 2003 21:36 GMT
"SOB-like MIDIs" wrote :

> How is this done?
> (I'm assuming it uses MIDI.)

No. Java only supports MIDI in its 1.4 version (javax.sound.midi).
This applet runs regular short au clips. Another method to do
audio with earlier versions of java is to use the sun.audio classes.
They're not standard java, but (before 1.4) it was the only way to
perform low-level sound synthesis in java.

An example with source code :
http://www.neuralsemantics.com/applets/jazz.html
(also take a look at the online e-guitar !)

> Is this sound applet playable from any
> java-enabled browser on any Windows system?

supposed to be, yes (provided there is a sound card !)

> How about on Mac or Unix?

same

Ben


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.