mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-24 12:08:28 +00:00
Fixing density and adding documentation
This commit is contained in:
parent
476bda812e
commit
fb28083ce6
@ -1214,6 +1214,17 @@ const generic_params = [
|
|||||||
* @name waveloss
|
* @name waveloss
|
||||||
*/
|
*/
|
||||||
['waveloss'],
|
['waveloss'],
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* Noise crackle density
|
||||||
|
*
|
||||||
|
* @name density
|
||||||
|
* @param {number | Pattern} density between 0 and x
|
||||||
|
* @example
|
||||||
|
* s("crackle*4").density("<0.01 0.04 0.2 0.5>".slow(4))
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
['density'],
|
||||||
// TODO: midi effects?
|
// TODO: midi effects?
|
||||||
['dur'],
|
['dur'],
|
||||||
// ['modwheel'],
|
// ['modwheel'],
|
||||||
@ -1308,7 +1319,7 @@ const generic_params = [
|
|||||||
];
|
];
|
||||||
// TODO: slice / splice https://www.youtube.com/watch?v=hKhPdO0RKDQ&list=PL2lW1zNIIwj3bDkh-Y3LUGDuRcoUigoDs&index=13
|
// TODO: slice / splice https://www.youtube.com/watch?v=hKhPdO0RKDQ&list=PL2lW1zNIIwj3bDkh-Y3LUGDuRcoUigoDs&index=13
|
||||||
|
|
||||||
controls.createParam = function (names) {
|
controls.createParam = function(names) {
|
||||||
const name = Array.isArray(names) ? names[0] : names;
|
const name = Array.isArray(names) ? names[0] : names;
|
||||||
|
|
||||||
var withVal;
|
var withVal;
|
||||||
@ -1332,7 +1343,7 @@ controls.createParam = function (names) {
|
|||||||
|
|
||||||
const func = (...pats) => sequence(...pats).withValue(withVal);
|
const func = (...pats) => sequence(...pats).withValue(withVal);
|
||||||
|
|
||||||
const setter = function (...pats) {
|
const setter = function(...pats) {
|
||||||
if (!pats.length) {
|
if (!pats.length) {
|
||||||
return this.fmap(withVal);
|
return this.fmap(withVal);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,7 +35,8 @@ function getNoiseBuffer(type, density) {
|
|||||||
output[i] *= 0.11;
|
output[i] *= 0.11;
|
||||||
b6 = white * 0.115926;
|
b6 = white * 0.115926;
|
||||||
} else if (type === 'crackle') {
|
} else if (type === 'crackle') {
|
||||||
if (Math.random() < (Math.random() * (density - 0.001) + density).toFixed(4)) {
|
const probability = density * 0.01
|
||||||
|
if (Math.random() < probability) {
|
||||||
output[i] = Math.random() * 2 - 1;
|
output[i] = Math.random() * 2 - 1;
|
||||||
} else {
|
} else {
|
||||||
output[i] = 0;
|
output[i] = 0;
|
||||||
|
|||||||
@ -241,6 +241,7 @@ export const superdough = async (value, deadline, hapDuration) => {
|
|||||||
source,
|
source,
|
||||||
gain = 0.8,
|
gain = 0.8,
|
||||||
postgain = 1,
|
postgain = 1,
|
||||||
|
density = 0.03,
|
||||||
// filters
|
// filters
|
||||||
ftype = '12db',
|
ftype = '12db',
|
||||||
fanchor = 0.5,
|
fanchor = 0.5,
|
||||||
|
|||||||
@ -36,7 +36,8 @@ export function registerSynthSounds() {
|
|||||||
if (waveforms.includes(s)) {
|
if (waveforms.includes(s)) {
|
||||||
sound = getOscillator(s, t, value);
|
sound = getOscillator(s, t, value);
|
||||||
} else {
|
} else {
|
||||||
sound = getNoiseOscillator(s, t, 0.002);
|
let { density } = value;
|
||||||
|
sound = getNoiseOscillator(s, t, density);
|
||||||
}
|
}
|
||||||
|
|
||||||
let { node: o, stop, triggerRelease } = sound;
|
let { node: o, stop, triggerRelease } = sound;
|
||||||
|
|||||||
@ -42,6 +42,10 @@ Some amount of pink noise can also be added to any oscillator by using the `nois
|
|||||||
|
|
||||||
<MiniRepl client:idle tune={`note("c3").noise("<0.1 0.25 0.5>").scope()`} />
|
<MiniRepl client:idle tune={`note("c3").noise("<0.1 0.25 0.5>").scope()`} />
|
||||||
|
|
||||||
|
You can also use the `crackle` type to play some subtle noise crackles. You can control noise amount by using the `density` parameter:
|
||||||
|
|
||||||
|
<JsDoc client:idle name="density" h={0} />
|
||||||
|
|
||||||
### Additive Synthesis
|
### Additive Synthesis
|
||||||
|
|
||||||
To tame the harsh sound of the basic waveforms, we can set the `n` control to limit the overtones of the waveform:
|
To tame the harsh sound of the basic waveforms, we can set the `n` control to limit the overtones of the waveform:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user