for my nerds.

Talk the talk.

Moderator: TGN

Post Reply
tape smoke
Funniest Member of the Year '09
Posts: 1877
Joined: Tue Jul 10, 2007 4:06 am

for my nerds.

Post by tape smoke »

hey I figured out how to make an awsome mouse over to trigger sounds, the possibilites could be endless for making website fake drum machines or whatever, I did this before but with sound manager, but that uses 6 trillion lines of code. this is simple, and I modified a code I found and made it cooler. you can test it here .

http://unsatisfiedpoets.net/experiments/Raindrop.htm

heres the code. easy as pie.

Code: Select all

<audio id="audio1" src="biz.wav" >
</audio>
<audio id="audio2" src="biz2.wav" >
</audio>
<audio id="audio3" src="biz3.wav" >
</audio>
<script>
function Soundx(soundobj) {
  var thissound=document.getElementById(soundobj);
  thissound.play();
}
</script>
<form>
<input type="button" value="Play Sound" onMouseover="Soundx('audio1')">
</form>

<a href="#" onMouseover="Soundx('audio1')"> sound </a><br>

<a href="#" onMouseover="Soundx('audio2')"> sound 2</a><br>

<a href="#" onMouseover="Soundx('audio3')"> sound 3</a><br>

I know I claimed to invent mouse over sound last year, but this does Not use the sound manager library. only HTML5 and a teency weency javascript.

sorry for nerding out .
Last edited by tape smoke on Tue Jan 31, 2012 7:54 am, edited 1 time in total.
I/O - EHT - Evangelist.
tape smoke
Funniest Member of the Year '09
Posts: 1877
Joined: Tue Jul 10, 2007 4:06 am

Re: for my nerds.

Post by tape smoke »

oh and I forgot, if you want it to play on a click just change onmouseover to onmouseclick, you can even set it up to hover and then click , by creating another player and a new class in your <a> tag. :D
I/O - EHT - Evangelist.
User avatar
MDX
Member
Posts: 154
Joined: Sat Apr 16, 2011 7:05 pm
Location: Naptown
Contact:

Re: for my nerds.

Post by MDX »

wysiwyg accomplishes this but its cool you wrote it out :D
tape smoke
Funniest Member of the Year '09
Posts: 1877
Joined: Tue Jul 10, 2007 4:06 am

Re: for my nerds.

Post by tape smoke »

wysiwyg is killing me, something to do with unsanitized strings, and escaping them, which is beyond my level right now, so I hand code everything. Its funner and I like to validate everything. But sometimes, I sacrifice validity for easiness. ie using flash, blec
I/O - EHT - Evangelist.
User avatar
MDX
Member
Posts: 154
Joined: Sat Apr 16, 2011 7:05 pm
Location: Naptown
Contact:

Re: for my nerds.

Post by MDX »

what other languages are you working with? im in my last semester for computer programming. so far id say c++ and java are my tops but as far as .NET id choose c# over visual basic. Do you write in other scripting languages? I dont blame you for doing it by hand, its usually tidier that way.
tape smoke
Funniest Member of the Year '09
Posts: 1877
Joined: Tue Jul 10, 2007 4:06 am

Re: for my nerds.

Post by tape smoke »

cool man im jelous you are working with real programming languages.

I only know what web development (html, css ) and a little bit of javascript and php. heres my design blog. http://crunkfu.cssdesign.info

I am going to attempt to make a sp 202 with this skeleton and some html5 audio attributes like loop and pause.
I/O - EHT - Evangelist.
User avatar
MDX
Member
Posts: 154
Joined: Sat Apr 16, 2011 7:05 pm
Location: Naptown
Contact:

Re: for my nerds.

Post by MDX »

really cool stuff. i can def. appreciate the work.
did you teach yourself the scripting?
ruby and python are really good languages as well for this kind of thing
tape smoke
Funniest Member of the Year '09
Posts: 1877
Joined: Tue Jul 10, 2007 4:06 am

Re: for my nerds.

Post by tape smoke »

yeah, mostly self taught, got a little head start from being a computer tech in my early 20's and running into "hackers" here and there, I would always make them teach me everything they knew. which i would forget right away but yeah. haha, as for ruby and python, i am pretty much terrified of and have been putting off learning for the last year. but the time will come when I put on my big girl panties and learn some real shit.
I/O - EHT - Evangelist.
User avatar
MDX
Member
Posts: 154
Joined: Sat Apr 16, 2011 7:05 pm
Location: Naptown
Contact:

Re: for my nerds.

Post by MDX »

haha its really a matter of what works best for you imo
my favorite to toy around with is bash scripting
i use mostly linux so i try to write a bash script to do all my startup tasks ie: upgrade, update, clean, remove etc.
its an easy task but fun to automate things i guess.
good to see another geekster in the forums :mrgreen:
tape smoke
Funniest Member of the Year '09
Posts: 1877
Joined: Tue Jul 10, 2007 4:06 am

Re: for my nerds.

Post by tape smoke »

for the non nerds. :lol:
Attachments
SP202_IMG.jpg
SP202_IMG.jpg (225.57 KiB) Viewed 3921 times
I/O - EHT - Evangelist.
User avatar
MDX
Member
Posts: 154
Joined: Sat Apr 16, 2011 7:05 pm
Location: Naptown
Contact:

Re: for my nerds.

Post by MDX »

awesomeness
User avatar
sleepy eyes
Member
Posts: 321
Joined: Thu May 12, 2011 4:14 am
Location: southern ca
Contact:

Re: for my nerds.

Post by sleepy eyes »

haha that pictures so badass
User avatar
ellaguru
Member
Posts: 7753
Joined: Sun Jan 04, 2009 9:43 pm
Location: France-Italy

Re: for my nerds.

Post by ellaguru »

how does the code works!?!?!
i stay still with Basic language, school me please
User avatar
boombapp28
Member
Posts: 429
Joined: Thu Jun 10, 2010 8:38 pm
Location: Rdg, PA

Re: for my nerds.

Post by boombapp28 »

Very dope SP-202 graphic. I am definitely jacking that. Props to whoever created it.
Disciple of the Boom Bap.
Anti-Swag: Substance over Style.
tape smoke
Funniest Member of the Year '09
Posts: 1877
Joined: Tue Jul 10, 2007 4:06 am

Re: for my nerds.

Post by tape smoke »

the code works like this,

here is a html5 audio player.

<audio controls="controls">
<source src="song.ogg" type="audio/ogg" />
<source src="song.mp3" type="audio/mpeg" />
</audio>


I removed the controls="controls" attribute. all this does is hide the audio player.

so the invisible player code now looks like this.

<audio id="audio1" src="biz.wav" >
</audio>


notice the audio ID . this is important to know what player to trigger.

ok.

function Soundx(soundobj) {
var thissound=document.getElementById(soundobj);
thissound.play();
}


The javascript function will let the player be triggered by any DOM event.
( hover, click, mouse move, many others )

and then this just engages the script.

<a href="#" onMouseover="Soundx('audio1')"> sound </a>

this will work for a div, or any other DOM element or form. (button or whatever)

so actually the first code should have looked like this to keep it simple.
but i wanted to show multiple instances .


<audio id="audio1" src="sound.wav" >
</audio>
<script>
function Soundx(soundobj) {
var thissound=document.getElementById(soundobj);
thissound.play();
}
</script>
<a href="#" onMouseover="Soundx('audio1')"> sound </a>
I/O - EHT - Evangelist.
Post Reply