Comments (5)
The formula can be compiled as:
// for synths
~unitDuration = ~delta;
// for samples
~unitDuration = buffer.duration;
// then some conversions of unitDuration (covered below)
// then, finally
sustain = ~sustain ?? { if(~legato.notNil) { ~delta * ~legato } { unitDuration } };
// let samples end if needed
~buffer !? { sustain = min(unitDuration, sustain) };
samples | synths | |
---|---|---|
nothing specified | plays the full sample | plays to fill one delta |
# sustain (secs) | fills the sustain time with the sample. If looping, loop until time has passed | plays the full sustain time |
# speed | speeds up the sample playback, shortening the total duration | scale the synth sustain (parameter can be used in the synth) |
# accelerate | incrementally speeds up the sample playback | scale the synth sustain (parameter can be used in the synth) |
# begin | shortens the sample playback and starts later in the sample | shortens the synth sustain (parameter can be used in the synth) |
# end | shortens the sample playback and ends earlier in the sample | shortens the synth sustain (parameter can be used in the synth) |
# loop | loops n times between begin and end, extending the duration if legato/sustain don't set the limit | extends the synth sustain (parameter can be used in the synth) |
# legato | calculates sustain from delta * legato , then, see sustain |
(same as sample) |
… more to come …
The calculation of unitDuration
if (~unit == \c) { speed = speed * ~unitDuration * ~cps };
endSpeed = speed * (1.0 + accelerate);
avgSpeed = speed.abs + endSpeed.abs * 0.5;
if(~unit == \rate) { ~unit = \r }; // API adaption to tidal output
// sustain is the duration of the sample
switch(~unit,
\r, {
unitDuration = ~unitDuration * ~length / avgSpeed;
},
\c, {
unitDuration = ~unitDuration * ~length / avgSpeed;
},
\s, {
unitDuration = ~length;
},
{ Error("this unit ('%') is not defined".format(~unit)).throw };
);
~loop !? { unitDuration = unitDuration * ~loop.abs };
Questions
- Should these unitDuration calculations affect also synths?
- Should
legato
override unitDuration calculations completely?
This concerns the meaning of the parameters:
- speed
- acceleration
- begin & end
and:
- unit
E.g. if we set begin and end of a synth, should it get shorter? If we set begin and end of a sample, and loop it many times, and specify legato, should the legato space be filled by the sample looping between begin and end?
from superdirt.
Just a few thoughts:
legato
for samples: It currently can cut off sample playback early, but won't make it longer. This is still true when you use begin, end, loop, etc. I like this behavior, it basically means that for samples if I want direct control over how much "space" a sample uses, I use legato. I don't generally want samples to loop unless I explicitly say so. I could understand wanting to have an easy syntax for "loop the sample until the legato is filled"; right now that would be # loop "largenumber" # legato "whatever"
which can be a little risky. I could imagine using # loop "-1"
to mean this, but maybe that's too obscure.
telephon: yes, I'd also say that it is correct like this. A specific
unit
could be used to stretch the sample to fit sustain/legato. I don't think that loop -1 is too obscure really.
speed
for synths: Actually, at the moment speed isn't completely unspecified as it still enters into the unitDuration calculation, regardless of whether the synth also uses it internally. This can get a bit weird. loop
, begin
, end
, and accelerate
also do this, although I rarely use most of those with synths. I think this is mostly OK - it just means that at least duration-wise synths mostly behave like samples, and that might be easiest for users to understand. Then it's up to the synth author if they want to do further interesting things with those parameters. But right now it can be rather idiosyncratic - a bunch of my synths overload speed
and accelerate
and I'm still not sure if it was the right thing to do. It'd be great to get a lot of feedback on this.
it is certainly good that the synths can use these parameters, so that many of the interesting functions that tidal defines have a meaning also for synths. But of course it should be left to the synth-author whether she wants to use it. The main question seems to be whether it is too obscure if you don't implement them in the SynthDef and they still affect the
sustain
of the synth. To me it seems thatbegin
andend
should definitely affect sustain (unless explicitly specified or legato is set). I'm less sure aboutspeed
. Even less aboutloop
andaccelerate
.
from superdirt.
btw. there is also the option of deriving the default synth sustain from the SynthDef default argument. But that is an overhead for little gain, as it seemed.
I'd prefer to make a dictionary of events that you register with dirt, which allows you to specify default parameters for each kind of synth, or even do other things, like play sclang patterns (like grain clouds).
from superdirt.
solved now.
from superdirt.
… well, the overview would still be useful.
from superdirt.
Related Issues (20)
- SuperDirt WASM?
- `arp` step patterns not working HOT 3
- Start SuperDirt on a server other than default s HOT 1
- startup code works with 1.7.2, fails with 1.7.3 HOT 5
- module arguments default to 0 instead of default value given in SynthDef HOT 6
- NRPN fails to send value 0 for CC 38
- Q: How do default arguments in the SynthDefs SuperDirt use work? HOT 3
- delay stops working sometimes HOT 4
- amp parameter scaling HOT 3
- playing samples in tune using pitch metadata HOT 2
- unit "s" unexpected behavior HOT 1
- How to add a custom DirtEventType for MIDI over OSC HOT 10
- Supercollider 3.13.0-rc1 / SuperDirt 1.7.3 - High Cpu Usage At Idle - macOS HOT 17
- SuperDirt does not recognize SynthDef variants HOT 2
- superchip is way out of tune HOT 2
- cut groups break on simultaneous events HOT 29
- Should we send RPN Null after NRPN? HOT 4
- d3 onwards not sounding HOT 1
- Lazy Sample Loading doesn't find any samples (Windows 11/SuperCollider 3.12.1) HOT 3
- Effect "dj-filter" should be inactive when value is 0.5 HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from superdirt.