[Csnd] squinewave RFC
Date | 2017-11-06 00:32 |
From | rasmus ekman |
Subject | [Csnd] squinewave RFC |
Attachments | squinewave.txt squinewave_2017-11-05.zip |
Hi, Here's an oscillator I'd like to submit for use in Csound. Output is a mostly bandlimited shape-shifting square-pulse-saw-sinewave oscil with hardsync. Bandlimiting is an effect of how the waveform is rendered: The waveform uses a minimum sweep rate in samples (usually 10-20 samples). Squarewave, saw, pulses etc cannot make sharper transitions than these; therefore at higher frequency all waveforms "degrade" to sinewave. (This is not a limit on frequency, FM can send it into aliasing as per usual.) I'm grateful for comments on interface and behavior; Naming, code style, interface (arg types), docs, etc. Some example CSD:s are provided, they use squinewave for modulation and output. soundfiles for two of them are here: https://www.abc.se/~re/squinewave/squine_fm_pulse.wav (Mono 4 MB) https://www.abc.se/~re/squinewave/squine_hardsync_and_fm.wav (Stereo 5.3 MB) - the latter has 2 sections; in each the left chan modulates right, first using hardsync then with FM Code (single c file), docs (txt file) and examples attached in zip file. Build instructions at bottom of squinewave.c Also here: https://www.abc.se/~re/squinewave/squinewave_2017-11-05.zip Regards, /re |
Date | 2017-11-06 01:21 |
From | "Jeanette C." |
Subject | Re: [Csnd] squinewave RFC |
Nov 6 2017, rasmus ekman has written: > Hi, > > Here's an oscillator I'd like to submit for use in Csound. > > Output is a mostly bandlimited shape-shifting square-pulse-saw-sinewave oscil > with hardsync. ... > https://www.abc.se/~re/squinewave/squinewave_2017-11-05.zip ... Hi Rasmus, this is absolutely brilliant. I'm not good at reading code, especially, when it gets down to the DSP nitty-gritty. But I've been working on something similar in Csound, without the option to hardsync. I've used the possibility to somehow change a sine to a saw wave and then reading a phase shifted version. By changing the polarity of the second signal I could chnage from saw to square. By shifting the phases between the two signals the oscillator could do pulse width modulation or sawtooth modulation as found in some hardware synths (Yamah AN1X, DSI Prophet12 and other DSI synths with digital oscillator, possibly more soft and hardware synths). Could that be an option in your code? Just wondering... Great work! Thanks a lot for sharing this code! This is great! Best wishes, Jeanette -------- * website: http://juliencoder.de - for summer is a state of sound * SoundCloud: https://soundcloud.com/jeanette_c There must be another way Cause I believe in taking chances But who am I to say - What a girl is to do <3 (Britney Spears) Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here |
Date | 2017-11-06 07:36 |
From | rasmus ekman |
Subject | Re: [Csnd] squinewave RFC |
Hi Jeanette, The shifting opposite saw signals is a nice trick to create pulse-width waveform. You can also support sync by snapping the saw when you get the trigger signal. These shapes are directly available in squinewave, but you could of course also use its saw shape to create the effect (with a more rounded bandlimited waveform). Cheers, /re On 2017-11-06 02:21, Jeanette C. wrote: > Nov 6 2017, rasmus ekman has written: > >> Hi, >> >> Here's an oscillator I'd like to submit for use in Csound. >> >> Output is a mostly bandlimited shape-shifting square-pulse-saw-sinewave oscil with hardsync. > ... >> https://www.abc.se/~re/squinewave/squinewave_2017-11-05.zip > ... > Hi Rasmus, > this is absolutely brilliant. I'm not good at reading code, especially, > when it gets down to the DSP nitty-gritty. But I've been working on > something similar in Csound, without the option to hardsync. I've used > the possibility to somehow change a sine to a saw wave and then reading > a phase shifted version. By changing the polarity of the second signal I > could chnage from saw to square. By shifting the phases between the two > signals the oscillator could do pulse width modulation or sawtooth > modulation as found in some hardware synths (Yamah AN1X, DSI Prophet12 > and other DSI synths with digital oscillator, possibly more soft and > hardware synths). Could that be an option in your code? Just > wondering... > > Great work! Thanks a lot for sharing this code! This is great! > > Best wishes, > > Jeanette > > -------- > * website: http://juliencoder.de - for summer is a state of sound > * SoundCloud: https://soundcloud.com/jeanette_c > > There must be another way > Cause I believe in taking chances > But who am I to say - What a girl is to do <3 > (Britney Spears) > > Csound mailing list > Csound@listserv.heanet.ie > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND > Send bugs reports to > https://github.com/csound/csound/issues > Discussions of bugs and features can be posted here > Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here |
Date | 2017-11-06 08:52 |
From | Richard |
Subject | Re: [Csnd] squinewave RFC |
Wonderful! Thanks for sharing.. Richard On 06/11/17 01:32, rasmus ekman wrote:
Hi, |
Date | 2017-11-06 10:09 |
From | Anders Genell |
Subject | Re: [Csnd] squinewave RFC |
I agree - very nice !! Lysande, helt enkelt!! Regards, Anders On Mon, Nov 6, 2017 at 9:52 AM, Richard <zappfinger@gmail.com> wrote:
|
Date | 2017-11-06 14:47 |
From | Steven Yi |
Subject | Re: [Csnd] squinewave RFC |
Sounds nice to my ear, curious to give it a try! For interface, I think having in-args of "xxx?oj" might work (i-, k-, or a- for first three args; ? allows for optional var of any type). I can imagine wanting to use just i or k for the first three args (say, if values are coming from a UI widget or something). For docs, I searched online for squine and found a few things: https://www.reddit.com/r/math/comments/2r5xqx/i_present_my_live_demo_of_the_squine_function/ https://www.reddit.com/r/matheducation/comments/1rbgt2/squine_cosquine_playing_around_with_trig/ http://www.tegam.com/wp-content/uploads/2015/10/WaveWorks-Jr.-Manual-Rev-C.pdf I had never heard of squines before; is this oscillator related to the the above links? Thanks! steven On Sun, Nov 5, 2017 at 8:21 PM, Jeanette C. |
Date | 2017-11-06 20:12 |
From | rasmus ekman |
Subject | Re: [Csnd] squinewave RFC |
Thanks for your suggestions! (1) Input arguments: It's one of the discussion points I hoped to hear about. I have good reasons for everything, but they may be wrong... (2) Questionmark for optional a-rate: Oh, that's new maybe? I build against 2016-12-16 sources. Didn't update since it was such a hassle to get to build. Will check that. (3) The name: I just googled the word squine some time ago, missed those articles. The wordplay is about as obvious as it's crude I guess. Maybe there's space for (1) anyway here: K-rate inputs freq, clip and skew args are used at every sample point to calc the right waveform. The waveform changes quickly, esp. under FM. With high clipping, the waveform slope is much steeper than base frequency suggests, so any jumps are much more degrading/aliasing than sending k-rate freq to a regular sinewave poscil (which to my ear is pretty much criminal already, in this day...) So while it's not unthinkable to allow k-rate, I would probably insist on ramping the args internally, and that kind of beats any savings, what with added complexity. That's my take on it now anyway. Regards, /rasmus On 2017-11-06 15:47, Steven Yi wrote: > Sounds nice to my ear, curious to give it a try! > > For interface, I think having in-args of "xxx?oj" might work (i-, k-, > or a- for first three args; ? allows for optional var of any type). I > can imagine wanting to use just i or k for the first three args (say, > if values are coming from a UI widget or something). > > For docs, I searched online for squine and found a few things: > > https://www.reddit.com/r/math/comments/2r5xqx/i_present_my_live_demo_of_the_squine_function/ > https://www.reddit.com/r/matheducation/comments/1rbgt2/squine_cosquine_playing_around_with_trig/ > http://www.tegam.com/wp-content/uploads/2015/10/WaveWorks-Jr.-Manual-Rev-C.pdf > > I had never heard of squines before; is this oscillator related to the > the above links? > > Thanks! > steven > > > On Sun, Nov 5, 2017 at 8:21 PM, Jeanette C. |
Date | 2017-11-06 20:37 |
From | Steven Yi |
Subject | Re: [Csnd] squinewave RFC |
Csound should be pretty easy to build with Visual Studio these days on Windows (see the msvc folder for everything setup for that; we used your list you posted to the dev list back in December as a start to all of the current VS work). The ? in-arg change was introduced for Csound 6.0 though as it was necessary for implementing opcodes that worked with arrays of any-type. Thanks for clarifying the other squine links; I guess then this isn't a cosquine like in the one video? ;) (funny terms! :D ) For k-rate, I see your point of view when it comes to changing values, but I suppose the use case I imagined was a little different where the value doesn't change during the duration of a note but maybe the user is adjusting a knob for a static value. As it is now, one might write something like: ifreq = cps2pch(p4, 12) iclip = chnget:i("clip_val") ;; from a UI iskew = chnget:i("skew_val") ;; from a UI asig squinewave a(ifreq), a(iclip), a(iskew) So maybe a user has a static skew but time-varying clip, or vice-versa. I found when I did the ZDF opcodes that I had started with a-rate only args too but after a while it became cumbersome to use a() to wrap static values when I wanted to use it, so I had introduced x-arg types. The args to squinewave reminded me of that situation. On Mon, Nov 6, 2017 at 3:12 PM, rasmus ekman |
Date | 2017-11-09 04:31 |
From | rasmus ekman |
Subject | Re: [Csnd] squinewave RFC |
Hi, I've updated to reflect Steven's note about optional a-rate. It's the same zip file as before, just code and docs changed: https://www.abc.se/~re/squinewave/squinewave_2017-11-05.zip ...but building against 6.09.1 I still get "missing required argument" when I omit the optional a-rate argument. I have { "squinewave", sizeof(SQUINEWAVE), 0, 5, "am", "aaa?oj", (SUBR)squinewave_init, NULL, (SUBR)squinewave_gen }, And the questionmark doesn't help. Is this really super-new? Anyway also solved a simple math puzzle that I failed before. (No real difference, just one code line slightly shorter) Any other ideas, please argue. (For instance, the lack of amp argument, is that unacceptable? - I don't mind adding, but to me it's just a pointless multiplication that does nothing in the algorithm) Is there an opposite of deprecation so people can try it? I don't have dev access to the github, so whenever you're ok with it, feel free to add. Or wait. Regards, /re On 2017-11-06 15:47, Steven Yi wrote: > Sounds nice to my ear, curious to give it a try! > > For interface, I think having in-args of "xxx?oj" might work (i-, k-, > or a- for first three args; ? allows for optional var of any type). I > can imagine wanting to use just i or k for the first three args (say, > if values are coming from a UI widget or something). > > For docs, I searched online for squine and found a few things: > > https://www.reddit.com/r/math/comments/2r5xqx/i_present_my_live_demo_of_the_squine_function/ > https://www.reddit.com/r/matheducation/comments/1rbgt2/squine_cosquine_playing_around_with_trig/ > http://www.tegam.com/wp-content/uploads/2015/10/WaveWorks-Jr.-Manual-Rev-C.pdf > > I had never heard of squines before; is this oscillator related to the > the above links? > > Thanks! > steven > > > On Sun, Nov 5, 2017 at 8:21 PM, Jeanette C. |
Date | 2017-11-09 06:55 |
From | Victor Lazzarini |
Subject | Re: [Csnd] squinewave RFC |
There are two ways to contribute directly: 1) use pull requests; 2) joining the dev team and getting write access. Let us know what you would like to do. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland
|
Date | 2017-11-09 16:51 |
From | rasmus ekman |
Subject | Re: [Csnd] squinewave RFC |
Whichever is least risk of me crashing stuff. Pull requests? (Using git/bitbucket at work, but only by pushing buttons in Eclipse, I'll read up.) Thanks, /rasmus On 2017-11-09 07:55, Victor Lazzarini wrote: > There are two ways to contribute directly: 1) use pull requests; 2) joining the dev team and getting write access. Let us know what you would like to do. > > Victor Lazzarini > > On 9 Nov 2017, at 04:32, rasmus ekman |
Date | 2017-11-09 16:56 |
From | Victor Lazzarini |
Subject | Re: [Csnd] squinewave RFC |
Pull requests definitely. ======================== Prof. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 9 Nov 2017, at 16:51, rasmus ekman |
Date | 2017-11-10 03:24 |
From | rasmus ekman |
Subject | Re: [Csnd] squinewave RFC |
Thinks I figured out which buttons to push, so I need permissions for pull requests. Also for the manual I guess. Or whichever is easiest for everybody, would the requests cause work for someone else to actually commit? Apparently my github handle is ostinato Cheers, /re On 2017-11-09 17:56, Victor Lazzarini wrote: > Pull requests definitely. > ======================== Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here |
Date | 2017-11-10 08:50 |
From | Victor Lazzarini |
Subject | Re: [Csnd] squinewave RFC |
I am not aware you need any permissions for that. Just submit it and then it’s reviewed and approved/etc. ======================== Prof. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 10 Nov 2017, at 03:24, rasmus ekman |
Date | 2017-11-10 09:28 |
From | Victor Lazzarini |
Subject | Re: [Csnd] squinewave RFC |
Just to clarify, normally you’d create a pull request from a fork: https://help.github.com/articles/creating-a-pull-request-from-a-fork/ and https://help.github.com/articles/creating-a-pull-request/#changing-the-branch-range-and-destination-repository ======================== Prof. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 10 Nov 2017, at 03:24, rasmus ekman |
Date | 2017-11-10 12:20 |
From | Michael Gogins |
Subject | Re: [Csnd] squinewave RFC |
Yes, pull requests must be merged by a developer with write access to the repository. People who make a lot of contributions should probably have write access. Best, Mike On Nov 9, 2017 10:24 PM, "rasmus ekman" <re@abc.se> wrote: Thinks I figured out which buttons to push, so I need permissions for pull requests. |