Skip to content
cesine edited this page Apr 13, 2012 · 5 revisions

Audio

The audio is actually really easy, it is just like an image:

<img src="the_image_file_name.png"/> <audio id="stimuli_element" src="the_audio_stimuli_file_name.mp3"/>

Then, when you want to play it you use Javascript to get that element in the page and play it:

document.getElementById("stimuli_element").play();

Local Storage

LocalStorage is this awesome new features of HTML that lets you keep a database or just variables in the browser, no need for a server. The experiment is saving the language to localstorage, so that when you get to the main page the language is set. The experiment is also saving the votes to localstorage to make sure no data is lost. localStorage.setItem("language","Russian); localStorage.getItem("language");

Input boxes, sliders etc

Input boxes can have many types in HTML5, including a "range" type. We are using the range type so that the participants dont have to make categorical choices but can feel like its a gradient range. Most of the literature says an 11 point scale is appropriate for this task, so we did enforce a scale with categories but with one line of code it can become gradient again.

Javascript

Javascript is a lot like lambda calculus, if you like semantics or LaTeX, you might actually love Javascript. Javascript is what is controlling most of the logic of the game (you can find the control in the src folder). If you are using Chrome you can actually program in Javascript in your browser, just right click, click on Inspect Element and then click on Console and you can start typing in Javascript.

Google Spreadsheets

We made a new Form in Google Docs with the data we wanted to collect, this created a super simple way to collect data in the experiment. Even the votes are submitted to a google form. As a result the experimenter now has their data in a spreadsheet format, they can save it to their computer and start analysing the results in Excel or SPSS. If you open the spread sheet, you also get to see the results come in, in real time!

Clone this wiki locally