Skip to content

Instantly share code, notes, and snippets.

@Ameliawb
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ameliawb/cc225dd825d5ac00cdc6 to your computer and use it in GitHub Desktop.
Save Ameliawb/cc225dd825d5ac00cdc6 to your computer and use it in GitHub Desktop.
<!doctype html>
<html class="">
<head>
<script language="javascript" type="text/javascript" src="buzz.min.js"></script>
<script language="javascript" type="text/javascript" src="buzz.js"></script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Final Project Proposal Amelia Winger-Bearskin</title>
<link href="boilerplate.css" rel="stylesheet" type="text/css">
<link href="amelia1.css" rel="stylesheet" type="text/css">
<style type="text/css">
body {
background-image: url(background1.jpg);
background-repeat: repeat;
}
</style>
</script>
<script>
var sad = [];
var want = [];
var mySound = new buzz.sound("sadsong2.mp3");
var sosadfiles = new buzz.sound([
"/whysadsongs/boy.ogg",
"/whysadsongs/girl.ogg",
"/whysadsongs/cat.ogg",
"/whysadsongs/dog.ogg"
"/whysadsongs/job.ogg"
"/whysadsongs/money.ogg"
"/whysadsongs/life.ogg"
"/whysadsongs/neverlove.ogg"
"/whysadsongs/noreason.ogg"
"/whysadsongs/dontneedreason.ogg"
"/whysadsongs/bored.ogg"
"/whysadsongs/confused.ogg"
"/whysadsongs/hopeless.ogg"
]);
var wanttodofiles = new.buzz.sound ([
"/whysadsongs/cry.ogg",
"/whysadsongs/scream.ogg",
"/whysadsongs/letter.ogg",
"/whysadsongs/someonenew.ogg"
"/whysadsongs/forgetaboutyou.ogg"
"/whysadsongs/drink.ogg"
"/whysadsongs/leavetown.ogg"
"/whysadsongs/burn.ogg"
"/whysadsongs/giveup.ogg"
"/whysadsongs/lovesong.ogg"
"/whysadsongs/sleep.ogg"
"/whysadsongs/remember.ogg"
"/whysadsongs/moveon.ogg"
]);
function checkBox(elem) {
//console.log("Something: " + elem);
}
function doSubmit() {
// mySound = new buzz.sound("sadsong2.mp3");
var all = document.getElementsByClassName("why I am sad");
console.log(all)
var all2 = document.getElementsByClassName("I want to");
console.log(all2)
sad = [];
want = [];
sosadselectedfiles = [];
wanttoselectedfiles = [];
for (var i = 0; i < all.length; i++) {
if (all[i].checked) {
sad.push(all[i].id);
sosadselectedfiles.push(sosadfiles[i]);
}
if (all2[i].checked) {
want.push(all2[i].id);
wanttoselectedfiles.push(wanttodofiles[i]);
}
// if (all[i].checked) {sad.push(all[i].id);}
// if (all2[i].checked) {want.push(all2[i].id);}
}
write();
}
function write(){
var cause = sad.join(" "+"and ");
var todo = want.join(" "+"and ");
var im = "I'm so sad 'cause of ";
var d = '<p> and all I want to do is ';
document.write(im.fontsize(14)+cause.fontsize(18)+d.fontsize(14)+todo.fontsize(18));
var img = document.createElement('img');
img.src = "catgifpage59.gif";
document.body.appendChild(img);
document.body.background = "background.gif"
img.style.border='12px solid #FFFF99';
// mySoundArray.setTime( buzz.fromTimer("011:30") );
setup();
draw();
mySound.loop().play().fadeIn();
sosadselectedfiles.play().fadeIn();
wanttoselectedfiles.play().fadeIn();
//thesong.setTime( buzz.fromTimer("011:30") );
//thenextsong.setTime( buzz.fromTimer("015:30") );
}
</script>
</head>
<body>
<div class="gridContainer clearfix">
<div id="div1" class="fluid">
<h3>Why are you so sad?
</h3>
<div id="WhyAreYouSoSad?">
<input type="checkbox" id="a boy" class="why I am sad" onclick="checkBox(this)">
<label for="a boy">Boy</label>
<input type="checkbox" id="a girl" class="why I am sad" onclick="checkBox(this)">
<label for="a girl">Girl</label>
<input type="checkbox" id="a cat" class="why I am sad" onclick="checkBox(this)">
<label for="a cat">Cat</label>
<input type="checkbox" id="a dog" class="why I am sad" onclick="checkBox(this)">Dog
<label for="Checkbox4"></label>
<input type="checkbox" id="a stupid job" class="why I am sad" onclick="checkBox(this)">
<label for="Checkbox5">Job</label>
<input type="checkbox" id="stupid money" class="why I am sad" onclick="checkBox(this)">
<label for="Checkbox6">Money</label>
<input type="checkbox" id="Life" class="why I am sad" onclick="checkBox(this)">
<label for="Checkbox7">Life</label>
<input type="checkbox" id="I've never been in love" class="why I am sad" onclick="checkBox(this)">
<label for="Checkbox8">I've Never been in Love</label>
<input type="checkbox" id="no reason at all" class="why I am sad" onclick="checkBox(this)">
<label for="Checkbox10">No Reason</label>
<input type="checkbox" id="I don't even need a reason" class="why I am sad" onclick="checkBox(this)">
<label for="Checkbox11">Don't Need a reason</label>
<input type="checkbox" id="boredom" class="why I am sad" onclick="checkBox(this)">
<label for="Checkbox13">Bored</label>
<input type="checkbox" id="confusion" class="why I am sad" onclick="checkBox(this)">Confused
<label for="Checkbox14"></label>
<input type="checkbox" id="hopelessness" class="why I am sad" onclick="checkBox(this)">
<label for="Checkbox15">No Hope</label>
</p>
</div>
<p>&nbsp;</p>
</div>
<h3>What do you want to do about it?</h3>
<p>
</h3>
<div id="WantToDoAboutIt?">
<input type="checkbox"
id="cry" class="I want to" onclick="checkBox(this)">
<label for="Checkbox1">cry</label>
<input type="checkbox"
id="scream and shout and let it all out" class="I want to" onclick="checkBox(this)">
<label for="Checkbox2">scream and shout</label>
<input type="checkbox"
id="write a letter" class="I want to" onclick="checkBox(this)">
<label for="Checkbox3">write a letter</label>
<input type="checkbox"
id="find someone new" class="I want to" onclick="checkBox(this)">
<label for="Checkbox4">find someone new</label>
<input type="checkbox"
id="forget about you" class="I want to" onclick="checkBox(this)">
<label for="Checkbox5">forget about you</label>
<input type="checkbox"
id="drink" class="I want to" onclick="checkBox(this)">
<label for="Checkbox6">drink</label>
<input type="checkbox"
id="leave town" class="I want to" onclick="checkBox(this)">
<label for="Checkbox7">leave town</label>
<input type="checkbox"
id="burn all the pictures of you" class="I want to" onclick="checkBox(this)">
<label for="Checkbox8">burn all the pictures of you</label>
<input type="checkbox"
id="give up" class="I want to" onclick="checkBox(this)">
<label for="Checkbox10">give up</label>
<input type="checkbox"
id="write you a love song" class="I want to" onclick="checkBox(this)">
<label for="Checkbox11">write you a love song</label>
<input type="checkbox"
id="sleep all day" class="I want to" onclick="checkBox(this)">
<label for="Checkbox13">sleep all day</label>
<input type="checkbox"
id="keep you in my heart" class="I want to" onclick="checkBox(this)">
<label for="Checkbox14">remember you</label>
<input type="checkbox"
id="call your friend" class="I want to" onclick="checkBox(this)">
<label for="Checkbox15">move on</label>
</p>
</div>
</p>
<h3>
<div class="gridContainer clearfix">
<div id="div2" class="fluid">
<input name="submit" type="submit" id="submit" onclick="doSubmit()" value="Submit">
</div>
<script language="javascript" type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/p5.js/0.2.5/p5.min.js"></script>
<script language="javascript" type="text/javascript" src="p5.js"></script>
</body>
</html>
@Ameliawb
Copy link
Author

Ameliawb commented May 9, 2014

The P5.js is just an animation in the background and doesn't have anything to do with the sound array (just as a side note)

@Ameliawb
Copy link
Author

Ameliawb commented May 9, 2014

also here is a link to buzz.js

http://buzz.jaysalvat.com/documentation/sound/

@Ameliawb
Copy link
Author

Ameliawb commented May 9, 2014

here is a link to it currently online:
(the code isn't updated but so you get a sense of it)
http://www.inventioninbrooklyn.com/sadsongs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment