Presentation is loading. Please wait.

Presentation is loading. Please wait.

Methods for Tone and Signal Synthesis R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2002.

Similar presentations


Presentation on theme: "Methods for Tone and Signal Synthesis R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2002."— Presentation transcript:

1 Methods for Tone and Signal Synthesis R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2002

2 ECEN4002 Spring 2002Signal Synthesis R. C. Maher2 Signal Synthesis So far in this course, we have considered signal processing: input signal sent through LTI system For signal synthesis, we generally do not have an explicit input signal: output is generated by an algorithm

3 ECEN4002 Spring 2002Signal Synthesis R. C. Maher3 Applications of Synthesis Synthesis is useful in DSP systems for –Communications signals (modulation, coherent detection, modem tones, etc.) –Test signals (function generator, noise test signals, transfer function measurement) –Warning and notification tones –Music synthesis

4 ECEN4002 Spring 2002Signal Synthesis R. C. Maher4 General Synthesis Types Algorithmic synthesis –Pseudo-random signals (noise with specified statistical properties) –Periodic signals using a mathematical formula (transcendental functions, discrete summation) Look-up table synthesis –Signal synthesized by reproducing samples from data in memory: a wavetable

5 ECEN4002 Spring 2002Signal Synthesis R. C. Maher5 Random Signal Generation Want an algorithm to produce a sequence of numbers that appear to be chosen randomly Usually use a periodic sequence with a period sufficiently long that the repetition is not a problem: sequence is pseudo-random Method applicable to DSP chips is the linear congruential algorithm

6 ECEN4002 Spring 2002Signal Synthesis R. C. Maher6 Linear Congruential Method A “cheap” and not particularly rigorous method to make pseudo-random sequences Uses a recursive method and a modulo For numbers between 0  y  (M-1), select y 0 (“seed”) and values for multiplier a, displacement c, and modulus M. Not all choices give maximal- length sequence!! y n =(a·y n-1 + c) mod M

7 ECEN4002 Spring 2002Signal Synthesis R. C. Maher7 Periodic Signal Algorithm Generate the signal by implementing a discrete-time formula Works well for square, pulse, triangle, sawtooth waveforms, but these are generally not bandlimited If sufficient processing power available, can approximate an arbitrary function (cosine, exponential, etc.)

8 ECEN4002 Spring 2002Signal Synthesis R. C. Maher8 Digital Sinusoid Generator Consider a filter with h[n]=R n sin(w 0 n) u(n), which is a causal decaying sinusoid for 0<R<1, and a pure sinusoid for R=1 w 0 =2  f/f s Start with impulse input

9 ECEN4002 Spring 2002Signal Synthesis R. C. Maher9 Stored Signal Synthesis Concept: fill a delay line with one cycle of the desired waveform, then “loop” the signal over and over to produce the extended output signal Vary the frequency by decimation / interpolation of the stored samples Vary the amplitude by multiplying a slowly varying envelope function

10 ECEN4002 Spring 2002Signal Synthesis R. C. Maher10 Wavetable Frequency Control Assume table is length N, holds one period of the signal, and the sample rate is f s Output frequency for entire table is f s /N Wavetable (N) New sample every 1/f s ; Table frequency f s /N

11 ECEN4002 Spring 2002Signal Synthesis R. C. Maher11 Frequency Control (cont.) To get a different output frequency from the same stored wavetable, define a sample increment (SI) and a lookup accumulator (LUA). SI is typically a fixed-point number (integer part and fractional part) defined by

12 ECEN4002 Spring 2002Signal Synthesis R. C. Maher12 Frequency Control (cont.) Lookup accumulator (LUA) has an integer part and a fractional part. The integer part is modulo-N : counts zero to N-1, then rolls over to zero. At each sample time, add SI to LUA, then use integer part of LUA as lookup index into stored wavetable. Can use fractional part of LUA for inter-sample interpolation

13 ECEN4002 Spring 2002Signal Synthesis R. C. Maher13 Wavetable Lookup Example f s =48000 Hz, N=1024, desired f out =440 Hz SI=1024  440 / 48000 = 9.386667

14 ECEN4002 Spring 2002Signal Synthesis R. C. Maher14 Implementation on DSP Load a buffer with one cycle (length N) of the waveform Define SI:integer and SI:fraction variables Define LUA:integer and LUA:fraction variables For each sample: –Add SI:fractional to LUA:fractional –Add with carry SI:integer to LUA:integer –If LUA  N, subtract N from LUA:integer –Fetch wavetable sample at offset LUA:integer

15 ECEN4002 Spring 2002Signal Synthesis R. C. Maher15 Details to watch out for… Wavetable lookup (resampling) with SI>1 will cause aliasing if wavetable contains components above f s /(2·SI) Choosing N to be a power-of-2 makes LUA modulo a simple masking operation Frequency resolution determined by number of fractional bits in LUA

16 ECEN4002 Spring 2002Signal Synthesis R. C. Maher16 Linear Interpolation LUA contains desired “location” of next output sample. If LUA:fraction  0, we need to interpolate the table. Ideally, need to do bandlimited (Shannon) interpolation, but often settle for cheap linear interpolation between adjacent table samples LL+1L + fract y[L+1] y[L]

17 ECEN4002 Spring 2002Signal Synthesis R. C. Maher17 Basic Wavetable Synthesizer Sample Increment (SI) Wavetable Envelope Gain Multiplier

18 ECEN4002 Spring 2002Signal Synthesis R. C. Maher18 Musical Frequency Scale Most Western music uses a “Well- Tempered Scale” for the 12 notes of the diatonic scale –Scale based on note A = 440 Hz –All other A note frequencies are multiples of 2 n, where n is an integer (A=110, 220, etc.) –Other notes (B, B#, C, etc.) related by 2 k/12 –Factor 2 1/12 = 1.059463

19 ECEN4002 Spring 2002Signal Synthesis R. C. Maher19 Musical Scale (cont.) Example for A4=440 Hz, N=1024, f s =48000


Download ppt "Methods for Tone and Signal Synthesis R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2002."

Similar presentations


Ads by Google