473,666 Members | 2,333 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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



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
3 6984
> 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(AppletStar ter appletstarter) {
applet = appletstarter;
URL url = appletstarter.g etCodeBase();
int i = 1;
STone2 = new AudioClip[12];
for (int i_0_ = 0; i_0_ < 12; i_0_++) {
appletstarter.s etLabel("Loadin g audio clip " + i + " of 36 ...");
i++;
String string = "st-c2/st" + (i_0_ + 1) + ".au";
STone2[i_0_] = appletstarter.g etAudioClip(url , string);
if (STone2[i_0_] == null)
System.out.prin tln("Couldn't load audio clip " + url + string);
}
STone3 = new AudioClip[12];
for (int i_1_ = 0; i_1_ < 12; i_1_++) {
appletstarter.s etLabel("Loadin g audio clip " + i + " of 36 ...");
i++;
String string = "st-c3/st" + (i_1_ + 1) + ".au";
STone3[i_1_] = appletstarter.g etAudioClip(url , string);
if (STone3[i_1_] == null)
System.out
.println("Could n't create audio clip " + url + string);
}
STone6 = new AudioClip[12];
for (int i_2_ = 0; i_2_ < 12; i_2_++) {
appletstarter.s etLabel("Loadin g audio clip " + i + " of 36 ...");
i++;
String string = "st-c6/st" + (i_2_ + 1) + ".au";
STone6[i_2_] = appletstarter.g etAudioClip(url , string);
if (STone6[i_2_] == null)
System.out
.println("Could n't create audio clip " + url + string);
}
appletstarter.a ppletLoaded();
}
....
)

Scooby-Ced
Jul 17 '05 #2
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.go ogle.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(AppletStar ter appletstarter) {
applet = appletstarter;
URL url = appletstarter.g etCodeBase();
int i = 1;
STone2 = new AudioClip[12];
for (int i_0_ = 0; i_0_ < 12; i_0_++) {
appletstarter.s etLabel("Loadin g audio clip " + i + " of 36 ...");
i++;
String string = "st-c2/st" + (i_0_ + 1) + ".au";
STone2[i_0_] = appletstarter.g etAudioClip(url , string);
if (STone2[i_0_] == null)
System.out.prin tln("Couldn't load audio clip " + url + string);
}
STone3 = new AudioClip[12];
for (int i_1_ = 0; i_1_ < 12; i_1_++) {
appletstarter.s etLabel("Loadin g audio clip " + i + " of 36 ...");
i++;
String string = "st-c3/st" + (i_1_ + 1) + ".au";
STone3[i_1_] = appletstarter.g etAudioClip(url , string);
if (STone3[i_1_] == null)
System.out
.println("Could n't create audio clip " + url + string);
}
STone6 = new AudioClip[12];
for (int i_2_ = 0; i_2_ < 12; i_2_++) {
appletstarter.s etLabel("Loadin g audio clip " + i + " of 36 ...");
i++;
String string = "st-c6/st" + (i_2_ + 1) + ".au";
STone6[i_2_] = appletstarter.g etAudioClip(url , string);
if (STone6[i_2_] == null)
System.out
.println("Could n't create audio clip " + url + string);
}
appletstarter.a ppletLoaded();
}
...
)

Scooby-Ced

Jul 17 '05 #3
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.mi di).
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1911
by: Put 030516 in email subj to get thru | last post by:
I'm trying to learn about Java MIDI programming. Specifically, I'm interested in playing with Java MIDI sequencers (all puns intended). I'm looking at java.sun.com/j2se/1.4.2/docs/guide/sound/programmer_guide for most of my information. Is it possible to give the sequencer near future input notes to play *while* the sequencer is already playing a previous sequence. I'm thinking about sort of an interactive sequencer where the sequence...
0
9870
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ********************************** package Celcom.Client;
1
4277
by: nemokid | last post by:
hi all, i need to write an application that listen for DTMF tones from standard audio input (from the mic) and execute an action depending on the digit extracted from the DTMF tone. Unfortunaly i have short time to set up this application and i'm really new to this kind of problem (sound analisys). I take a look at JTAPI but i don't have any telephone in this context, i just have to analyze a normal sound signal from the sound card. I...
2
2274
by: beve | last post by:
Hi all, Here 's the trouble I've been dealing with for several days. I'm building a small game with JAVA and I would like to play sounds inside. Here's my code : try { testUrl = new URL("file:" + new File(".").getCanonicalPath() + "/" + filename);
2
12051
by: coderx | last post by:
I am attempting to build a piece of software which will replicate a guitar's notes. The major problem I have is sending the message to the midi output device which has the correct instrument and note to play. The midi people want like 50 bucks for a reference, and as this will be a personal use type application, I can't see spending the money on it. If anyone has a nice enumerated list of the ID's for the instruments and notes/chords,...
9
3492
by: outstretchedarm | last post by:
How exactly does HTML/Javascript handle playing midi files? Does it have a player imbedded in it? Or does it borrow from the computer's midi player? How could you make a webpage play certain chosen notes via midi? Is there an existing library for such a thing?
1
2284
by: glenn123 | last post by:
Hi, i am just about out of time to produce a working jukebox which has to perform these functions: to play music files when a track is chosen from a list which when the user presses the change genre button the list is populated with a list of that genre. I have got the interface done to satisfaction, my problem is that when i press the change genre button nothing happens and when i select a track to play from the list which is setvisible and...
5
1557
by: iLL | last post by:
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" import javax.sound.midi.*; public class sound { public static void main(String args) {
0
8352
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8863
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8780
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8549
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
4192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4358
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2765
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2005
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1763
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.