Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

control osc partial count with n #674

Merged
merged 1 commit into from Aug 31, 2023
Merged

control osc partial count with n #674

merged 1 commit into from Aug 31, 2023

Conversation

felixroos
Copy link
Collaborator

@felixroos felixroos commented Aug 24, 2023

for any of the simple waveforms, sawtooth, triangle, square (sine), this allows controlling the number of partials with the n control:

note("c a f e")
.s("sawtooth:8") // <--- sawtooth wave with 8 partials

This allows creating less harsh waveforms with additive synthesis directly, without needing a filter, which is more to write.

This is actually a breaking change, because n could prior be used to control the oscillator pitch, as a synonym for note.
I think this synonym, which only works with oscillators is more confusing than helpful, as it sometimes works ( waveforms ) and sometimes not ( samples: picks another sample ). The behavior of n to choose partial count for oscillators complements the behavior of n to pick a sample variant, as it is also timbre related..

@yaxu what do you think? I think tidal also has this separation of n for samples and synths?
If you don't think this is a good idea, I could also add a partials control instead...

edit: the problem with an extra control for this is that you cannot use it with ":" notation, so you'd have to write s("sawtooth").partials(8) instead of s("sawtooth:8") because the second item in s is always bound to n.
Right now, that second item is not really usefull for waveforms

also, it might make sense to limit the number of partials to 64 or something

fixes #191
related: #395

@yaxu
Copy link
Member

yaxu commented Aug 24, 2023

So I guess the idea is to let the synth to decide what n means in terms of the main way it varies the timbre? I guess some might still map it to note in that case, unless that's just too confusing..

@felixroos
Copy link
Collaborator Author

So I guess the idea is to let the synth to decide what n means in terms of the main way it varies the timbre? I guess some might still map it to note in that case, unless that's just too confusing..

if synth means the simple waveforms, not really.. instead decide that simple waveforms will always use n for the number of partials. if n is zero, then "infinite" partials will be used (no additive synthesis). but the fact that waveforms / synths and samples are built on top of "sounds" as in https://strudel.tidalcycles.org/technical-manual/sounds, it means that a sound can decide what happens with any of the controls passed to it.. but in the majority of cases, people won't use that sound api. but in the future, we could use the sound api to build different synths that maybe use n in a different, timbre controlling way, yes

@felixroos
Copy link
Collaborator Author

ok to merge this then?

@felixroos felixroos merged commit d399df8 into main Aug 31, 2023
2 checks passed
@felixroos felixroos deleted the waveformn branch August 31, 2023 03:20
@yaxu
Copy link
Member

yaxu commented Aug 31, 2023

Sorry missed the question (still deep in haskell land) but the note / n confusion has been a pain point for many and this seems like an improvement..

@felixroos
Copy link
Collaborator Author

Sorry missed the question (still deep in haskell land) but the note / n confusion has been a pain point for many and this seems like an improvement..

no worries.. i might also be a little quick to merge stuff. i hope that is ok..

Now that the scope has landed I realized this feature is not really working as expected (the sawtooth and square phases are wrong). have to rework a bit

@yaxu
Copy link
Member

yaxu commented Aug 31, 2023

sure keep it moving :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support waveformN format
2 participants