Irregular Sine Waves

For general discussion related FlowStone
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Irregular Sine Waves

Post by tulamide »

I wonder why there are adjustable square waves, where the center is moved around (like phase modulation of some sort)

Code: Select all

|  |  |
| |   |
|    ||


but no sine waves, adjustable in the same way? I can imagine this to be a rich sound if more than one oscillator is used.

Since time is constant in this scenario, I assume the gaps between two sample points vary according to some function, that is able to accept a varying factor. But I have no clue how to produce an oscillator from that.

Has anyone ever made something similar? Or is it just a stupid idea for reasons I don't see yet?
"There lies the dog buried" (German saying translated literally)
User avatar
nix
Posts: 817
Joined: Tue Jul 13, 2010 10:51 am

Re: Irregular Sine Waves

Post by nix »

It is quite easy with wavetables.
Just get the 2 sine halves 0-180, 180-360 and resample them in ratio as float arrays.
'resample float array' is the one.
(edit-you will need float array append to join the 2 halves together)

This is not modulatable though really sadly.

I'm curious to write osc algos. Sine is the only one I'm stuck on,
but it can be realised by low passing a triangle.

hmm, you've got me interested in trying this somehow- so it can be swept, too
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

Re: Irregular Sine Waves

Post by martinvicanek »

The equivalent to pulse width modulation of a square wave would be a synchronous phase modulation of a sine wave so that the valleys and crests get stretched (horizontally) in opposite directions, respectively. You can do that by feeding a fraction of the oscillator output back to its phase input. More variety is possible with some quadrature trickery.

Have fun. ;)
Attachments
Sine-ish.fsm
A demo of sine osc manipulations
(118.08 KiB) Downloaded 1027 times
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Irregular Sine Waves

Post by tulamide »

What can I say? Awesome as always, Martin!
I can already hear, just as I expected, that the sound characteristic changes distinctly. That will give some new options. I don't really understand what you mean by "quadrature trickery", but if that is something that doesn't cost you too much time, would you mind giving an example of that, too?

Oh, and what would be a good name for it? Pulse Width Modulation, or PWM, is known to the people, but would Sine Width Modulation, or SWM, really address the functionality of this? It would be more like half-cycle width modulation, or something, right?

EDIT: Oops, just read your answer again. So, "synchronous phase modulation", or SPM, would be the matching name?
"There lies the dog buried" (German saying translated literally)
BobF
Posts: 598
Joined: Mon Apr 20, 2015 9:54 pm

Re: Irregular Sine Waves

Post by BobF »

Hello gang,

Wow, now this is what I am talking about! Refferencing to "Crazy Ideas".
Cool tricks and tips stuff. Many thanks Martin, a very cool trick.

Later then, Bobf.....
User avatar
Spogg
Posts: 3368
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England
Contact:

Re: Irregular Sine Waves

Post by Spogg »

Guys!
I spent a couple of hours on this last night, also playing around with self-phase modulation (feedback) and also using a second synchronised oscillator for the modulation source with various waveforms. I got similar results to Martin but not what I understood tulamide was asking for.
Like nix I thought he was after something like zero-crossing modulation as per my very poor sketch below.

Martin's technique is found in the DX7 and my QX7 whereby feedback around 1 oscillator and env creates a wide range of harmonic variations. Maybe tulamide could clarify what he wanted...?

Cheers

Spogg
Attachments
zero crossing modulation.png
zero crossing modulation.png (23.31 KiB) Viewed 22826 times
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Irregular Sine Waves

Post by tulamide »

Hey Spogg,

you are absolutely right. What you sketched is what I oringinally looked for. And I would love to see that realized. But I also have fun with Martin's demo. So, if my original thoughts can't be realized, at least some alternative is available.

My thoughts began with the simple imagination of a sine wave, whose "center point" is moved away from the center. I can replicate this behaviour with my spline class for Ruby. But I couldn't find a formula for this. (See attached fsm)

You can't just reduce/increase the radius of the two half-circles, since the whole line from the top of the first half to the bottom of the second half is influenced.

So, yes, you are right. That's what I wondered about.
Attachments
sine_center_moved.fsm
(8.8 KiB) Downloaded 999 times
"There lies the dog buried" (German saying translated literally)
User avatar
nix
Posts: 817
Joined: Tue Jul 13, 2010 10:51 am

Re: Irregular Sine Waves

Post by nix »

hmm-
you can't do it by decreasing the radius,
but it can be done by changing frequency.
If you could write a half cycle, the correct freq change would make the desired form.
User avatar
Spogg
Posts: 3368
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England
Contact:

Re: Irregular Sine Waves

Post by Spogg »

One thing I tried last night was modulating the frequency (not phase) with a separate synchronised variable pulse width square wave oscillator.
I figured that by varying the mark/space ratio I could achieve the desired result. This kinda worked BUT the overall period changed with the m/s ratio. This is because the frequency control spent more/less time high than low as the m/s ratio deviated from 50/50. It might be possible to create some compensation for this but it would not be elegant.
Unless someone knows better...

I thought this was going to be easy when I read the OP but it ain't!

Cheers

Spogg
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Irregular Sine Waves

Post by KG_is_back »

I've also tried different approach... instead of modulating frequency/phase, I distorted the ramp-osc which was then driven into a sin1(x) function. I've made 2 versions.
first one simply changed the straight ramp into two lines, intersecting at y=0.5 and x specified by mod. Problem was, the resulting oscillator was not smooth on zero crossings.
Second version, I've changed the ramp into exponential function that crosses [0,0] [mod,0.5] [1,1]. The resulting oscillator was smooth in the center, but the transition from one period to next was not smooth.
Lastly I tried to make it smooth on both zero crossings, but after about an hour I rage-quitted and destroyed versions 1 and 2 in the process... :shock:
Post Reply