Thanks Christoph. Obviously I still have a lot of exploring to do in HISE. And I haven't even touched scripting yet.
Also, opening up the wavetable oscillator for end user configuration would be nice.
It would be nice to open up the ability to add our own wavetables.
Yes, this will be done at some point in the future (there are just that many hours a day)...
In the meantime, we could talk about some sort of Wavetable standard (I am not aware of anything preexisting). I think having a defined standard so that you can prepare your wavetables and just load a single audio file that will be split into the cycles depending on a few parameters might be the most practical solution (you don't want to fiddle around with mapping on a wavetable synth).
The current wavetable synthesiser works like this:
- chromatic wavetables with the rounded length of samples (currently hardcoded to 48kHz, so that eg. D2 refers to a sample length of 327 samples).
- 64 wavetables per note, that can be morphed using the table index modulation chain.
- currently starting only from D2 to I think A7 (the note range of the clarinet).
So I think the three parameters that are required are
- sample rate
- "velocities" per note
- start note / end note (missing notes on either end will be created by interpolation).
- note step size (a step size of 1 means chromatically "sampled" wavetables, a step size of three every minor third and so on)
With this system, it should be possible to use the current wavetable synth code to make a generic synthesiser without having to rewrite everything. The creation of the wavetables are up to the user (but with things like clever REAPER scripting or even some helper tool), it might be practical.
Well since I do have a few Wavetable synths on the market, I would say that the standard is to a single cycle with a Factor of 2 (4096). Every software on the market uses this standard, i.e. Serum, Falcon, MachFive, and all of the big ones. The issue with this standard is that no one has the algorithm to convert a single cycle into a 4096 sample. Then they do band-limiting. Here is pretty much the standard code here: http://www.earlevel.com/main/category/digital-audio/oscillators/wavetable-oscillators/.
Although Chris' method will yield better sounds and results, it is not the standard as far as wavetables go.
Hey @Christoph-Hart. I like your method for wavetables better as it is more detailed. One thing I'm curious about is how to slice the samples? There needs to be a script that already detects the Root Key (MIDI Base Note) and automatically slice the wave.
- Need something to crossfade the edges so you don't hear the popping
- It would seem that rounding the sample length would lead to not the exact pitch as some sounds are not on an exact sample length.
- Are these single cycled?
This is not so easy. Just looping a single cycle from a waveform will produce nasty harmonics because of discontinuities at the loop point (also noise will transform into harmonic content, because it's not "noise" anymore but a periodically looped waveform). Crossfading does help a bit but it washes up the actual harmonic content.
What you need to do is to resynthesises the spectrum by analysizing the audio data with FFT and rebuild it by adding harmonic sine waves with the calculated amplitude levels. I've done this a few years ago with an MaxMSP patch, but I can imagine there are some tools available today that do this for you.
I took a look at this again and I think your wavetable model will be actually really good. There are a couple of things that I have issues/suggestions with:
What do you mean by: "start note / end note (missing notes on either end will be created by interpolation)." - Are you referring to the lowest Note and the Highest note
You need to go much lower than D2 for awavetables. It is noted that the lowest notes provide more of the harmonics of the sound. The Serum manual says: "Serum's manual says to rip waveforms at 2048 samples, which is F-1 -22 cents, so so tune the synth's oscillator to -22 cents and record a note at F-1"
The audio file that is being split into cycles...Is this a script already written?
- Yes. Using this method, you can create an X-Y map of wavetables (the x-axis is the note range and the y-axis can be used for whatever modulation you need, envelopes, velocities, you name it).
- The note range is arbitrary and can be set using the start note / end note property. Low notes obviously contain more harmonic material (since the distance to the Nyquist frequency is higher), but you need to apply band limiting to them if you try to repitch them for higher frequencies. The beauty of my approach is that you can apply a superior resampling algorithm (like 512 sinc interpolation) to create higher wavetables and then use the cheap linear interpolation for the smaller pitch changes.
- Nope, but it should not be too hard to do this. If you already have your wavetables, you just need to append them in the correct order and write a accompanying JSON metadata file (or whatever). The hard part is getting the wavetables from "normal" audio data.
I think I'll probably start a topic in the KVR forum, maybe more developers chime in and we can agree to a standardised format that can be used across multiple Wavetable synthesiser plugins.
Well this, technically, is the standard way to do wavetables. It is the way Seruam and all of the others do it: http://www.earlevel.com/main/category/digital-audio/oscillators/wavetable-oscillators/