Hi Robert,

Yes, my answer was strictly for the special case of one table per octave. In 
that case, the start of the highest table (which would also be highest harmonic 
per table), such that transposing up by the maximum amount (in this case, one 
octave) is SR/3. But the general case is:

  F_top = SR / (2 + 1 / num_tables_per_octave)

And, whereas in the one-octave case the frequency base of the next higher table 
is twice the current table, the general case is higher by a factor of:

  2^(1 / num_table_per_octave)

The general case for the number of harmonics per table is:

  floor(F_top / current_table_base_freq)

And to elaborate on your comment that two tables per octave gets you over 19k, 
I believe that requires an asterisk (doesn’t it? had to do this quickly...): 
Whereas one table per octave works out symmetrically, where the top harmonics 
would be at 14700 and fold back to 14700 when shifted up an octave, two-per is 
not so convenient. The aliasing is limited to 19153 IF the highest harmonic is 
limited to 17640 (F_top for num_tables_per_octave = 2). Now that’s not much of 
a limitation, because “good luck hearing harmonics over 17640”, and aliasing 
would be a bigger concern, so it’s a good tradeoff—just noting it’s not 19/19 
(highest allowed harmonic in table / lowest alias). I wanted to add that 
because you wrote of a band above 19k "in which you *do* allow foldover and 
aliasing.  or, on the other hand, missing harmonics”, but you really don’t get 
both.

Nigel



> On Sep 20, 2015, at 6:57 PM, robert bristow-johnson 
> <r...@audioimagination.com> wrote:
> 
> On 9/11/15 3:25 PM, Nigel Redmon wrote:
>> Great—glad to hear the articles were helpful, Nuno. (Website back up.)
>> 
>>> To build the oscillators tables I’m using that multi table technic you 
>>> describe on your waveforms series posts where maxHarms is: int maxHarms = 
>>> 44100.f / (3.0 * BASE_FREQ) + 0.5; Is this an heuristic?
>> 
>> This equation is specific to my goal of showing the minimum number of 
>> wavetables for a high-quality oscillator at 44.1 kHz sample rate. That is, 
>> one wavetable per octave. The oscillator I demonstrated does alias in the 
>> audio band, but those components are confined to being above one-third of 
>> the sample rate (in this case 44100.0 / 3.0). I think the rest of the 
>> equation is obvious—dividing by the base frequency (20 Hz, for instance), 
>> because the lower the lowest (base) frequency that you want to represent, 
>> the more harmonics are needed to fill the audio band. And the 0.5 is to 
>> round up.
>> 
>> So, back to the SR/3 part: Again, we’re allowing one wavetable per octave. 
>> If you wanted no aliasing at all, you’d need to limit the highest harmonic 
>> to 22050 Hz (half SR) when that table is shift ed up an octave. But the 
>> highest harmonic, for such a table, would only be at 11025 when not shifted 
>> up an octave. That’s not very good. Instead, we say that we’ll allow 
>> aliasing, but limit it to staying very high in the audio band where we can’t 
>> hear it, or at least it’s unnoticed.
> 
> the way i would quantify the problem is to define a frequency band from 
> somewhere below Nyquist (like 19 kHz) up to Nyquist (22.05 kHz) in which you 
> *do* allow foldover and aliasing.  or, on the other hand, missing harmonics.  
> if you don't mind crap above 19 kHz (put a brick-wall LPF on it, if you do 
> mind), you can get away with 2 wavetables per octave with Fs = 44.1 kHz, with 
> non-zero harmonics up to 19 kHz and no aliases below 19 kHz.  some harmonics 
> will fold back and become non-harmonic, but they'll stay above 19.
> 
> i thought i tossed out the equations before, but i don't remember.  i can do 
> it again, i s'pose.
> 
>> Well, if we allow 1k of aliasing, when shifted up, it would alias at 21050, 
>> and at the low end it would be 12025. The aliasing would be acceptable (not 
>> only unhearable, but this is for a synth—higher harmonics are typically 
>> lower amplitude than lower harmonics, AND we usually run through a lowpass 
>> filter), but there’s not much improvement for the start of the octave’s 
>> highest frequency component. Optimal is probably where the highest component 
>> of the bottom of the octave meets the worst-case aliasing from the top—and 
>> that is the half-way point of the top octave of the audio band (that is, 
>> 11025 to 22050 Hz). The half-way point of the top octave is 22050/1.5, or 
>> 44100/3—14700 Hz.
>> 
>> So, the equation just determines how many harmonics should be in the table 
>> for a given octave—the highest harmonic for a given octave table should be 
>> limited to 14700 Hz to allow for shifting up an octave.
>> 
>> Of course, you could use more tables and limit the shifting to a fraction of 
>> an octave, and do better, but good luck hearing the difference ;-) It’s 
>> simply a good tradeoff.
> 
> -- 
> 
> r b-j                  r...@audioimagination.com
> 
> "Imagination is more important than knowledge."
> 
> 
> 
> _______________________________________________
> dupswapdrop: music-dsp mailing list
> music-dsp@music.columbia.edu
> https://lists.columbia.edu/mailman/listinfo/music-dsp


_______________________________________________
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp

Reply via email to