aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUnavailableDev <69792062+UnavailableDev@users.noreply.github.com>2023-02-15 21:59:25 +0100
committerGitHub <noreply@github.com>2023-02-15 21:59:25 +0100
commitea085d1ec65e5b9f82cd90236fdca1b274c4e905 (patch)
tree575fa7db9831e8de1a2fc7da5a6fdd8309ad4388
parent63992d206a7a1fdc194ecdd294634e1e4cca4541 (diff)
parentea92d6b0094f47e1e1c1b449a71f865c59191c59 (diff)
Merge pull request #13 from UnavailableDev/master
APU tone generation
-rw-r--r--docs/architecture.md23
1 files changed, 23 insertions, 0 deletions
diff --git a/docs/architecture.md b/docs/architecture.md
index 0ce6c0d..0610d90 100644
--- a/docs/architecture.md
+++ b/docs/architecture.md
@@ -279,6 +279,29 @@ These signals will be generated using PWM, this allows a digital signal to act a
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.
+
# Level design
To create sprites the program to be used is aseprite, aseprite exports their