Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

HardSync FM problem

DSP related issues, mathematics, processing and techniques

HardSync FM problem

Postby adamszabo » Sat Jul 27, 2019 3:04 pm

Hey Guys,

I had a specific issue for a project a while back, and completely forgot about it. Now I found it again, and I still cannot solve it, so I thought maybe someone here can give me a hand.

Basically I have a hard syncable ramp, but I would like to frequency modulate it as well. Now, everything works fine, until you move the "Phase1" knob, and you can see that the first cycle of the ramp with the FM gets totally messed up and starts changing. The rest of the cycles of the ramp are fine. If I turn down the FM knob, then I can move the Phase1 knob fine and it works. I tried so many things I have no idea what else to do, maybe someone can give me some clever tricks or ideas, or maybe my code is wrong?

Thanks!
Attachments
hardSync_prob_adam.fsm
(37.8 KiB) Downloaded 1408 times
adamszabo
 
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Re: HardSync FM problem

Postby Duckett » Sun Jul 28, 2019 9:27 am

While I am the knowledge-equivalent of an eager puppy when it comes to audio DSP, I can see that with FM cranked up, changing Phase2 affects all cycles, while changing Phase1 affects only the first cycle (unless at min or max of course)... I changed the scope's "samples to show" to 1012 in order to look at 6 cycles, and while there is some subtle periodicity that's longer than 1 cycle (depending on Phase2 and FM settings), you're right, there's no creep towards asymmetry. Unless there's a way to apply the FM before Phase1 (which I'm definitely too ignorant to know if that's even possible), I'm not sure there would be a trick that lets you circumvent the issue; any value other than 0 or 1 for the 1st cycle, in the way the schematic is set up, means it's not to going to ever match the rest of the cycles with FM applied. I hope a smart person answers this with something actually useful ;)
We have to train ourselves so that we can improvise on anything... a bird, a sock, a fuming beaker! This, too, can be music. Anything can be music. -Biff Debris
User avatar
Duckett
 
Posts: 132
Joined: Mon Dec 14, 2015 12:39 am

Re: HardSync FM problem

Postby Spogg » Mon Jul 29, 2019 10:17 am

Fascinating issue!

The problem with the first cycle is the incorrect initialisation of Osc2Delta to zero.

I’ve modified the schematic to demonstrate a way towards a solution.

However, since only the very first cycle is messed up, and after that the variable is corrected, does it really matter for an actual synth?

Cheers

Spogg
Attachments
hardSync_prob_adam -Spogged.fsm
(170.14 KiB) Downloaded 1374 times
User avatar
Spogg
 
Posts: 3358
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England

Re: HardSync FM problem

Postby adamszabo » Mon Jul 29, 2019 9:18 pm

Thanks Spogg for that solution, I tried this before, however if I move the Phase1 knob the first cycle still gets messed up. I have to manually fix the initalization value for every phase 1 value. However the Phase1 will be a random number which I dont know what it will be, so the init fix knob should do some math to compensate. Unfortunately in a synth this causes problems because the first cycle will sound different from the rest and it will be perceived as a nasty click sound, which is unwanted.
adamszabo
 
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Re: HardSync FM problem

Postby Spogg » Tue Jul 30, 2019 7:45 am

Yes indeed, you need to derive an initial value every time a new note is played. The knob was just a proof of concept rather than a solution itself. The value needed always fell between 0 and 1. Sorry if that wasn’t clear Adam.

I did try to find a formula to calculate the init value, and I feel certain it’s possible, but the maths was beyond me I’m afraid. It may involve a simultaneous equation or something. As far as I could see there are two variables involved; phase1 and FM level. I bet trigonometry is involved somehow and I reckon someone here is capable of sorting it for you. I would really like to see the answer and, if possible, how it was arrived at. That would be great teamwork!

Having thought more about my comment regarding real-world synth use, I now agree that it would be unacceptable in certain situations. For a bass note at 20Hz, with an instant attack, you could have a click of some sort lasting up to 50mS which would be audible so not good.

Cheers

Spogg
User avatar
Spogg
 
Posts: 3358
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England

Re: HardSync FM problem

Postby tulamide » Sat Aug 03, 2019 1:27 pm

The current point I'm at: To calculate the correct phase shift (Spogg's manual value), we need the integral of the modulator (not the modulated signal).

I never had much to do with Analysis, where Integral comes from. But it seems it is the area below the signal between two points a and b. An Integral below the signal along the x-axis will always be negative, but that doesn't matter, since phase is a circular value (and therefore phase shift as well).

0.9 and -0.1 express the same position (0 to 1 normalized)

However, the very special formulas are like a foreign language to me, that I never heard before. Given that a and b are the same spot (the momentary sample), it should be something along the lines of carrier - modulator and then some sin or cos calculation to get the circular phase shift.

I post this status update just in case, somebody reads this and remembers the real way to calculate it based on some mentioned keywords.
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: HardSync FM problem

Postby adamszabo » Sat Aug 03, 2019 3:49 pm

Thanks Tom, for the detailed explanation. You have gotten further than me, this integration is beyond my skills at the moment.
adamszabo
 
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Re: HardSync FM problem

Postby martinvicanek » Sat Aug 03, 2019 5:36 pm

In order to determine the initial phase, you could work your way back from the first sync point to the starting point. Not sure if that is possible in poly though.
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Re: HardSync FM problem

Postby adamszabo » Sat Aug 03, 2019 5:45 pm

Hmm interesting, I think that might work, however I not sure I follow. What exactly do you mean "from the first sync point to the starting point."?
adamszabo
 
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Re: HardSync FM problem

Postby martinvicanek » Sat Aug 03, 2019 6:45 pm

Ignore my last post.
What you can do is simulate one full cycle. Then you know at each instant the amplitudes and phases, and you can take those values to initiate the real oscillator.
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Next

Return to DSP

Who is online

Users browsing this forum: No registered users and 28 guests