# ELEC60013 Embedded Systems - Music Synthesizer Documentation
The following document outlines the design, implementation and real-time dependecies of a music synthesizer for the 2nd coursework of the Embedded Systems module.
**Implementation:** Thread, executing every 100ms. While a refresh rate of 10Hz does not sound impressive; the display is largely static. Therefore, 100ms was perfectly accetable, without any noticeable delays.
**Minimum initiation time:** TO BE COMPLETED.
**Maximum execution time:** TO BE COMPLETED.
**Priority:** Lowest (2).
### Generating the sound
**Purpose:**
* Adds the sample rate to the accumulated value, corresponding to the desired frequency
* Sets the output voltage, by using the accumlated value and the desired volume
* Writes to analogue output, generating the desired sound
**Function:** code(sampleISR())
**Implementation:** Interrupt executing with a frequency of 44.1kHz
It was desiced to use C++ code(std::atomic), as it is easier to use and implement, while providing the same functionality as a mutex. According to the documentation: *"Each instantiation and full specialization of the std::atomic template defines an atomic type. If one thread writes to an atomic object while another thread reads from it, the behavior is well-defined (see memory model for details on data races). In addition, accesses to atomic objects may establish inter-thread synchronization and order non-atomic memory accesses as specified by std::memory_order.*"(https://en.cppreference.com/w/cpp/atomic/atomic)