[sdiy] Innovative Oscillator Design (or not ?)

brianw brianw at audiobanshee.com
Thu Apr 11 07:16:02 CEST 2024


If the pin labeled INT is actually a CAPTURE input, not an interrupt, and connects to a separate timer that can measure period, then it will work as you describe. It will have to be a separate timer because the same timer cannot both generate a frequency and measure an external frequency. Fortunately, many modern MCU chips have several timers.

Brian


On Apr 10, 2024, at 7:52 PM, M J Bauer wrote:
> Thanks Brian for your response. Interrupt latency would not be an issue in this scheme. The MCU timer/counter hardware acts autonomously, either in input capture mode (to measure the wave period), or in output compare mode (to control the wave period).
> 
> MJB
> 
> On 11/04/2024 12:39 pm, brianw wrote:
>> One deficiency that nobody has mentioned is the INT (interrupt) input for your MCU. Interrupt latency may be large, compared to the frequency, and there will surely be jitter in the interrupt response time. Thus, the MCU may not be able to adjust until long after the flip-flop has been set. This will be particularly bad for higher frequencies. Measurements based on interrupts will not be very accurate.
>> 
>> Brian
>> 
>> On Apr 10, 2024, at 6:13 PM, M J Bauer wrote:
>>> Thanks, Roman. You and other correspondents have convinced me that my initial approach was flawed and would most likely result in some sort of unwanted audible artifact. (The initial approach was that the firmware would adjust the PWM duty dynamically, cycle by cycle.) 
>>> 
>>> René advised that some other DCO designs (also using an analog integrator) achieve pitch accuracy using a precision timer/counter to set the output wave period. The integrator charge/discharge rates are set using a DAC controlled current source. The accuracy of the current source is not as critical, but the error results in (minor) errors in the output signal amplitude. The amplitude error is not problematic.
>>> 
>>> Hence, my revised approach is to use a 16-bit timer/counter in the MCU to set the output wave period. The integrator charge/discharge rates will still be set using the PWM scheme, but the integrator will be reset at the end of each period. I have not yet done the calculations to determine the range of frequency over which this scheme would give adequate pitch accuracy for musical purposes, but my intuition tells me it will be acceptable... perhaps 3 octaves.
>>> 
>>> I don't care if anyone has already patented this idea... I'm just experimenting for my own amusement. To commercialize an idea, you need to be very wealthy, very brave, very bold or very delusional... preferably all of the above!
>>> 
>>> MJB
>>> 
>>> On 10/04/2024 6:48 pm, Roman Sowa wrote:
>>>> I agree that "not give enough detail" is the key here, although your idea was clearly described in the document. It said even 40kHz PWM if I'm not mistaken. But regardless of PWM frequency, there is also its resolution. You wanted cheap micros with 8 bit PWM. You could even make 10bit PWM above audio with small PIC. So assuming top frequency of 10kHz, the lowest PWM = 1/1024 only gets as low as 9.77Hz. One PWM step more and we have 2/1024, that is one octave higher. So that was my concern about unusable resolution at low end. 
>>>> 
>>>> Now you're telling that planned range is only 4 octaves. Then yes, this might work with 10-bit PWM, but still it will not sound clean but FM modulated at low end, because PWM has to be adjusted every few cycles. 
>>>> 
>>>> You could add octave range resistors from Vref with a MUX in the integrator, so each octave has better resolution of pitch. 
>>>> 
>>>> And I dare to dissagree with your intuition - those steps will be audible, and not as harmonic distortion, but as aliasing whistles. Not very loud probably, but will be there. Like aliasing from short wavetable DDS with no interpolation. 
>>>> 
>>>> Of course I encourage you to build it, that concept is interesting and I'm sure many people will enjoy seeing the results. 
>>>> 
>>>> Roman 
>>>> 
>>>> W dniu 2024-04-10 o 03:32: 
>>>>> Hello Roman, 
>>>>> 
>>>>> Thanks for your thoughtful reply. 
>>>>> 
>>>>> You may be correct with some of your criticisms, but I think perhaps I did not give enough detail about the role of the MCU firmware, leading you to some false assumptions. The firmware would not need to make "huge corrections from cycle to cycle"... just very minor corrections. The "steps" that you referred to are at the PWM carrier frequency (16kHz minimum), so they would not be audible. Sure, there would be some timing "jitter" in the output signal, but my intuition tells me it would be negligible... like harmonic distortion. Anyhow, I guess there's only one way to find out... I must build the thing and prove the concept. Also I am not expecting to achieve a 10kHz range. I would be happy if it worked over a 4 octave range with musical precision. 
>>>>> 
>>>>> Thanks also for your suggestion about using a sigma-delta DAC. I will look into this idea. There is also the possibility to use a digital-to-resistance type DAC, but an objective was to minimize external components. 
>>>>> 
>>>>> Kind regards, 
>>>>> MJB 
>>>>> 
>>>>> On 9/04/2024 6:42 pm, Roman Sowa wrote: 
>>>>>> This is not doable with simple PWM. You talk about closed loop control, but then it will have to make huge corrections from cycle to cycle, leading to blurry, modulated waveform. Assuming 10kHz range, the low end using 8-bit PWM is like 40Hz, and next step is one octave higher. To make it work you have to constantly measure the VCO output voltage and not just the cycle period and adjust PWM multiple times during single slope. 
>>>>>> The slopes of the triangle will not be smooth anyway, but steppy. The steps will have the slope the same as the highest frequency triangle, that is when PWM is at 100%. 
>>>>>> PWM frequency is independent of VCO frequency, so at some frequencies you might expect intermodulation that will blend all over audio band. 
>>>>>> 
>>>>>> Interesting idea and I don't hink I have ever seen it, although it highly resembles switched capacitor filter. Who knows, maybe there is a way to use commercially available switched cap filter ICs to work as VCO. But IMHO there is a lot more other simpler options to make VCO. 
>>>>>> 
>>>>>> How about using common $2 Sigma-Delta DAC to control the integrator switch? It makes it so much easier. Wide range precise control of 24 bits, every note is kept stable with single write to the DAC. The MCU only writes the DAC on pitch change, and possibly check tuning from time to time but it will not drift at all if you use proper integrator parts. 
>>>>>> 
>>>>>> Roman 
>>>>>> 
>>>>>> W dniu 2024-04-09 o 08:52, M J Bauer pisze: 
>>>>>>> Attn: Synth-DIY community... 
>>>>>>> 
>>>>>>> A while back (2022), I had an idea for an oscillator design which could be used in modular or hybrid synth's, but I have not yet tested the concept. The oscillator may be digitally controlled or voltage controlled, or both at once. I'm not sure if this technique has already been tried and proven. I haven't seen any evidence of it, so I would be grateful if anyone with a greater knowledge of the art can tell me if this is a novel idea, or a concept that has appeared before. (See attached summary.) 
>>>>>>> 
>>>>>>> M.J. Bauer 




More information about the Synth-diy mailing list