A user is confused: Wavetable glossary. Can knowledgeable people explain, please?

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

I have some ideas about what is what and how to use but please what is exactly described when following words – regarding wavetables – are used:
  • Wavetable
  • Sample
  • Frame
  • Window
  • Sprite
There may be even more terms :D
I tried to read "Wavetable Synthesis 101, A Fundamental Perspective" but felt overwhelmed :ud:

So please share you knowledge :D
rabbit in a hole

Post

A sample is the value of a signal measured at a specific point in time. It has a certain bit depth.
A sample can also be a short recording of audio, consisting of a lot of the smaller samples (of first definition)

A wavetable is a collection of samples (second definition) stored in one file.

A frame is the set of samples of all channels (usually left & right) simular as frames in movies (of which there are about 25 per second)

A window is a subset of the data currently being processed or looked at, limited by a short fragment of time, say 1024 samples long.
We are the KVR collective. Resistance is futile. You will be assimilated. Image
My MusicCalc is served over https!!

Post

Sprite?

If this might help, I did a series on a basic wavetable oscillator:

Wavetable oscillator series

I'll reiterate BertKoor's explanation in the context of my oscillator:

Wavetable oscillators use tables and interpolation, output a sample each time you ask for the next value.

A frame...for general-purpose computers, it's inefficient to ask for one sample at a time. Audio requires precise timing and spacing of samples to output to you DAC, and responding to that request (and change of computer context—it may be drawing the UI when the next sample is needed) takes too much overhead (saving the current state, etc.). Since we can get by with latency in audio (not ideal, but OK), we usually request a buffer full of samples (like, one interruption to grab 128 samples). But we might not want a buffer of samples, because this thing might be in stereo or more—most typically, we request a buffer of channel 1, and a buffer of channel 2. We call this a frame. Same position and duration in time, for multiple buffers. We rack those buffers in a frame.

The code I supply handles single-sample requests, so it knows nothing of frames. Your plugin code would typically have a procedure that requests frames of audio, and you'd simply call the wavetable oscillator as many times as needed (it uses inline functions, so there is no calling overhead).
My audio DSP blog: earlevel.com

Post

Or a two-minute quick look at wavetable oscillators, if you're just looking for an overview:

https://youtu.be/k81hoZODOP0

Dang, it's true, yt puts ads even on non-monetized videos now... :neutral:
My audio DSP blog: earlevel.com

Post

Thanks y'all I almost get it :D I thought all the time a wavetable is always small. I was confused because of that. So when I want to make wavetables that have 256 frames and a 2048 window the file is quite big right? It's kinda set of single cycles waveforms times 256?

I want to make wavetables out of my hardware synthesizer. I read somewhere that I should sample from the note F0? But what tempo than? Help is really appreciated here? :D
rabbit in a hole

Post

Autobot wrote: Sat May 29, 2021 1:13 pm Thanks y'all I almost get it :D I thought all the time a wavetable is always small. I was confused because of that. So when I want to make wavetables that have 256 frames and a 2048 window the file is quite big right? It's kinda set of single cycles waveforms times 256?

I want to make wavetables out of my hardware synthesizer. I read somewhere that I should sample from the note F0? But what tempo than? Help is really appreciated here? :D
I still struggle with this topic :D

Have read this: https://www.earlevel.com/main/2020/01/0 ... cillators/ ... but yet I'm not sure about how a wavetable is build up.

A wavetable with a window in size of 2.048 samples and a frame size of 256 samples is 524.288 samples long in sum. Does that mean a "2048 wavetable" consist of 2048 single-cycle waveforms each 256 samples in size? If so, can one alter the frame size without running into issues? If a device ask for window 2.048 and frame 256? Or can one alter the cycles as in the calculation below?

Code: Select all

524.288/256 = 2048
524.288/512 = 1024
524.288/1024 = 512
524.288/2048 =	256
rabbit in a hole

Post

Autobot wrote: Fri Mar 18, 2022 9:32 pm
Autobot wrote: Sat May 29, 2021 1:13 pm Thanks y'all I almost get it :D I thought all the time a wavetable is always small. I was confused because of that. So when I want to make wavetables that have 256 frames and a 2048 window the file is quite big right? It's kinda set of single cycles waveforms times 256?

I want to make wavetables out of my hardware synthesizer. I read somewhere that I should sample from the note F0? But what tempo than? Help is really appreciated here? :D
I still struggle with this topic :D

Have read this: https://www.earlevel.com/main/2020/01/0 ... cillators/ ... but yet I'm not sure about how a wavetable is build up.

A wavetable with a window in size of 2.048 samples and a frame size of 256 samples is 524.288 samples long in sum. Does that mean a "2048 wavetable" consist of 2048 single-cycle waveforms each 256 samples in size? If so, can one alter the frame size without running into issues? If a device ask for window 2.048 and frame 256? Or can one alter the cycles as in the calculation below?

Code: Select all

524.288/256 = 2048
524.288/512 = 1024
524.288/1024 = 512
524.288/2048 =	256
You might be misunderstanding "frame"—if I'm reading you correctly.

The wavetable oscillator, of this type, will generally have multiple tables. Each table is used for a different frequency (or note pitch) range. The lowest table will have the most harmonics. You play different pitches by raising the speed that table plays back. This will create a problem when you move above a certain pitch, because harmonics that are higher than half the sample rate will alias downwards into your audio. The solution is to have progressively more of the high harmonics removed for a new table to use for the given pitch range.

So, you have 2048 (that's the minimum I'd use, each doubling gets you an octave lower while retaining all harmonics) table size, and you have how ever many tables, as explained above. So, the oscillator owns an array of such tables. This article shows some different choices, with a minimum of 10 tables to handle 10 octaves, but also shows why you might want more (24 and 34 shown), depending on your design objectives.

So, a minimum high-quality implementation would be 10 tables, each 2048 samples. End of story for the oscillator.

Now, for frames: General purpose computers running an operating system like Windows, Mac OS, and Unix have other things to do, it's not efficient to stop everything every time the next sample is needed. So, they work in buckets full of samples at a time. This is for all audio, it is not specific to wavetable oscillators, so the size of the "bucket" (buffer) has nothing to do with the choices of 2048 and 10. It's whatever the software (usually user-configurable) demands. It might be 256 samples, for instance, a number you mentioned.

Let's say you create a gain control, when you use a variable to multiple each input sample and send it to the output. The system (via VST, Core Audio, etc.) won't give you a sample and let you send one back, it will give you a buffer full—your job is to do that gain change on every sample in the buffer, and send it back. For an oscillator, you would similarly generate a buffer of samples before returning.

But, audio is often in stereo, or more. So, instead of a buffer, the system gives you a buffer for each channel needed—two for stereo. That is, a collection of one or more buffers. This collection is referred to as a frame.

So, if you have a gain function that takes a sample and returns a gain-multiplied sample, you'd essentially put it in two for loops (this assumes the buffers are modified and returned in place, for simplicity, but often the audio_handler call points to input and output frames):

Code: Select all

audio_handler(frames)
  for each buffer in frames
    for each sample in buffer
      sample = gain(sample)
My audio DSP blog: earlevel.com

Post

earlevel wrote: Fri Mar 18, 2022 10:10 pm
Autobot wrote: Fri Mar 18, 2022 9:32 pm
Autobot wrote: Sat May 29, 2021 1:13 pm Thanks y'all I almost get it :D
[...]
I still struggle with this topic :D
[...]
You might be misunderstanding "frame"—if I'm reading you correctly.
[...]
Thank you for the insightful explanation. I think I got the "frame" thing ... I assume :D Sorry but math is a pain for me ...

However, I wonder if you are talking about the use of a wavetable for 'classic' waveform generation (like in opposite to calculate a waveform) while I talk about a wavetable like in Waldorf or Serum and such. Or does any wavetable-engine works the same?

Maybe an explanation why I ask helps: I want to create accurate and usable wavetables by myself for a wavetable-engine which prefers window 2048 frame 256.

I want to create them with hardware as well as software synthesizer. As some suggest F0 as note to sample I wondered why and came up with that

Code: Select all

sample rates is 44.100Hz -> 44.100 samples
44.1000  samples / 2.048 samples = 21,533203 samples
21,533203 samples = 21,533203Hz = 21,533Hz
F0 = 21,827Hz ~ 2020 samples. 
F0 -24 cents is almost exactly 2048 samples
Some more calculation gave me the clue to the needed bpm to set up template-project for the sampling / wavetable-design process

Code: Select all

> 80.75bpm
> 4 bars + some seconds
> note > F#0
> down tune -24cents
So far so good. But still... I wonder. You wrote "10 tables, each 2048 samples" but how many waves contains a table? 8? Each 256 samples?

Maybe my misconception is coming from thinking of single-cycle waveforms and wavetables together?
rabbit in a hole

Post

Autobot wrote: Fri Mar 18, 2022 11:33 pm
earlevel wrote: Fri Mar 18, 2022 10:10 pm
Autobot wrote: Fri Mar 18, 2022 9:32 pm
Autobot wrote: Sat May 29, 2021 1:13 pm Thanks y'all I almost get it :D
[...]
I still struggle with this topic :D
[...]
You might be misunderstanding "frame"—if I'm reading you correctly.
[...]
Thank you for the insightful explanation. I think I got the "frame" thing ... I assume :D Sorry but math is a pain for me ...

However, I wonder if you are talking about the use of a wavetable for 'classic' waveform generation (like in opposite to calculate a waveform) while I talk about a wavetable like in Waldorf or Serum and such. Or does any wavetable-engine works the same?

Maybe an explanation why I ask helps: I want to create accurate and usable wavetables by myself for a wavetable-engine which prefers window 2048 frame 256.

I want to create them with hardware as well as software synthesizer. As some suggest F0 as note to sample I wondered why and came up with that

Code: Select all

sample rates is 44.100Hz -> 44.100 samples
44.1000  samples / 2.048 samples = 21,533203 samples
21,533203 samples = 21,533203Hz = 21,533Hz
F0 = 21,827Hz ~ 2020 samples. 
F0 -24 cents is almost exactly 2048 samples
Some more calculation gave me the clue to the needed bpm to set up template-project for the sampling / wavetable-design process

Code: Select all

> 80.75bpm
> 4 bars + some seconds
> note > F#0
> down tune -24cents
So far so good. But still... I wonder. You wrote "10 tables, each 2048 samples" but how many waves contains a table? 8? Each 256 samples?

Maybe my misconception is coming from thinking of single-cycle waveforms and wavetables together?
I think the water is getting a little muddy, let me back up...

You started the thread referring to Robert's paper, Wavetable Synthesis 101, A Fundamental Perspective. Robert (in his paper) and I (in my articles) are talking about precisely the same thing. Our works focus on different aspects, but it's the same thing.

But Robert never mentions the word "Frame", nor "Sprite", in his paper. Neither do I. So, I think you're mixing up concepts.

As for hardware, it all depends on what you're after. Early wavetable-style hardware simply used single tables with a controllable clock. If the table were long enough (enough memory), then they were suitable for sample playback as well. There is no aliasing for such a system, but the downside is that you need to duplicate the hardware for each oscillator, for each voice.
My audio DSP blog: earlevel.com

Post Reply

Return to “DSP and Plugin Development”