Jump to content
IGNORED

Need help to have Atari 2600 JavaScript mouseover sounds


Random Terrain

Recommended Posts

Don't know what forum to put this in. It's about Atari 2600 sounds, but it's also about JavaScript programming.

 

I need to find a way to have mouseover sounds for the keyboard images you see here:

 

http://www.randomterrain.com/atari-2600-memories-batari-basic-music-sound.html#keyboardsonly

 

The mouseover effect would only be for the keys that have numbers on them (and only numbers that are not colored red). If nobody has Atari 2600 sound files that I can use, I'll need to make my own WAV files (if that's the best type of file to use). I know very little about JavaScript, so I either need an easy-to-use, easy-to-adapt kit of some kind or the help of a JavaScript master who can slap something together without breaking a sweat.

 

I thought I could use the following kit, but the mouseover sound demos don't work:

 

JavaScript Sound Kit #053100 - 36K

 

Even if I could get the demos to work, I don't know how to have JavaScript sounds play over certain areas of an image.

 

 

Thanks.

Link to comment
Share on other sites

Don't know if this will be any use, but since you haven't got any other replies this might get you started....

 

Playing sounds in a web browser without flash is a bit hit and miss, here is a very simple example which works ok in IE....

 

<bgsound src="silence.wav" name="sound" loop="1" />

<button style="margin:20px;padding:30px" onclick="sound.src='aud/2sexy.wav';">2Sexy</button>

<button style="margin:20px;padding:30px" onclick="sound.src='aud/heart.wav'">Heart</button>

<button style="margin:20px;padding:30px" onclick="sound.src='aud/hidarlin.wav'">Darlin'</button>

 

The "silent.wav" silent audiofile in the first line is needed to allow the sounds to play more than once due to some strange bug in IE...

 

To get the sounds to play when you click or move over certain parts of the image, the easiest method will almost certainly be to use a HTML "image map" - you should be able to find more info on google - but this tutorial should have everything you need: http://www.javascriptkit.com/howto/imagemap.shtml

 

Anyway hope that helps....

Edited by eshu
Link to comment
Share on other sites

:) if I get a chance later I'll try to knockup an imagemap that plays sounds...I wasn't quite clear if you wanted the user to click to play the sound or just move the mouse over?

I figured it might be easier for people to just mouseover the keys instead of needing to click on each one. All of that clicking might get irritating.

 

Thanks.

Link to comment
Share on other sites

<HTML>
<HEAD>
	<TITLE>Sound over area test</TITLE>
	<script>

		var old_n=0;

		function getObj(name)
		{
		  if (document.getElementById)
		  {
		  	this.obj = document.getElementById(name);
			this.style = document.getElementById(name).style;
		  }
		  else if (document.all)
		  {
			this.obj = document.all[name];
			this.style = document.all[name].style;
		  }
		  else if (document.layers)
		  {
			   if (document.layers[name])
			   {
			   	this.obj = document.layers[name];
			   	this.style = document.layers[name];
			   }

		  }
		}
		function playsound(n)
		{
			if (old_n!=0)
				{
					var y=new getObj("snd_" + old_n);
					y.obj.Stop();
				}	
			old_n=n;
			var x=new getObj("snd_" + n);
			x.obj.Rewind();
			x.obj.Play();
		}
	</SCRIPT>
</HEAD>
<BODY>
	<IMG SRC="http://www.randomterrain.com/bbfiles/randomterrain-keyboard-t04-988.png" USEMAP="#soundmap" border="0">
	<MAP name="soundmap">
		<AREA shape="rect" coords="0,0,32,128" href="#" onmouseover="playsound(1)"/>
		<AREA shape="rect" coords="32,0,64,128" href="#" onmouseover="playsound(2)"/>
	</MAP>
	<div style="position:absolute; top:-100">
		<EMBED id="snd_1" src="http://simplythebest.net/sounds/WAV/sound_effects_WAV/sound_effect_WAV_files/cow.wav" MASTERSOUND loop=false autostart="false" width="0" height="0"/>
		<EMBED id="snd_2" src="http://simplythebest.net/sounds/WAV/sound_effects_WAV/sound_effect_WAV_files/bird_1.wav" MASTERSOUND loop=false autostart="false" width="0" height="0"/>
	</div>
</BODY>
</HTML>

 

That is a simple demo that should work on IE, with two sounds being triggered by moving over the first two white keys (the co-ordinates aren't perfect).....

Edited by eshu
Link to comment
Share on other sites

Thanks. I found out that two programs I use (Paint Shop Pro X and Namo WebEditor) will make image maps. I'll have to play with both to see which one is easier.

 

I was looking for something that would work with more browsers and I finally found these:

 

http://webdesign.about.com/od/sound/a/play_sound_oncl.htm

 

http://scripterlative.com/files/playmedia.htm

 

 

Maybe I can mix one of those with what you posted.

 

 

 

Thanks.

Link to comment
Share on other sites

They basically use the same method, but I didn't get my cases right....

 

If you change:

y.obj.stop(); -> y.obj.Stop();

x.obj.rewind(); -> x.obj.Rewind();

x.obj.play(); -> x.obj.Play();

 

The example I posted earlier will work as well across browsers as the code in those articles you posted, I think it will need the quicktime plugin for firefox to work though....

Link to comment
Share on other sites

The example I posted earlier will work as well across browsers as the code in those articles you posted, I think it will need the quicktime plugin for firefox to work though....

Yeah, I must be missing a plugin or something. I wonder why the examples I posted links to work with my Firefox setup?

 

 

Thanks.

Link to comment
Share on other sites

The example I posted earlier will work as well across browsers as the code in those articles you posted, I think it will need the quicktime plugin for firefox to work though....

Yeah, I must be missing a plugin or something. I wonder why the examples I posted links to work with my Firefox setup?

 

 

Thanks.

 

I've edited the original post to the correct case, can you copy and paste the whole thing into a new file and try it again...I'm pretty sure it should work, but if that doesn't I'll have another look...

Link to comment
Share on other sites

I've edited the original post to the correct case, can you copy and paste the whole thing into a new file and try it again...I'm pretty sure it should work, but if that doesn't I'll have another look...

I must have screwed something up with my little copy and paste jobs. After copying and pasting the whole updated code, it's working with Firefox now. :thumbsup:

 

 

Thanks.

Link to comment
Share on other sites

Since this is going to work out great, I've been wondering if it's possible to add another ability. A mouseover would play a sound, but clicking would output text to the screen. For example, if you click on one note, something like the following would appear on the screen:

 

  8,4,6
  0,0,0
  16

 

 

Click on another note and you'd see something like this:

 

  8,4,6
  0,0,0
  16
  8,4,17
  0,0,0
  16

 

 

It would keep building to the list every time you clicked on a note, then you could copy the code and paste it into a batari Basic program.

Link to comment
Share on other sites

After spending many hours Googling, I finally found something that seems to do what I want:

 

http://javascript.internet.com/snippets/dom-append-text-and-element-functions.html

 

After some adjustments, I should be able to have the Atari 2600 sounds play and have code shown on the screen when you click. Don't know if anyone else will find this helpful when I'm finished, but it sure will help me.

Link to comment
Share on other sites

I couldn't get the code to display multiple lines, so after a lot of searching, I gave up and asked for help at codingforums.com:

 

http://www.codingforums.com/showthread.php?t=180877

 

 

The problem is solved and now I can get to work recording Atari 2600 sounds once I figure out how I'm going to hook up the sound from my Atari 2600 to my computer. I'll probably use an old VCR.

Link to comment
Share on other sites

I couldn't get the code to display multiple lines, so after a lot of searching, I gave up and asked for help at codingforums.com:

 

http://www.codingforums.com/showthread.php?t=180877

 

 

The problem is solved and now I can get to work recording Atari 2600 sounds once I figure out how I'm going to hook up the sound from my Atari 2600 to my computer. I'll probably use an old VCR.

I would sample the audio through tonetoy using stella by way of an ouside program that has stella audio routed through it. All selfcontained in the computer. unless stella's sounds aren't quite right.

Link to comment
Share on other sites

I would sample the audio through tonetoy using stella by way of an ouside program that has stella audio routed through it. All selfcontained in the computer. unless stella's sounds aren't quite right.

The votes are in favor of using Stella so far:

 

http://www.atariage.com/forums/topic/152860-stella-sound-or-real-atari-2600-sound-with-bacon/

 

I'm going to try one more thing with the real Atari 2600 set-up to see if I can get rid of the frying bacon noise. I'd love to use a real Atari 2600 with Tone Toy 2008 on my Krok cart if I can eliminate the noise. Tone Toy 2008 with Stella doesn't sound quite right on my computer. It would supposedly sound much better if I had a Sound Blaster card.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...