Please familiarise yourself with the forum, including policy on feature requests, rules & guidelines

Using wavetables for granular synthesis on the Deluge

6
DoorDoor GermanyBeta Tester Posts: 6

Introduction

Granular synthesis is one of my favorite sound design techniques and something that I have been missing on the Deluge. Back in February, user @Heptagen posted this guide, which gives you the classic granular sound but at the cost of having to keep open the WAVEFORM menu in order to make real time adjustments. With the new wavetable functionality that has blessed the Deluge in the latest firmware update, there is now another, albeit more hacky, way to achieve granular synthesis.

I am including demo patches with this post, if you want to follow along, you can download them and put them onto your Deluge. :)

How does it work?

The basic idea is simple:
1. Take any audio sample the Deluge can read (i.e. WAV or AIFF file, must be mono)
2. Load it into an oscillator as a wavetable
3. Pitch down the oscillator three to six octaves

If you play a note, you will notice that a very short piece of the initial audio file is being looped. You can control which part of the audio file is being looped by adjusting the oscillator's WAVETABLE control. Higher values mean the oscillator loops a part from further into the sample. This is illustrated with demo patch 1. The source audio is a plain synth sound playing an ascending C major scale. Notice that the pitch increases as you turn up the wavetable control (CUSTOM 2).

Et voila! Technically, this is granular synthesis: There's a short window of a sample (a grain) being constantly repeated, and you can slide the window over the whole sample. A more musical example is given in demo patch 2; here the source audio is a Rhodes sample I recorded. However, there is an annoying clicking sound to be heard and the individual grains are very short. In order to work around these issues, we have to dig a little bit deeper.

Wavetables on the Deluge: Technical Background

Wavetables are typically stored as .wav files. Many readily available wavetables, including all those created using the wavetable utility in Xfer's Serum VST plugin, contain a special 'clm' (cycle length marker?) tag in their metadata. The 'clm' tag defines how many samples of the .wav file make up one cycle (= one slice of the wavetable = one grain). The most common cycle length is 2048, but Rohan has mentioned that the Deluge should be able to deal with any cycle length greater than 8. (I will get to that later.)

If you open a wavetable file in a hex editor (I use HxD on Windows 11) and take a look at the file header, you can observe the 'clm' tag between the 'fmt' segment (which I believe specifies how the audio data is encoded) and the 'data' segment (which stores the actual audio data). It looks like this:


Notice the part that says <!>2048.

However, the Deluge will also happily interpret any mono WAV or AIFF file as a wavetable. In this case, a cycle length of 2048 is assumed. This means that the grain size in our demo patches above was also 2048 samples. If we assume a sample rate of 44.1kHz, which means the grain plays at the same pitch that the sample was recorded at, this is around 46 milliseconds! No wonder the grain size appeared very short.

Increasing the grain size

In the above paragraph, we learnt that the grain size of our granular synthesis approach corresponds to the cycle length of the wavetable and that the cycle length is usually stored in the file header of the wavetable .wav file. If we wanted to change the cycle length (grain size) of a .wav file which already has a 'clm' tag, we could just change the number inside of the tag. For "ordinary" .wav files which do not yet have a 'clm' tag, you can create one either by copying one from an already existing wavetable or from the clmtag.bin file I have attached to this post. Here are a few things to consider:
1. The length of the tag seems to matter (38 bytes), the exact content doesn't. You can overwrite the "wavetable (www.xferrecords.com) part with any text without corrupting the file, but as soon as you add or delete a symbol from the tag neither the deluge nor any conventional audio players will read the edited file.
2. Make sure to paste the tag right before the 'data' segment, otherwise you might overwrite the 'fmt' tag which could lead to some very loud unpleasant surprises.

Here you can see a 'clm' tag that I added into a .wav file created in Cubase.

If you take a closer look, you can see that I set the cycle length to 8192 samples, that is 4 times as long as above or about 230 milliseconds. My deluge reads this file without issue and I end up with a grain size of around 230 milliseconds (if the grain is played back at recording speed), which is much more usable than the 46 milliseconds above. Check out demo patches 3 and 4 for examples.

Current limitations and shortcomings

As powerful as I believe this technique to be, there are currently some limitations to the method.

  • The maximal cycle length the deluge seems to accept is 8192 samples. I've tried with 8193 and upon loading the sample as a wavetable the Deluge tells me he "CANT". Maybe @rohan (hope it's ok to tag you) can pitch in and shed some light on how the Deluge handles reading the 'clm' tag and if this restriction could be removed in the future to make longer grains possible. A possible workaround is speeding the sample up before adding the 'clm' tag and pitching it further down on the Deluge, but by the sampling theorem the grains lose high frequency content in this process.
  • There is still a clicking noise whenever a grain is looped. This can be alleviated by strategically adding small fade-ins and fade-outs to the grain windows.

What's left to do

  • On the technical side: I want to write up a small python script that automatically adds the 'clm' tag as well as fades to prevent clicking to any input file.
  • On the creative side: Lots of experimentation! I already have around a thousand ideas of what this technique could be used for and I'm excited for any input from the community. I want to shoot a few videos on this topic too.

Conclusion

I hope I could successfully demonstrate how to do granular synthesis on the Deluge. I believe this is an incredibly powerful technique which will push the limits of what is possible with this machine even further.

If you want a proper musical demo, here's an ambient track I created using the technique. Otherwise, I encourage you to play with the demo patches and try your own samples!

Cheers :)
Finn

Comments

  • 0
    cube48cube48 EUBeta Tester Posts: 24

    Nice find! Keep hacking it! And thanks for sharing!

  • 0
    hamptoniohamptonio Posts: 23

    I'd be curious to see your python script - I make a lot of sounds for the Deluge with python, but I haven't used any for wavetables yet.

  • 0
    staubistaubi Erlangen/GermanyBeta Tester Posts: 62

    That's a great find! I love these kind of dirty hacks.

    Brass side of life: JTK

  • 0
    DoorDoor GermanyBeta Tester Posts: 6

    Thanks for the feedback, everyone! I just got back to this post and it appears like the moderation has removed the patches I included. I'm going to open a GitHub repo in the next few days where I will include the patches as well as my current python codebase.

  • 1
    drbourbondrbourbon ItalyBeta Tester Posts: 55

    @Door said:
    Thanks for the feedback, everyone! I just got back to this post and it appears like the moderation has removed the patches I included. I'm going to open a GitHub repo in the next few days where I will include the patches as well as my current python codebase.

    Please feel free to use my delugist github indexer if you like: https://delugist.neuma.studio/help
    (basically you push a deluge sd card as github repo and delugist makes its content easily searchable)

Sign In or Register to comment.