Dub Techno Chords
How do I make an dub techno chords?
To be continued.... What is a dub techno chords? How do you make a dub techno chords? This script and codes were developed by André Michelle on 18 October 2022, Tuesday.
Dub Techno Chords - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Dub Techno Chords</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div> <h3>Dub Techno Chords</h3> <h5>Web-Audio-Api / No Samples</h5> <p>Click to start...</p> <h4>Chrome only / Safari antiquated</h4>
</div> <script src="js/index.js"></script>
</body>
</html>
Dub Techno Chords - Script Codes CSS Codes
html, body { font-family: Open Sans; background: #111; text-align:center;
}
div { border-radius: 8px; background: black; padding: 16px; top: 50%; left: 50%; position: absolute; transform: translateX(-50%) translateY(-50%);
}
h3 { letter-spacing: 0.6px; margin: 0; padding: 0; color: yellow;
}
h4 { letter-spacing: 0.4px; margin: 0; padding: 0; color: red; font-size: 11px;
}
h5 { margin: 0; padding: 0; color: orange;
}
p { color: grey;
}
Dub Techno Chords - Script Codes JS Codes
console.clear();
var start = function() { var AudioContext = window.AudioContext || window.webkitAudioContext; var context = new AudioContext(); var bpm = 115.0; var barsToSeconds = function(bars) { return bars * 240.0 / bpm; }; var secondsToBars = function(seconds) { return seconds * bpm / 240.0; }; var noteToFrequency = function(midiNote) { return 440.0 * Math.pow(2.0, (midiNote + 3.0) / 12.0 - 6.0); }; var random = (function() { var seed = 0xABCDEF; return function() { return (seed = (seed * 16807) % 2147483647) / 2147483647.0; }; })(); var delay = function(delayTime, delayFeedback, wet, dry) { var input = context.createGain(); var output = context.createGain(); var dryGain = context.createGain(); var wetGain = context.createGain(); var delay = context.createDelay(); var feedback = context.createGain(); delay.delayTime.value = delayTime; feedback.gain.value = delayFeedback; dryGain.gain.value = dry; wetGain.gain.value = wet; input.connect(dryGain); input.connect(wetGain); dryGain.connect(output); wetGain.connect(delay); delay.connect(feedback); feedback.connect(delay); delay.connect(output); return { input: input, output: output }; }; var convolver = function(gain) { var convolver = context.createConvolver(); var convolverGain = context.createGain(); convolverGain.gain.value = gain; convolver.connect(convolverGain); return { input: convolver, output: convolverGain, loadImpulse: function(url, success) { var request = new XMLHttpRequest(); request.open("GET", url, true); request.responseType = "arraybuffer"; request.onload = function() { context.decodeAudioData(request.response, function(buffer) { convolver.buffer = buffer; if (success) success(); }, function(e) { console.error(e); }); }; request.onerror = function(e) { console.error(e); }; request.send(); } }; }; var buffer = context.createBuffer(1, context.sampleRate, context.sampleRate); var data = buffer.getChannelData(0); for (var i = 0; i < data.length; ++i) { data[i] = random() * 2.0 - 1.0; } var room = convolver(0.5); room.loadImpulse( "https://s3-us-west-2.amazonaws.com/s.cdpn.io/131247/factory.hall.ogg" ); room.output.connect(context.destination); var delayA = delay(barsToSeconds(7.0 / 16.0), 0.3, 0.4, 1.0); var delayB = delay(barsToSeconds(3.0 / 16.0), 0.4, 0.2, 1.0); var synthGain = context.createGain(); synthGain.gain.value = 0.07; var synthPanning = context.createStereoPanner(); synthGain.connect(synthPanning); synthPanning.connect(delayA.input); delayA.output.connect(delayB.input); delayB.output.connect(context.destination); delayB.output.connect(room.input); var kick = function(time) { var osc = context.createOscillator(); var env = context.createGain(); osc.connect(env); env.connect(context.destination); osc.frequency.value = 120; osc.frequency.setValueAtTime(120, time); osc.frequency.exponentialRampToValueAtTime(50, time + 0.1); env.gain.value = 0.5; env.gain.setValueAtTime(0.5, time); env.gain.linearRampToValueAtTime(0.0, time + 0.2); osc.start(time); osc.stop(time + 0.2); }; function closedHat(position, volume) { var hat = context.createBufferSource(); hat.buffer = buffer; hat.start(position); hat.stop(position + 0.02); var flt = context.createBiquadFilter(); flt.type = "highpass"; flt.frequency.value = 9000; hat.connect(flt); var gain = context.createGain(); gain.gain.value = volume; flt.connect(gain); gain.connect(context.destination); } var playSynth = function(position, duration, freqBegin, freqEnd, stereo, notes) { var q = 0.5; var complete = position + duration; var merger = context.createChannelMerger(); var fltA, fltB, fltC; fltA = context.createBiquadFilter(); fltA.type = "lowpass"; fltA.Q.value = q; fltA.frequency.setValueAtTime(freqBegin, position); fltA.frequency.exponentialRampToValueAtTime(freqEnd, complete); fltB = context.createBiquadFilter(); fltB.type = "lowpass"; fltB.Q.value = q; fltB.frequency.setValueAtTime(freqBegin, position); fltB.frequency.exponentialRampToValueAtTime(freqEnd, complete); fltC = context.createBiquadFilter(); fltC.type = "lowpass"; fltC.Q.value = q; fltC.frequency.setValueAtTime(freqBegin, position); fltC.frequency.exponentialRampToValueAtTime(freqEnd, complete); var n = notes.length; for (var i = 0; i < n; ++i) { var frequency = noteToFrequency(notes[i]); var oscA = context.createOscillator(); oscA.type = 'square'; oscA.frequency.value = frequency + stereo; oscA.start(position); oscA.stop(complete); oscA.connect(merger, 0, 0); var oscB = context.createOscillator(); oscB.type = 'square'; oscB.frequency.value = frequency - stereo; oscB.start(position); oscB.stop(complete); oscB.connect(merger, 0, 1); } merger.connect(fltA); fltA.connect(fltB); fltB.connect(fltC); fltC.connect(synthGain); } var bars = 0.0; var nextSchedule = context.currentTime; var scheduleTime = 0.050; var aheadTime = 0.100; var intervalMs = 10.0; var semiquaver = 1.0 / 16.0; var chordA = [36, 39, 43]; var chordB = [38, 41, 46]; var chordC = [39, 42, 46]; var p = document.querySelector("p"); var schedule = function() { var now = context.currentTime; if (now + aheadTime > nextSchedule) { var target = bars + secondsToBars(scheduleTime); var index = Math.floor(bars / semiquaver); var position = index * semiquaver; while (position < target) { if (position >= bars) { { // time display p.textContent = ("000" + (Math.floor(bars) + 1)).substr(-3) + "." + (Math.floor(bars * 4) % 4 + 1) + ":" + (Math.floor(bars * 16) % 4 + 1); } var startTime = nextSchedule + barsToSeconds(position - bars); var semiquaverTime = barsToSeconds(semiquaver); var mod4 = index % 4; var mod32 = index % 32; var mod128 = index % 128; if (0 == mod4) { kick(startTime); } if (0 < mod4) { closedHat(startTime, Math.pow(Math.sin(mod4 / 4.0 * Math.PI), 10.0) * 0.3); } if (4 == mod32) { playSynth(startTime, semiquaverTime * 2.0, 3000 - Math.cos(position / 24 * Math.PI * 2.0) * 1000.0, 240, 0.1, chordA); } if (30 == mod32) { playSynth(startTime, semiquaverTime * 2.0, 3000 - Math.cos(position / 28 * Math.PI * 2.0) * 2000.0, 240, 0.2, chordC); } if (123 == mod128) { playSynth(startTime, semiquaverTime * 4.0, 240, 660, -0.07, chordC); } synthPanning.pan.linearRampToValueAtTime(Math.sin((index % 7) / 7.0 * Math.PI * 2.0) * 0.5, startTime); } position = ++index * semiquaver; } bars = target; nextSchedule = nextSchedule + scheduleTime; } }; setInterval(schedule, intervalMs);
};
window.addEventListener("click", function() { console.log("start"); start(); window.removeEventListener("click", arguments.callee);
});
Developer | André Michelle |
Username | andremichelle |
Uploaded | October 18, 2022 |
Rating | 3 |
Size | 3,909 Kb |
Views | 22,264 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Stern-Brocot Sequence | 2,631 Kb |
Noise monotone increasing | 2,174 Kb |
Code 7 | 2,837 Kb |
Battery Api | 2,899 Kb |
Web Audio Api Convolver | 3,023 Kb |
Happy PI Day | 2,402 Kb |
Fourier series | 2,989 Kb |
X0X Clap | 2,825 Kb |
Animated text on bezier curve | 2,252 Kb |
Instable Connection | 2,828 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Transition | Shayhowe | 1,632 Kb |
A Pen by Miro Olma | Programiro | 2,342 Kb |
LeMandinque | Aadesida | 9,046 Kb |
Roman Numerical Converter | Vhall_io | 2,102 Kb |
A Pen by Malith Hettiarachchi | MalZiiirA | 5,531 Kb |
Weather App | Kw7oe | 3,162 Kb |
Spin | Elalemanyo | 8,262 Kb |
CSS3 keyframe onload animation. | Samueljseay | 1,706 Kb |
Hovers with popups | Zacharyolson | 2,380 Kb |
Price | Catcode | 2,623 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!