aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUnavailableDev <ggwildplay@gmail.com>2023-02-15 21:58:11 +0100
committerUnavailableDev <ggwildplay@gmail.com>2023-02-15 21:58:11 +0100
commit3effd308a5140ef10a64e9e256f2efbe79d53841 (patch)
tree1079bb556e04a74c7a75770d6c38c1225112e8fb
parentd1202576430b8faaee54e9ce4ab08f7fff408aae (diff)
APU tone generation
-rw-r--r--docs/architecture.md23
1 files changed, 22 insertions, 1 deletions
diff --git a/docs/architecture.md b/docs/architecture.md
index 1ae4198..8daa7e4 100644
--- a/docs/architecture.md
+++ b/docs/architecture.md
@@ -276,4 +276,25 @@ These signals will be generated using PWM, this allows a digital signal to act a
![Audio signal with PWM](../assets/audioPWM.svg)
This figure shows an example signal (in blue), created by the FPGA. and the corresponding analog signal (in red).
-
+In order to generate a audio signal from a note, we need a few things:
+- frequency
+- duration
+- amplitude
+
+optional:
+- envelope (ADSR)
+
+![ADSR envelope](https://commons.wikimedia.org/wiki/File:ADSR_parameter.svg)
+
+This image shows an advanced method of generating tones. In our case this is only an indication as to how it could be done, we will actually only be looking at the sustained tone part for simplicity sakes.
+In order to get the correct graph forms, some data points can be stored in a LUT (Look Up Table). This allows the saving of computation power at the cost of some ROM space.
+This only creates one type of sound at a set frequency and amplitude. The frequency of this tone can be altered by increasing the step size of the LUT. This allows the creation of higher frequency signals at a slight loss of precision.
+The following pseudo code is there to show an example of this:
+```c
+for (i = 0; i < toneLength; i++){
+ for (k = 0; k < sizeof(LUT); k += stepSize){
+ OUT = LUT[k];
+ }
+}
+```
+This output can then be converted to a PWM signal using known methods or existing solutions as described in the beginning of this chapter.