By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,292 Members | 1,354 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,292 IT Pros & Developers. It's quick & easy.

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

P: n/a


The applet for endlessly rising/falling scale
(auditory illusion)
on this page is fantastic!

http://www.cs.ubc.ca/nest/imager/con...ons/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/


__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
> The applet for endlessly rising/falling scale
(auditory illusion)
on this page is fantastic!

http://www.cs.ubc.ca/nest/imager/con...ons/ST/st.html
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
Jul 17 '05 #2

P: n/a
A link to the source code is provided:

http://www.cs.ubc.ca/nest/imager/con...ts/source.html

-Nathan

sn*****@hotmail.com (Cedric) wrote in message news:<76**************************@posting.google. com>...
The applet for endlessly rising/falling scale
(auditory illusion)
on this page is fantastic!

http://www.cs.ubc.ca/nest/imager/con...ons/ST/st.html
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

Jul 17 '05 #3

P: n/a
Ben
"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

Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.