On my adventures in

*and***Digital signal processing***, i started to do some experiments...***sound synthesis**
First was to do a

*sinewave generato*r with the**DAC**of the**and the timer interrupt at 4096 samples per second. I know its not much for the***Arduino DUE***ARM**core of the**chip that clocks at 84***SAM3X**Mhz**,*but was a exercise more than anything. This is quite scalable, anyway !*is a common technique for generating waveforms digitally. The principles of the technique are simple and widely applicable. You can build a*

**Direct digital synthesis***DDS*

*oscillator*in hardware or in software.

A

*DDS*

*oscillator*is sometimes also known as a

*Numerically-Controlled Oscillator*(

**NCO**).

Usually we use a Circular buffer or

*.*

**FIFO**
The NCO function contains a sine look-up tables (LUTs) that perform the following functions:

####
**sin(***n) = *sin(*2πn*/*N)*
where:
**
***n* = *Address input* to the **LUT**
**
***N* = *Number of samples* in the **LUT**
**
****sin(***n*) = *Amplitude of sine wave* at *(2πn/N)*

**sin(**

*n) =*sin(*2πn*/*N)***=**

*n**Address input*to the

**LUT**

**=**

*N**Number of samples*in the

**LUT**

**sin(**=

*n*)*Amplitude of sine wave*at

*(2πn/N)*Incrementing

**from**

*n***0**to

**causes the**

*N***LUT**to output one complete cycle of amplitude values for the sine function. The value

**2πn/**represents a

*N**fractional phase angle*between

**0**and

**. The time**

*2π**required to increment*

**(t)****from**

*n***0**to

**is the period of the sine waveforms produced by the**

*N***function.**

*NCO*The

**LUT**address is incremented once each system clock cycle by an amount equal to the phase input. The phase angle data is accumulated and stored in the phase accumulator register. The output of the phase accumulator register is used to address the

**LUT**s.

The frequency (f) of the system clock (f

**CLK**) is fixed. Therefore, the frequency of the sine waves is:

####
*f *= *1*/t = *fCLK* × *phase*/2π.

*f*=

As a taster of the code to come (Used the proverbial timer interrupt example code, and the old techniques on

*available at places like***Direct digital synthesis****interface.khm.de**) .Ill leave you some pictures
Mine is the picture below (

*1st*), below is the output of a grain synth , code available at**rcarduino.blogspot.co.uk.**
*The sinewave generator code i shall share is not the one at this link above, but an " original " one !.

Also had to mention the wicked

**BASIC**program i been using to help me in my*called "***math algorithms***http://hp.vector.co.jp/authors/VA008683/english/.***Decimal BASIC**", available at
The

**at the top is from it !!**__sine wave graphic__
## No comments:

## Post a Comment

Feel free to contact me with any suggestions, doubts or requests.

Bless