Re: [music-dsp] Best way to do sine hard sync?

2014-03-28 Thread Emanuel Landeholm
Frank Sheeran,

>From my reading of wikipedias page on phase distortion synthesis, my method
is definitely related. The main differences are that I use two modulators
(master oscillators), and a cos^2 window instead of a triangular wave form.
I wouldn't be at all surprised if Casio CZ synthesis was an inspiration for
my hard sync. Alas the details are lost in the mist of time...

For those interested, I have generated a 4 second mp3 (66 kB) so you can
listen for yourselves without having to compile and run:

https://dl.dropboxusercontent.com/u/285841/hs2014.mp3

cheers,
E


On Thu, Mar 27, 2014 at 3:55 PM, Frank Sheeran  wrote:

> From my perhaps less-than-perfect reading of this method, it sounds much
> like the Casio CZ synthesizer's "resonance" waveforms.
>
> If you're among the select few who's actually downloaded the alpha of my
> functional synthesis patching language, Moselle, you will find a module
> called Cazanova that does a superset of CZ waveforms (albeit with FM, not
> PM, making it, to my reading of their patent, not an infringement).
>
> See illustration:
> http://moselle.invisionzone.com/index.php?/gallery/image/16-untitled-4/
>
> The "beauty" of the CZ waveform is they made an interesting tradeoff:
> accepting bucket-loads of DC in exchange for some really simple but
> powerful waveforms.
>
> They had the option (which I emulate) of having a single oscillator switch
> between two waveforms.  In the illustration here, the first half is a sine
> wave FM'd to be morphing into a sawtooth.  That's not actually pertinent to
> the discussion, but the right half is the same sinewave, suddenly switched
> to a much higher frequency and windowed (I think that's the term--I mean
> "multiplied" mathmatically) by a triangle wave.
>
> Both CZ and Cazanova give three windowing functions: this triangle, a
> trapezoid, and (I think an exact match for what OP is describing) a
> sawtooth.
>
> If I'm correct that this is what you're doing then I'd say the sound is
> quite different from hard sync, but that's not to say its bad at all.  In
> fact, in Moselle, there are several demo patches that use Cazanova with no
> further processing.  I'd say its a bit like a resonant filter sweep so
> clean you know its digital.
> --
> dupswapdrop -- the music-dsp mailing list and website:
> subscription info, FAQ, source code archive, list archive, book reviews,
> dsp links
> http://music.columbia.edu/cmc/music-dsp
> http://music.columbia.edu/mailman/listinfo/music-dsp
>
--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp


Re: [music-dsp] Best way to do sine hard sync?

2014-03-27 Thread Frank Sheeran
>From my perhaps less-than-perfect reading of this method, it sounds much
like the Casio CZ synthesizer's "resonance" waveforms.

If you're among the select few who's actually downloaded the alpha of my
functional synthesis patching language, Moselle, you will find a module
called Cazanova that does a superset of CZ waveforms (albeit with FM, not
PM, making it, to my reading of their patent, not an infringement).

See illustration:
http://moselle.invisionzone.com/index.php?/gallery/image/16-untitled-4/

The "beauty" of the CZ waveform is they made an interesting tradeoff:
accepting bucket-loads of DC in exchange for some really simple but
powerful waveforms.

They had the option (which I emulate) of having a single oscillator switch
between two waveforms.  In the illustration here, the first half is a sine
wave FM'd to be morphing into a sawtooth.  That's not actually pertinent to
the discussion, but the right half is the same sinewave, suddenly switched
to a much higher frequency and windowed (I think that's the term--I mean
"multiplied" mathmatically) by a triangle wave.

Both CZ and Cazanova give three windowing functions: this triangle, a
trapezoid, and (I think an exact match for what OP is describing) a
sawtooth.

If I'm correct that this is what you're doing then I'd say the sound is
quite different from hard sync, but that's not to say its bad at all.  In
fact, in Moselle, there are several demo patches that use Cazanova with no
further processing.  I'd say its a bit like a resonant filter sweep so
clean you know its digital.
--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp


Re: [music-dsp] Best way to do sine hard sync?

2014-03-23 Thread Emanuel Landeholm
Re. my hard sync implementation.

I have fixed two serious bugs and I also removed all external dependencies.
The download link is:

https://www.dropbox.com/s/f15usnkv6f19iq9/hardsync2014.tar.bz2

All the hard sync logic is contained in the main function. My hard sync
uses two relatively independent slave oscillators. The slave oscillators
can actually run at different rates and they can also be different
waveforms. I included band unlimited versions of sinusoid, triangular,
sawtooth and square functions. They all work fine, but aliasing is quite
prominent in the square waveform. Master and slave rates can be set
independently, but you have to watch out for DC when master frequency >
slave frequency.

cheers,
E


On Fri, Mar 21, 2014 at 10:28 PM, David Lowenfels  wrote:

> On Mar 21, 2014, at 5:26 AM, Emanuel Landeholm <
> emanuel.landeh...@gmail.com> wrote:
> > Also, David Lowenfels, would you like to share your pd implementation?
>
> Sure. I was able to dust it off and get it running, but there are some
> external dependencies which I need to remove in order to make it portable.
> It will take me a few days to clean it up.
>
> I played around with it this morning, and there is some audible aliasing
> in the higher octave, especially when using the more rectangular-ish shaped
> windows (which is no big surprise). Oversampling would help for sure.
>
> My patch uses an envelope follower on a drum loop to modulate the
> master/slave ratio.
> It does sound pretty cool with a sine wave, kind of like one of those
> plastic whirly tubes.
>
> -David
>
> --
> dupswapdrop -- the music-dsp mailing list and website:
> subscription info, FAQ, source code archive, list archive, book reviews,
> dsp links
> http://music.columbia.edu/cmc/music-dsp
> http://music.columbia.edu/mailman/listinfo/music-dsp
>
--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp


Re: [music-dsp] Best way to do sine hard sync?

2014-03-21 Thread David Lowenfels
On Mar 21, 2014, at 5:26 AM, Emanuel Landeholm  
wrote:
> Also, David Lowenfels, would you like to share your pd implementation?

Sure. I was able to dust it off and get it running, but there are some external 
dependencies which I need to remove in order to make it portable. It will take 
me a few days to clean it up. 

I played around with it this morning, and there is some audible aliasing in the 
higher octave, especially when using the more rectangular-ish shaped windows 
(which is no big surprise). Oversampling would help for sure.

My patch uses an envelope follower on a drum loop to modulate the master/slave 
ratio.
It does sound pretty cool with a sine wave, kind of like one of those plastic 
whirly tubes.

-David


signature.asc
Description: Message signed with OpenPGP using GPGMail
--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp

Re: [music-dsp] Best way to do sine hard sync?

2014-03-21 Thread Emanuel Landeholm
>
> FYI Emanuel Landeholm also had a cool method using windows to suppress
> aliasing. It sounded pretty good to my ear, though I never did any spectral
> measurements. It works with any slave oscillator waveform, including sine.
> I implemented it in PD with a Kaiser-Bessel window for an extra parameter
> of control.


Actually, don't download hardsync.tar.bz2! :-) It's buggy and has lots of
confusing dependencies. The description I posted to the list of the process
is correct, but the reference implementation is not... I'm
debugging/refactoring it right now (haven't touched the code since, what,
2001?). I'll keep you guys posted.

Also, David Lowenfels, would you like to share your pd implementation?

cheers,
Emanuel



On Fri, Mar 21, 2014 at 5:24 AM, David Lowenfels
wrote:

> FYI Emanuel Landeholm also had a cool method using windows to suppress
> aliasing. It sounded pretty good to my ear, though I never did any spectral
> measurements. It works with any slave oscillator waveform, including sine.
> I implemented it in PD with a Kaiser-Bessel window for an extra parameter
> of control.
>
> http://music.columbia.edu/pipermail/music-dsp/2001-October/045626.html
> http://dl.dropbox.com/u/285841/hardsync.tar.bz2
>
> -David
>
> On Mar 10, 2014, at 5:02 PM, Marco Lo Monaco 
> wrote:
>
> > Hello Tobias,
> > You should also have a look at the BLOO method, explained in this thread
> a
> > long time ago
> > http://music.columbia.edu/pipermail/music-dsp/2009-june/067853.html
> > That thread is quite long and the discussion pretty animated but you
> could
> > get some new ideas from the the paper of George at the link
> > http://s1gnals.blogspot.it/2008/12/bloo_6897.html and look for additonal
> > interpretations of in in the thread itself.
> >
> > Hope to have helped
> >
> > Marco
> >
> >> -Messaggio originale-
> >> Da: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-
> >> boun...@music.columbia.edu] Per conto di Tobias Münzer
> >> Inviato: martedì 25 febbraio 2014 15:54
> >> A: music-dsp@music.columbia.edu
> >> Oggetto: [music-dsp] Best way to do sine hard sync?
> >>
> >> Hi,
> >>
> >> I would like to implement a hard-synced sine oscillator in my synth and
> I
> > am
> >> wondering which is the best way to do so.
> >> I read the paper 'Generation of bandlimited sync transitions for sine
> >> waveforms' by Vadim Zavalishin which compares several approaches.
> >> Are there any better ways then the 'frequency shifting method' described
> > in
> >> the paper?  (Better in terms of less aliasing, faster,..)
> >>
> >> Thanks a lot
> >>
> >> Best Regards
> >> Tobias
> >> --
> >> dupswapdrop -- the music-dsp mailing list and website:
> >> subscription info, FAQ, source code archive, list archive, book reviews,
> > dsp
> >> links http://music.columbia.edu/cmc/music-dsp
> >> http://music.columbia.edu/mailman/listinfo/music-dsp
> >
> > --
> > dupswapdrop -- the music-dsp mailing list and website:
> > subscription info, FAQ, source code archive, list archive, book reviews,
> dsp links
> > http://music.columbia.edu/cmc/music-dsp
> > http://music.columbia.edu/mailman/listinfo/music-dsp
>
>
> --
> dupswapdrop -- the music-dsp mailing list and website:
> subscription info, FAQ, source code archive, list archive, book reviews,
> dsp links
> http://music.columbia.edu/cmc/music-dsp
> http://music.columbia.edu/mailman/listinfo/music-dsp
>
--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp


Re: [music-dsp] Best way to do sine hard sync?

2014-03-20 Thread David Lowenfels
FYI Emanuel Landeholm also had a cool method using windows to suppress 
aliasing. It sounded pretty good to my ear, though I never did any spectral 
measurements. It works with any slave oscillator waveform, including sine. I 
implemented it in PD with a Kaiser-Bessel window for an extra parameter of 
control.

http://music.columbia.edu/pipermail/music-dsp/2001-October/045626.html
http://dl.dropbox.com/u/285841/hardsync.tar.bz2

-David

On Mar 10, 2014, at 5:02 PM, Marco Lo Monaco  wrote:

> Hello Tobias,
> You should also have a look at the BLOO method, explained in this thread a
> long time ago
> http://music.columbia.edu/pipermail/music-dsp/2009-june/067853.html
> That thread is quite long and the discussion pretty animated but you could
> get some new ideas from the the paper of George at the link
> http://s1gnals.blogspot.it/2008/12/bloo_6897.html and look for additonal
> interpretations of in in the thread itself.
> 
> Hope to have helped
> 
> Marco
> 
>> -Messaggio originale-
>> Da: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-
>> boun...@music.columbia.edu] Per conto di Tobias Münzer
>> Inviato: martedì 25 febbraio 2014 15:54
>> A: music-dsp@music.columbia.edu
>> Oggetto: [music-dsp] Best way to do sine hard sync?
>> 
>> Hi,
>> 
>> I would like to implement a hard-synced sine oscillator in my synth and I
> am
>> wondering which is the best way to do so.
>> I read the paper 'Generation of bandlimited sync transitions for sine
>> waveforms' by Vadim Zavalishin which compares several approaches.
>> Are there any better ways then the 'frequency shifting method' described
> in
>> the paper?  (Better in terms of less aliasing, faster,..)
>> 
>> Thanks a lot
>> 
>> Best Regards
>> Tobias
>> --
>> dupswapdrop -- the music-dsp mailing list and website:
>> subscription info, FAQ, source code archive, list archive, book reviews,
> dsp
>> links http://music.columbia.edu/cmc/music-dsp
>> http://music.columbia.edu/mailman/listinfo/music-dsp
> 
> --
> dupswapdrop -- the music-dsp mailing list and website:
> subscription info, FAQ, source code archive, list archive, book reviews, dsp 
> links
> http://music.columbia.edu/cmc/music-dsp
> http://music.columbia.edu/mailman/listinfo/music-dsp



signature.asc
Description: Message signed with OpenPGP using GPGMail
--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp

Re: [music-dsp] Best way to do sine hard sync?

2014-02-27 Thread robert bristow-johnson

On 2/27/14 6:33 PM, Theo Verelst wrote:
Frequency modulation, which is what happens when the "to be synced 
with" signal changes from one frequency to another is theoretically 
not limited in bandwidth,


the issue is that, however you try to model it, the result of a 
hard-sync oscillator is still periodic, for a fixed frequency ratio, and 
quasi-periodic if that frequency ratio is swept.  that periodic function 
has harmonics that go on forever and we only need the ones that are 
below 10 to 20 kHz.



so that gives accruacy (aliasing) problems when the change is fast.


the aliasing problem isn't essentially about accuracy, as a property of 
the sample values coming out.  it is about harmonic overtones folding 
over to non-harmonic frequencies and sounding like digital dog 
excrement.  so the issue is how to not do that.  at least to some 
perceptual extent.  and this can be mitigated by somehow smoothing the 
"flyback" on the edges.  a "perfect" solution might have to be 
algorithmic or the use of a lot of wavetables (with a little bit of 
crossfading between them).


--

r b-j  r...@audioimagination.com

"Imagination is more important than knowledge."



--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp


Re: [music-dsp] Best way to do sine hard sync?

2014-02-27 Thread Theo Verelst


Thinking a bit about the theoretical generalities involved in the 
problem, it might be a good idea to imagine a few of the main "rules" in 
the sampling domain, with the problem of limited bandwidth.


To know the exact phase of a sine wave in the sample domain it is at 
least theoretically possible for instance to use proper sinc 
interpolation, or long averaging of positive and negative halves or 
something if you have a very long signal, and get good results, wthout 
having to deal with aliasing or additional difficulties.


Frequency modulation, which is what happens when the "to be synced with" 
signal changes from one frequency to another is theoretically not 
limited in bandwidth, so that gives accruacy (aliasing) problems when 
the change is fast. It could be there are mooth ways to define a sine 
wave going from frequency to another, by fading in and out, which is 
better behaved, but at any rate it pays to make an explicit model about 
what the input signal actually behaves like, what you (have to) do to 
bandwidth limit the input signal, and then explicitly chose for which 
approximation you chose, and preferably how many samples 9and 
computations !) it will take to get to the desired accuracy, or aliasing 
is going to make a big mess of error estimates and tracking stability 
guarantees.


Short resample filter with good bandwidth limiting aren't necessarily 
accurate for find accurate frequency (may take a long number of samples, 
or anyhow a longer sinc window). f course numerical stability for all 
input signal is important, but if there are many changes of the input 
signal in relative small number of samples, it may be necessary to use 
considerable upsampling to be a bit sure of the resulting accuracy.


Of course all kinds of definitions are possible to do amplitude, 
frequency and phase measurement, even for a sine sample with no DC 
errors. A pure sine wave which is given to be of fixed frequency and 
amplitude and perfectly equi-distant sampled with near infinite vertical 
resolution, can be perfectly reconstructed, and then amplitude, phase 
and frequency can be measured to any accuracy, so the phase at all 
samples and the (fixed) frequency *can* be know at any sample or even in 
between. So that's reassuring, no guesses or implicit accuracy 
considerations needed.


Without all too much perfect reconstruction, you could try out some sort 
of inversion where you use some form of iteration to estimate phase, 
amplitude, and frequency of a sine wave running through N samples, until 
you have a good idea how the test function A*sin(f*t+phi) can match some 
number of samples you've got as the given samples representing the sine 
wave to be measured. It might be you get multiple solutions, and I don't 
know if you can guarantee error bounds. It may work though, but of 
course as soon as the sine wave which needs to have it's frequency and 
phase synced to (maybe the amplitude is a given ?) starts to change, the 
iteration becomes harder (longer), and you need somehow to define 
another test function to fit through the found samples, and a transition 
morph from test function a to b (maybe you know the character of the 
phase changes).


Some heuristic way may sound easier, but it may fail! And of course you 
also need to figure out some way to make sure the phase/frequency 
detection doesn't mess up too bad in the face of an input signal with 
noise or errors, that may be hard, depending on what generates your 
input sine wave, to which you want to synchronize. It's much easier of 
you simply know the frequency, amplitude and phase of the input signal 
somehow, a sort of Phase Locked Loop in the digital domain is even 
trickier than in the analog domain, and might cost considerable delay 
(integration to make the loop stable in the long run) to do right.


T.




--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp


Re: [music-dsp] Best way to do sine hard sync?

2014-02-26 Thread gwenhwyfaer
On 26/02/2014, Risto Holopainen  wrote:
> Now, for my part, I find soft sync much more useful. I don't know what
> attempts there have been to do soft sync in digital oscillators, if anyone
> knows I'd be interested.

Nobody agrees on whether soft sync is "knock the waveform into
reverse" (the Alesis Ion did that, and within the limitations of
Alesis' sync implementation generally it did sound interesting) or
"only sync if the slave is within a threshold", which is what your
samples sound like (I don't know if any synth does that). But you'd
think both would be easy (once you've conquered the bandlimiting
problem) on a phase-accumulator based synth: the first example
negates the phase increment on sync; and the second only resets the
slave's phase if it's lower than the threshold (where both are
fractions), so turn the threshold up to 100% and it becomes hard sync.
But both require master and slave to have independent phase
accumulators, and as rbj mentions it's much easier in digital land to
simply derive the slave's phase straight from the master's.
--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp


Re: [music-dsp] Best way to do sine hard sync?

2014-02-26 Thread gwenhwyfaer
On 26/02/2014, robert bristow-johnson  wrote:
> the simplest thing, if you want the slave perfectly locked to the
> master, is to derive both master and slave phase from the very same
> phase accumulator.  there might be scaling and wrap around, but that
> should be easy.

I think that's how most VAs do it, isn't it? Especially the "hidden
master" variety (eg. Nova family, AN1x) - but maybe others? I only
know that  the Alesis family don't.

> for a slave doing a sine, i wonder what you would expect to hear as the
> master/slave frequency ratio changes.  while i have heard sync saws and
> sync squares, i don't think i ever heard a sync sine and it would seem
> to me to go from no harmonics to lotsa harmonics pretty abruptly.

Pretty much - and it limits the usefulness of sweeping it, because of
the "lumpiness" of the transition. I remember listening to a
comparison between the OB8's sawtooth sync and the Andromeda's
(someone was doing a comparative review) and noticing that lumpiness
in the A6 too - turns out that if you reset a sawtooth to its centre
point, it sounds lumpy when swept, whereas if you reset it to its most
negative point it sounds consistent and rippy and like hard sync is
*supposed* to sound. :) But it's still useful for adding new waveforms
to the analogue palette.
--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp


Re: [music-dsp] Best way to do sine hard sync?

2014-02-26 Thread gwenhwyfaer
I thought about that, but it's still wrong for every case but the
master and slave having a 1:1 frequency ratio. Hence the need to
multiply by the m:s ratio as well. (And of course, the slave should be
bandlimited according to its frequency; that pretty much goes without
saying. Which makes it all the more frustrating in the Fusion, because
its VA oscillators don't really alias much at all otherwise.)

On 26/02/2014, Tobias Münzer  wrote:
> Yes,
>
> an easy fix to avoid this kind of phase jitter is to add the fractional
> part of the master oscillator after the zero crossing to the slave.
> Basically: Do not reset the slave to zero, but to the fractional rest of
> the master.
>
> There is still a lot of aliasing if you don't band limit the transition
> thou...
>
> Am 26.02.2014 16:45, schrieb gwenhwyfaer:
>> On 26/02/2014, Risto Holopainen  wrote:
>>> When it comes to programming hard sync, I would use oversampling. I'm
>>> not
>>> saying that you should, I'm just lazy enough to do it the easy way.
>> You need to oversample a *lot* to chase away aliasing, though. The
>> Alesis Fusion - and its descendant, the M-Audio Venom, does the same -
>> does hard sync naively, by resetting the slave oscillator's phase to 0
>> every time the master crosses from negative to positive... only it
>> doesn't oversample at all and does the comparison on sample
>> boundaries, with the result that hard sync sounds *lousy* on the
>> Fusion. I've done a couple of experiments which appear to suggest that
>> the aliasing caused by this is *far* worse than that caused by not
>> bandlimiting the actual discontinuity - for example, by using a
>> "hidden master oscillator" (actually a fractional multiplier of the
>> phase counter) to read from a wavetable corrected only to the
>> frequency of the slave. In fact, you can bandlimit the discontinuity
>> as much as you please, and it'll *still* sound awful, because you're
>> essentially randomising the pitch of the oscillator. Worse, even if
>> your slave is running at exactly the same frequency as its master,
>> you'll STILL get random glitches in the sound as its phase is reset to
>> exactly 0 when the master's phase is some tiny fraction greater than
>> 0.
>>
>> And the sad thing is, there's no justification for it. In the Venom,
>> for example, you're always syncing to oscillator 1 - which means that
>> you know the frequency ratio between the two oscillators. Moreover,
>> you're syncing against a known waveform - which means you also know
>> when exactly that waveform will cross from negative to positive.
>> Therefore, when your slave detects that it did, rather than resetting
>> itself to 0, it can reset itself to the difference between the actual
>> phase of the master and the phase at which the master would have
>> crossed 0, multiplied by the slave:master frequency ratio. For
>> sawtooth and pulse waves, of course, that's particularly simple -
>> there's only one zero-crossing per cycle, and if you make sure that
>> zero-crossing is always at the point where the phase is 0, you can use
>> the carry of the master's phase accumulator to detect sync, then
>> multiply the master's current phase by the slave:master ratio and set
>> the slave's phase to that. And lo! - no more random-frequency-wibbling
>> alias. *Then* you can start worrying about how to bandlimit the
>> slave's phase.
>>
>> Sorry for going on at length about something that is surely obvious to
>> everyone else here (I know nowt about owt) but it really bugs me - and
>> clearly it wasn't obvious to Alesis when they designed the Fusion. And
>> in fairness, the Fusion could sync to itss noise generator or an
>> arbitrary signal coming into the audio inputs (can any other VA do
>> this? Nord Modular, perhaps?) at which point the naive approach is the
>> best you can do without either intepolating between input samples
>> (which needs division) or upping the input sample rate - but even so,
>> 99% of the time the Fusion is still syncing to another oscillator
>> whose frequency and waveform it necessarily knows. And there's just no
>> excuse for the Venom.
>>
>> *spent and tremulous, returns to hiding under desk*
>> --
>> dupswapdrop -- the music-dsp mailing list and website:
>> subscription info, FAQ, source code archive, list archive, book reviews,
>> dsp links
>> http://music.columbia.edu/cmc/music-dsp
>> http://music.columbia.edu/mailman/listinfo/music-dsp
>
> --
> dupswapdrop -- the music-dsp mailing list and website:
> subscription info, FAQ, source code archive, list archive, book reviews, dsp
> links
> http://music.columbia.edu/cmc/music-dsp
> http://music.columbia.edu/mailman/listinfo/music-dsp
>
--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp


Re: [music-dsp] Best way to do sine hard sync?

2014-02-26 Thread Tobias Münzer

robert bristow-johnson:


for a slave doing a sine, i wonder what you would expect to hear as 
the master/slave frequency ratio changes.  while i have heard sync 
saws and sync squares, i don't think i ever heard a sync sine and it 
would seem to me to go from no harmonics to lotsa harmonics pretty 
abruptly.  once all those harmonics are in, i wonder if it would 
matter much that the basic waveform was a sine or something else.


Pretty much. The transition is not as abrupt as one might think. And if 
the slave frequency is a multiple of the master you of course get a sine.
So it is a rise and fall of harmonic richness when sweeping the slave 
frequency.


There is a VST that implements sine hardsync .. it is unfortunately 
quite complicated to adjust the parameters, but maybe you can get an 
impression of the sound: http://www.krakli.com/krakli-cygnus/

--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp


Re: [music-dsp] Best way to do sine hard sync?

2014-02-26 Thread robert bristow-johnson

On 2/26/14 10:50 AM, Tobias Münzer wrote:


an easy fix to avoid this kind of phase jitter is to add the 
fractional part of the master oscillator after the zero crossing to 
the slave.
Basically: Do not reset the slave to zero, but to the fractional rest 
of the master.




the simplest thing, if you want the slave perfectly locked to the 
master, is to derive both master and slave phase from the very same 
phase accumulator.  there might be scaling and wrap around, but that 
should be easy.


for a slave doing a sine, i wonder what you would expect to hear as the 
master/slave frequency ratio changes.  while i have heard sync saws and 
sync squares, i don't think i ever heard a sync sine and it would seem 
to me to go from no harmonics to lotsa harmonics pretty abruptly.  once 
all those harmonics are in, i wonder if it would matter much that the 
basic waveform was a sine or something else.


--

r b-j  r...@audioimagination.com

"Imagination is more important than knowledge."



--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp


Re: [music-dsp] Best way to do sine hard sync?

2014-02-26 Thread Tobias Münzer

Yes,

an easy fix to avoid this kind of phase jitter is to add the fractional 
part of the master oscillator after the zero crossing to the slave.
Basically: Do not reset the slave to zero, but to the fractional rest of 
the master.


There is still a lot of aliasing if you don't band limit the transition 
thou...


Am 26.02.2014 16:45, schrieb gwenhwyfaer:

On 26/02/2014, Risto Holopainen  wrote:

When it comes to programming hard sync, I would use oversampling. I'm not
saying that you should, I'm just lazy enough to do it the easy way.

You need to oversample a *lot* to chase away aliasing, though. The
Alesis Fusion - and its descendant, the M-Audio Venom, does the same -
does hard sync naively, by resetting the slave oscillator's phase to 0
every time the master crosses from negative to positive... only it
doesn't oversample at all and does the comparison on sample
boundaries, with the result that hard sync sounds *lousy* on the
Fusion. I've done a couple of experiments which appear to suggest that
the aliasing caused by this is *far* worse than that caused by not
bandlimiting the actual discontinuity - for example, by using a
"hidden master oscillator" (actually a fractional multiplier of the
phase counter) to read from a wavetable corrected only to the
frequency of the slave. In fact, you can bandlimit the discontinuity
as much as you please, and it'll *still* sound awful, because you're
essentially randomising the pitch of the oscillator. Worse, even if
your slave is running at exactly the same frequency as its master,
you'll STILL get random glitches in the sound as its phase is reset to
exactly 0 when the master's phase is some tiny fraction greater than
0.

And the sad thing is, there's no justification for it. In the Venom,
for example, you're always syncing to oscillator 1 - which means that
you know the frequency ratio between the two oscillators. Moreover,
you're syncing against a known waveform - which means you also know
when exactly that waveform will cross from negative to positive.
Therefore, when your slave detects that it did, rather than resetting
itself to 0, it can reset itself to the difference between the actual
phase of the master and the phase at which the master would have
crossed 0, multiplied by the slave:master frequency ratio. For
sawtooth and pulse waves, of course, that's particularly simple -
there's only one zero-crossing per cycle, and if you make sure that
zero-crossing is always at the point where the phase is 0, you can use
the carry of the master's phase accumulator to detect sync, then
multiply the master's current phase by the slave:master ratio and set
the slave's phase to that. And lo! - no more random-frequency-wibbling
alias. *Then* you can start worrying about how to bandlimit the
slave's phase.

Sorry for going on at length about something that is surely obvious to
everyone else here (I know nowt about owt) but it really bugs me - and
clearly it wasn't obvious to Alesis when they designed the Fusion. And
in fairness, the Fusion could sync to itss noise generator or an
arbitrary signal coming into the audio inputs (can any other VA do
this? Nord Modular, perhaps?) at which point the naive approach is the
best you can do without either intepolating between input samples
(which needs division) or upping the input sample rate - but even so,
99% of the time the Fusion is still syncing to another oscillator
whose frequency and waveform it necessarily knows. And there's just no
excuse for the Venom.

*spent and tremulous, returns to hiding under desk*
--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp


--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp


Re: [music-dsp] Best way to do sine hard sync?

2014-02-26 Thread gwenhwyfaer
"bandlimit the slave's phase" -> "bandlimit the slave's output". oops.

and I do know how to spell interpolation, honest.
--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp


Re: [music-dsp] Best way to do sine hard sync?

2014-02-26 Thread gwenhwyfaer
On 26/02/2014, Risto Holopainen  wrote:
> When it comes to programming hard sync, I would use oversampling. I'm not
> saying that you should, I'm just lazy enough to do it the easy way.

You need to oversample a *lot* to chase away aliasing, though. The
Alesis Fusion - and its descendant, the M-Audio Venom, does the same -
does hard sync naively, by resetting the slave oscillator's phase to 0
every time the master crosses from negative to positive... only it
doesn't oversample at all and does the comparison on sample
boundaries, with the result that hard sync sounds *lousy* on the
Fusion. I've done a couple of experiments which appear to suggest that
the aliasing caused by this is *far* worse than that caused by not
bandlimiting the actual discontinuity - for example, by using a
"hidden master oscillator" (actually a fractional multiplier of the
phase counter) to read from a wavetable corrected only to the
frequency of the slave. In fact, you can bandlimit the discontinuity
as much as you please, and it'll *still* sound awful, because you're
essentially randomising the pitch of the oscillator. Worse, even if
your slave is running at exactly the same frequency as its master,
you'll STILL get random glitches in the sound as its phase is reset to
exactly 0 when the master's phase is some tiny fraction greater than
0.

And the sad thing is, there's no justification for it. In the Venom,
for example, you're always syncing to oscillator 1 - which means that
you know the frequency ratio between the two oscillators. Moreover,
you're syncing against a known waveform - which means you also know
when exactly that waveform will cross from negative to positive.
Therefore, when your slave detects that it did, rather than resetting
itself to 0, it can reset itself to the difference between the actual
phase of the master and the phase at which the master would have
crossed 0, multiplied by the slave:master frequency ratio. For
sawtooth and pulse waves, of course, that's particularly simple -
there's only one zero-crossing per cycle, and if you make sure that
zero-crossing is always at the point where the phase is 0, you can use
the carry of the master's phase accumulator to detect sync, then
multiply the master's current phase by the slave:master ratio and set
the slave's phase to that. And lo! - no more random-frequency-wibbling
alias. *Then* you can start worrying about how to bandlimit the
slave's phase.

Sorry for going on at length about something that is surely obvious to
everyone else here (I know nowt about owt) but it really bugs me - and
clearly it wasn't obvious to Alesis when they designed the Fusion. And
in fairness, the Fusion could sync to itss noise generator or an
arbitrary signal coming into the audio inputs (can any other VA do
this? Nord Modular, perhaps?) at which point the naive approach is the
best you can do without either intepolating between input samples
(which needs division) or upping the input sample rate - but even so,
99% of the time the Fusion is still syncing to another oscillator
whose frequency and waveform it necessarily knows. And there's just no
excuse for the Venom.

*spent and tremulous, returns to hiding under desk*
--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp


Re: [music-dsp] Best way to do sine hard sync?

2014-02-26 Thread Risto Holopainen
Here's some examples made with a eurorack modular. The master oscillator is the 
tiptop Z3000 and the slave is an intellijel rubicon. The sine output of the 
slave oscillator is always in the right channel and the modulating output of 
the master oscillator is in the left channel throughout.
1) a sweep of the master frequency while the slave remains 
fixed.http://ristoid.net/sndex/hardsync_master_sweep.wav
2) the slave oscillator is swept while the master is 
fixed.http://ristoid.net/sndex/hardsync_slave_sweep.wav
Now, for my part, I find soft sync much more useful. I don't know what attempts 
there have been to do soft sync in digital oscillators, if anyone knows I'd be 
interested.
So here are a few examples of soft sync with the same setup.
3) The difference here from the previous example is that the master's sawtooth 
output is used. Here the master frequency is swept 
again.http://ristoid.net/sndex/softsync_master_sweep.wav
4) Similarly with the slave frequency 
swept.http://ristoid.net/sndex/softsync_slave_sweep.wav
5) Finally, keeping both frequencies fixed, the amount of modulation is 
increased from none to maximum and back to nothing. 
http://ristoid.net/sndex/softsync_amount_sweep.wav
When it comes to programming hard sync, I would use oversampling. I'm not 
saying that you should, I'm just lazy enough to do it the easy way.


Risto Holopainen

> 
> I have an almost embarrassing question on this subject. Having lead far 
> too sheltered a life, I have never ~knowingly~ heard analog hard sync, 
> only this or that digital emulation; partly as I have never owned an 
> analog synth. So - is there an example file anywhere with the sampled 
> (with suitably ultra-high sr) waveform from an analog synth doing hard 
> sync? What does the real thing actually look like?
> 
> Richard Dobson
> 
  
--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp


Re: [music-dsp] Best way to do sine hard sync?

2014-02-26 Thread Richard Dobson
I have an almost embarrassing question on this subject. Having lead far 
too sheltered a life, I have never ~knowingly~ heard analog hard sync, 
only this or that digital emulation; partly as I have never owned an 
analog synth. So - is there an example file anywhere with the sampled 
(with suitably ultra-high sr) waveform from an analog synth doing hard 
sync? What does the real thing actually look like?


Richard Dobson


--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp


Re: [music-dsp] Best way to do sine hard sync?

2014-02-26 Thread Tobias Münzer

Hi thanks a lot for your answers,

25/02/2014 20:48, Ross Bencina wrote:
The approach that I am familiar with is the "corrective grains" 
approach (AKA BLIT/BLEP/BLAMP etc) where you basically run a 
granulator that generates grains that cancel the aliasing caused by 
the phase discontinuity. The exact grain needed is dependent on the 
derivatives of the signal (doable for sine waves). The original paper 
for this technique is Eli Brandt (2001), "Hard sync without aliasing", 
Proc. ICMC 2001.: http://www.cs.cmu.edu/~eli/L/icmc01/hardsync.html 


as far as I know the usual hard sync approaches (Blep, Blit, 
Miniblep) do not work for sine waves.
The reason is, that unlike saw or square waveforms that generate first 
order discontinuities when synced,
sine waveforms generate infinite order discontinuities. This is 
mentioned in Vadim Zavalishin (2009), "Generation of bandlimited sync 
transitionsfor sine waveforms".


If this is not true and there is a suitable 'grain' for sine waves, do 
you have any information on how to calculate it?



26/02/2014 10:02 Marco Lo Monaco wrote:

following Ross advice one of the drawback that you will have to deal is the
CPU usage at high master frequencies. Placing in an overlap and add fashion
a grain is very convenient at low freqs but not so much at high. More over
you will have to deal with some sort of DC offsets on the way (OLAdding the
minBLEP grain - which is min-phase and not zero-phase and you should
consider also some sort of look-ahead - with small hopsizes and maybe for
short times because you are under a frequency master modulation will result
in unpredictable offsets over your sin.
Unfortunately Eli Brandts does not face this problem in the paper.


Thanks for the advice I will keep this in mind

regards
Tobias

--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp


Re: [music-dsp] Best way to do sine hard sync?

2014-02-25 Thread robert bristow-johnson

On 2/25/14 2:48 PM, Ross Bencina wrote:

On 26/02/2014 2:25 AM, robert bristow-johnson wrote:

are you trying to do multiple cycles of the sine and then have a
discontinuity as it snaps back in sync with the side-chain waveform?  if
so, that doesn't sound very "bandlimited" to me.


As I understand it, the question is now to make such snap-back band 
limited.


so that's the same issue with regular saw-sync or square-sync, but with 
the sine instead.


The approach that I am familiar with is the "corrective grains" 
approach (AKA BLIT/BLEP/BLAMP etc) where you basically run a 
granulator that generates grains that cancel the aliasing caused by 
the phase discontinuity. The exact grain needed is dependent on the 
derivatives of the signal (doable for sine waves). The original paper 
for this technique is Eli Brandt (2001), "Hard sync without aliasing", 
Proc. ICMC 2001.: http://www.cs.cmu.edu/~eli/L/icmc01/hardsync.html


yup that was the BLIT stuff, i think, so a sawtooth is the integral if 
this BandLimited Impulse Train (with a little DC added).



I have not read Vadim's paper so I am not familiar with the alternatives.


you can, pretty cleanly, if you have a lotta memory available to the 
oscillator, have a family of curves that would replace the 2 or 4 
samples immediately adjacent and both sides of the beginning of the 
synced oscillator cycle.  you need a family of curves because the of the 
different states the sine wave would be in when you begin to "snap" the 
phase back.  if the curve tables have enough points, you can linearly 
interpolate.


if this was a synced saw, you would need only one "snapback" curve 
because the only difference, i think, would be just a scaler applied to 
curve depending on the state of the saw wave.


exactly what the curve (and siblings) would be, mathematically, is not 
something i will spell out.  we all get to purvey our own particular 
pixie dust (like some of us have for good old-fashioned bandlimited 
interpolation between samples that might be burned into a chip like an 
AD1890).


--

r b-j  r...@audioimagination.com

"Imagination is more important than knowledge."



--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp


Re: [music-dsp] Best way to do sine hard sync?

2014-02-25 Thread Ross Bencina

On 26/02/2014 2:25 AM, robert bristow-johnson wrote:

are you trying to do multiple cycles of the sine and then have a
discontinuity as it snaps back in sync with the side-chain waveform?  if
so, that doesn't sound very "bandlimited" to me.


As I understand it, the question is now to make such snap-back band limited.

The approach that I am familiar with is the "corrective grains" approach 
(AKA BLIT/BLEP/BLAMP etc) where you basically run a granulator that 
generates grains that cancel the aliasing caused by the phase 
discontinuity. The exact grain needed is dependent on the derivatives of 
the signal (doable for sine waves). The original paper for this 
technique is Eli Brandt (2001), "Hard sync without aliasing", Proc. ICMC 
2001.: http://www.cs.cmu.edu/~eli/L/icmc01/hardsync.html


I have not read Vadim's paper so I am not familiar with the alternatives.

Ross.
--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp


Re: [music-dsp] Best way to do sine hard sync?

2014-02-25 Thread robert bristow-johnson

On 2/25/14 9:53 AM, Tobias Münzer wrote:
I would like to implement a hard-synced sine oscillator in my synth 
and I am wondering which is the best way to do so.
I read the paper 'Generation of bandlimited sync transitions for sine 
waveforms' by Vadim Zavalishin which compares several approaches.
Are there any better ways then the 'frequency shifting method' 
described in the paper?  (Better in terms of less aliasing, faster,..)




is it another oscillator that you're syncing to?  or are you trying to 
sync to a general quasi-periodic waveform?


and then, how hard is the sync?  are you trying to do multiple cycles of 
the sine and then have a discontinuity as it snaps back in sync with the 
side-chain waveform?  if so, that doesn't sound very "bandlimited" to me.


in either case, i would use a simple wavetable and phase-accumulator for 
the sine wave oscillator.  and then derive the phase increment from the 
other waveform.  if the waveform is simple, or if it's another 
oscillator and you already have the specified frequency, then this 
should not be hard.  but if you *don't* have the parameters of the other 
waveform, you have to *get* them, and that sounds sorta like "pitch 
detection" to me.


so, is your synced sine oscillator running alongside of another 
oscillator that you, yourself are running?  or is it running alongside 
of an input waveform from somewhere else?




Thanks a lot


FWIW.

--

r b-j  r...@audioimagination.com

"Imagination is more important than knowledge."



--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp


[music-dsp] Best way to do sine hard sync?

2014-02-25 Thread Tobias Münzer

Hi,

I would like to implement a hard-synced sine oscillator in my synth and 
I am wondering which is the best way to do so.
I read the paper 'Generation of bandlimited sync transitions for sine 
waveforms' by Vadim Zavalishin which compares several approaches.
Are there any better ways then the 'frequency shifting method' described 
in the paper?  (Better in terms of less aliasing, faster,..)


Thanks a lot

Best Regards
Tobias
--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp