mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-13 22:58:34 +00:00
filter type can take in number also
This commit is contained in:
parent
bce24980cb
commit
84a8ca9d19
@ -755,7 +755,7 @@ export const { bprelease, bpr } = registerControl('bprelease', 'bpr');
|
||||
/**
|
||||
* Sets the filter type. The 24db filter is more aggressive. More types might be added in the future.
|
||||
* @name ftype
|
||||
* @param {number | Pattern} type 12db (default) or 24db
|
||||
* @param {number | Pattern} type 12db (0), ladder (1), or 24db (2)
|
||||
* @example
|
||||
* note("c f g g a c d4").fast(2)
|
||||
* .sound('sawtooth')
|
||||
|
||||
@ -7,7 +7,7 @@ This program is free software: you can redistribute it and/or modify it under th
|
||||
import './feedbackdelay.mjs';
|
||||
import './reverb.mjs';
|
||||
import './vowel.mjs';
|
||||
import { clamp, nanFallback } from './util.mjs';
|
||||
import { clamp, nanFallback, _mod } from './util.mjs';
|
||||
import workletsUrl from './worklets.mjs?url';
|
||||
import { createFilter, gainNode, getCompressor, getWorklet } from './helpers.mjs';
|
||||
import { map } from 'nanostores';
|
||||
@ -251,6 +251,11 @@ export function resetGlobalEffects() {
|
||||
analysers = {};
|
||||
analysersData = {};
|
||||
}
|
||||
const getFilterType = (ftype) => {
|
||||
ftype = ftype ?? 0;
|
||||
const filterTypes = ['12db', 'ladder', '24db'];
|
||||
return typeof ftype === 'number' ? filterTypes[_mod(ftype, filterTypes.length)] : ftype;
|
||||
};
|
||||
|
||||
export const superdough = async (value, t, hapDuration) => {
|
||||
const ac = getAudioContext();
|
||||
@ -280,7 +285,7 @@ export const superdough = async (value, t, hapDuration) => {
|
||||
postgain = 1,
|
||||
density = 0.03,
|
||||
// filters
|
||||
ftype = '12db',
|
||||
|
||||
fanchor = 0.5,
|
||||
drive = 0.69,
|
||||
// low pass
|
||||
@ -387,9 +392,9 @@ export const superdough = async (value, t, hapDuration) => {
|
||||
// gain stage
|
||||
chain.push(gainNode(gain));
|
||||
|
||||
//filter
|
||||
const ftype = getFilterType(value.ftype);
|
||||
if (cutoff !== undefined) {
|
||||
// chain.push(getWorklet(ac, 'ladder-processor', { frequency: cutoff, q: resonance, drive: 1 }));
|
||||
|
||||
let lp = () =>
|
||||
createFilter(
|
||||
ac,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user