
I'm just sharing with you a little script I made for a game I'm working on and which could help some I think, it's a Lua module to generate sounds with 6 different types of waves and with some options in plus the possibility of making small melodies with another function

Here are the possible types of waves:
- sine
square
triangle
sawtooth
pulser
composite

If you have any suggestions for optimizations or additions I am all ears I even made a repository if necessary

I forgot to specify that I added a table with all the note frequencies from C1 to G9

Links that have been useful to me:
https://thewolfsound.com/sine-saw-squar ... synthesis/
http://www.mathguide.com/lessons2/EquationsNotes.html
http://techlib.com/reference/musical_no ... encies.htm
https://pages.mtu.edu/~suits/NoteFreqCalcs.html
https://pages.mtu.edu/~suits/notefreqs.html