Hf Sine Osc Device

This device is a high frequency sine oscillator, enabeling you to modulate targets with theoretical frequencies up to 22050Hz, limited by SPL/TPL only. This thing is damn fast. That’s the reason why there are 2 sliders to control its speed. One for limiting the range and one for speed adjustment within the defined range. Beside that there’s also a depth controller for the paramter range.

I’m gonna setup more HF devices for other waveforms within the next days. Native FM synthesis, we’re on to you. :yeah:

Btw, this thing is synced to the Renoise tick counter. So, if you use it and adjust your BPM settings, TPL or whatever speed related, …

  
<?xml version="1.0" encoding="UTF-8"?>  
<filterdeviceclipboard doc_version="0"><br>
  <deviceslot type="FormulaMetaDevice"><br>
    <isactive>true</isactive><br>
    <isselected>true</isselected><br>
    <selectedpresetname>Init</selectedpresetname><br>
    <selectedpresetismodified>true</selectedpresetismodified><br>
    <ismaximized>true</ismaximized><br>
    <customdevicename>HF Sine Osc</customdevicename><br>
    <formulaparagraphs><br>
      <formulaparagraph>sinewave(22050*A*B, C)</formulaparagraph><br>
    </formulaparagraphs><br>
    <functionsparagraphs><br>
      <functionsparagraph>-- (c) 2012 by Norbert "Bit Arts" Röcher</functionsparagraph><br>
      <functionsparagraph></functionsparagraph><br>
      <functionsparagraph>function sinewave(freq, depth)</functionsparagraph><br>
      <functionsparagraph> i = TICKCOUNTER/TPL</functionsparagraph><br>
      <functionsparagraph> return (sin(i*freq/TPL*PI)*depth/2)+0.5</functionsparagraph><br>
      <functionsparagraph>end</functionsparagraph><br>
    </functionsparagraphs><br>
    <inputnamea>Range</inputnamea><br>
    <inputnameb>Frequency</inputnameb><br>
    <inputnamec>Depth</inputnamec><br>
    <editorvisible>true</editorvisible><br>
    <panelvisible>1</panelvisible><br>
    <inputa><br>
      <value>0.00999999978</value><br>
      <visualization>Mixer and Device</visualization><br>
    </inputa><br>
    <inputb><br>
      <value>0.0100001935</value><br>
      <visualization>Mixer and Device</visualization><br>
    </inputb><br>
    <inputc><br>
      <value>1.0</value><br>
      <visualization>Mixer and Device</visualization><br>
    </inputc><br>
    <desttrack><br>
      <value>-1</value><br>
      <visualization>Device only</visualization><br>
    </desttrack><br>
    <desteffect><br>
      <value>0.0</value><br>
      <visualization>Device only</visualization><br>
    </desteffect><br>
    <destparameter><br>
      <value>1.0</value><br>
      <visualization>Device only</visualization><br>
    </destparameter><br>
  </deviceslot><br>
</filterdeviceclipboard>  
  

woooT! 111!!eleven

thank ya.
i like this spirit.
motivational!

When I tried similar before, using with dblue’s Tuned Devices, I found the Formula Device didn’t output at a rate to give anything approaching clear waveforms at anything but very low frequencies (using quite similar maths to yours above.) Not near Renoise now but can you really use this to produce good waveforms with this method?

Well, at first I’m not looking for clear sounds. I’m looking for new (to Renoise) sounds. Of course native FM is not gonna sound like a DX7 and at no point I thought it would. To me everything that allows manipulation to create more sound, is a good manipulation. But I’m not aiming at faking Yamaha. :)

I do like your enthusiasm, Bit_Arts :)

But I’m not sure if this particular technique will work quite as well as you might hope. Let me share a few of my own thoughts and discoveries…

Like all other meta devices in Renoise, the Formula Device will only produce a unique output value once per tick. Therefore, the frequency of the output generated by the Formula Device is ultimately governed by the following factors: Ticks Per Line, Lines Per Beat and Beats Per Minute.

With TPL, LPB and BPM all set to their highest possible values (16, 256 and 999, respectively), the maximum theoretical ‘meta frequency’ (sampling rate, in other words) you can achieve is: 68198.4 Hz.

You can calculate this with the following formula:

  
lines_per_second = (beats_per_minute / 60) * lines_per_beat  
  
meta_frequency = lines_per_second * ticks_per_line  
  

If you intend to use this meta output as the basis for any kind of synthesis (driving a DC Offset device to generate a crude waveform, for example), then the highest tone frequency we can generate will be half that sampling rate, according to Nyquist–Shannon sampling theorem. Therefore, our maximum theoretical tone frequency is: 34099.2 Hz.

In reality, you will never get anywhere near this theoretical upper limit using Renoise’s own native devices (and I doubt any external plugins, for that matter), because pretty much every parameter you might want to control is going to be ramped (smoothed) in some way, even if it’s only by a very small amount. This smoothing acts as a kind of lowpass filter, and will greatly reduce the rate at which the parameter can respond to the changes being produced by this “HFO” concept. So while you may in fact be modulating the parameter with a very high frequency signal, it will not actually be able to respond fast enough to produce the kind of high resolution result you desire.

Using the DC Offset device as a synthesis method is a perfect example of this. The DC Offset parameter is smoothed in order to avoid clicks/pops in the output produced by very rapid changes. You can actually modulate this parameter at low frequencies and produce a variety of waveforms this way, but you will quickly run into a speed limit where the output simply becomes quite useless. Essentially, you reach a point where you’re sending parameter changes faster than the actual parameter smoothing can respond, and then it just sort of turns into a blurry, muddy, indistinct mess.

Nevertheless, if you work within some more realistic (ie. lower) frequency limits, then it’s still absolutely possible to do some pretty damn interesting stuff here! You can still definitely modulate DSP parameters to make them do really weird things, to take advantage of strange artifacts and other behavioural quirks, etc.

But using this stuff for complex, real-time synthesis… well, Renoise’s DSP chain and meta devices were simply never designed with this type of usage in mind. You can achieve some technically interesting results, but you will not really be able to directly synthesize complex waveforms this way.

So for now, if you want to explore FM(ish) synthesis, then combining/mixing multiple RingMod devices is probably the best approach in my opinion.

Going back to your original post…

Here’s a forumula (ie. to plug directly into the Formula Device) that you’ll hopefully find useful. It will output a sinewave at the desired frequency (while your song is playing), regardless of your song’s TPL/LPB/BPM settings. Input “A” is assumed to be the Frequency (I’ve scaled mine down to a max of 11025 Hz, but you can tweak this to your liking). Obviously higher TPL/LPB/BPM will produce higher resolution results, but this formula is basically independent of those settings and should behave roughly the same way no matter what.

  
Formula tab:  
((sin((((SAMPLES * (A * 11025)) % SRATE ) / SRATE) * TWOPI) + 1) * 0.5)  
  
User tab:  
(no custom functions)  
  

Or here’s the complete DSP device XML if you want to copy/paste into your chain:

  
<?xml version="1.0" encoding="UTF-8"?>  
<filterdeviceclipboard doc_version="0"><br>
  <deviceslot type="FormulaMetaDevice"><br>
    <isactive>true</isactive><br>
    <isselected>true</isselected><br>
    <selectedpresetname>Oscillator</selectedpresetname><br>
    <selectedpresetismodified>true</selectedpresetismodified><br>
    <ismaximized>true</ismaximized><br>
    <customdevicename>Oscillator</customdevicename><br>
    <formulaparagraphs><br>
      <formulaparagraph>((sin((((SAMPLES * (A * 11025)) % SRATE ) / SRATE) * TWOPI) + 1) * 0.5)</formulaparagraph><br>
    </formulaparagraphs><br>
    <functionsparagraphs><br>
      <functionsparagraph></functionsparagraph><br>
    </functionsparagraphs><br>
    <inputnamea>Frequency</inputnamea><br>
    <inputnameb>-</inputnameb><br>
    <inputnamec>-</inputnamec><br>
    <editorvisible>true</editorvisible><br>
    <panelvisible>0</panelvisible><br>
    <inputa><br>
      <value>0.5</value><br>
      <visualization>Mixer and Device</visualization><br>
    </inputa><br>
    <inputb><br>
      <value>0.0</value><br>
      <visualization>Mixer and Device</visualization><br>
    </inputb><br>
    <inputc><br>
      <value>0.0</value><br>
      <visualization>Mixer and Device</visualization><br>
    </inputc><br>
    <desttrack><br>
      <value>-1</value><br>
      <visualization>Device only</visualization><br>
    </desttrack><br>
    <desteffect><br>
      <value>-1</value><br>
      <visualization>Device only</visualization><br>
    </desteffect><br>
    <destparameter><br>
      <value>-1</value><br>
      <visualization>Device only</visualization><br>
    </destparameter><br>
  </deviceslot><br>
</filterdeviceclipboard>  
  

@dblue

Of course I’m aware of the fact that the TPL/LPB are drastically limiting any approach for native FM. The point is, the method of FM allows us to manipulate the very basic soundgenerator we have (and which actually not even is thought as a soundgenerator) and make it sound less basic, even if it doesn’t end up in sample accurate results. Who cares? I don’t. :) It’d be easy to just throw some VST in and the “problem” is no longer any. To me the biggest challenge with Renoise is, to make the most out of the least. And, beside all the lacks I regularly like to rant about, Renoise provides some also basic, but very unique and clever tools for that. So, I personally don’t care much about the technical details. Because it doesn’t change a thing, if I know in advance, what it’s not gonna sound like. I want to know, what CAN it sound like. :) At this point don’t get me wrong. This is in no way related to your post. I highly appreciate your infos and provided knowledge. It’s just the way I personally think about things, when I’m going to do a Renoise setup. I am a caveman, making things out of stone, wood and stuff, sitting in my cave and enjoying this crap. :D So, if people are waiting for something that sounds like clear and glassy FM sound, it’s not gonna happen. Cavemen never built a DX7. :D But if people are just curious about what the neadnertal carries next out of the cave, they’re very welcome. :)

A big thanks for the provided formula. :) I also really like the idea of direct modulation. You know, I could code a CMS, database stuff and crap, but I’m not a math coder. Not yet. ;) I guess till 2 days ago I’ve done my latest sine calculation more than 25 years ago. :D My first attempt was also related to the sample counter. I skipped this, because it broke the sine calculation, everytime the pattern was looped. Of course it did. Meanwhile I realized, the sample counter just started over. :-S Talk about cavemen… Anyway, LUA seems to be pretty easy, so I guess I’m gonna get used a bit more to the Renoise internals soon. As you might have noticed, I’m in hyperactive mode atm. ;)

Thanks again for your effort. Highly appreciated! :)

Wicked.

Just had some great fun with this. Really love this direction!

yes, I was also curious about the DC OFFSET sound, I’ve made some previous tests with it :

All those tests require very high LPB/BPM resolutions. Let’s say it : it’s not easy to work within those resolutions, it will often put your CPU on its knees.

@dblue: wow. thanks for a really good explanation. i actually get what you’re saying, in contrast to some of your other technical posts where it just made my head hurt :)

@bit_arts: i love your caveman-analogy :D
just a tip: if you feel like you need to brush up your math-skills (i know i do), take a look at KhanAcademy. it starts out really basic with 1+1 etc, but i’m already down to multiplying/dividing exponents and whatnot. i believe it takes educates up to college level, which is pretty cool imo.

^ copy the XML-code, paste it into the Renoise DSP-chain.