2
$\begingroup$

I've been experimenting with PYO recently, a Python module for sound synthesis and audio processing. This is really my first foray into this topic, so I have what is probably a very basic question.

There are a few alternative mechanisms available for creating periodic waveforms such as a sawtooth or triangle wave:

  • Using additive synthesis (via SawTable, which internally calls HarmTable)

    This approximates a waveform through successive addition of sine waves. E.g.,

    from pyo import *
    table = SawTable(order=20)
    

    Which gets me:

    enter image description here

  • Using a "linear" table (LinTable)

    This allows one to construct a waveform as a series of straight line segments. E.g.,

    from pyo import *
    table = pyo.LinTable([(0, -1), (8191, 1)])
    

    Which gets me:

    enter image description here

These two waveforms sound similar, of course, but they are qualitatively different. What is the technical difference between the two? Is there a reason to prefer one mechanism over the other?

$\endgroup$
1
$\begingroup$

A drawn sawtooth waveform can contain higher frequency harmonics than half the waveform sampling rate, thus leading to aliasing (potentially noise at other folded frequencies).

Additive synthesis using pure sine tables can avoid this aliasing noise problem.

$\endgroup$
  • $\begingroup$ Thanks, in particular for the term "aliasing", which lead me to this which helped out a bit. $\endgroup$ – larsks Feb 2 '16 at 15:27
1
$\begingroup$

If your goal is to get a sawtooth wave, then additive synthesis is a bad way to go about it as a sawtooth wave is a superposition of an infinite number of sine waves (in the continuous case). Many instruments, particularly woodwinds, are well modeled by a relatively few sine waves. The exact mixture determines the timbre and thus what instrument it sounds like, e.g. an oboe as compared to a clarinet. Violins, however, generate a slip-stick motion that is more like a sawtooth wave and thus are harder to model accurately and efficiently with additive synthesis.

Unless you are going for an "electronic" sound, I would say using LinTable by itself would be a somewhat unusual thing. However, using it as input to a filter would make more sense. For example, if you did use a sawtooth wave to model a violin, you'd almost certainly pass it through a (among other things) low-pass filter to round it out a little and change the timbre.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.