I finally found a way to get a python program to produce sound. It involves using a sine wave. The problem is, I want to make chiptune music, so sine waves just won't do. I need square waves, triangular waves, 'sawtooth' waves, and a fourth that's just static. Obviously, this section can't help me with the last.
The procedure for generating sound involves a formula that makes a sine wave. What mathematics could I use to convert this smooth sine wave into other 'retrotune' waves? I'm not exactly an expert on mathematics, and I have never learned anything about 'sine', so I don't really understand what I'm doing here.
If it matters, here's the formula my program uses to generate a sine wave (note that I don't fully understand how the equation works):
eachSampleNumber=np.arange(duration*sps) waveform=np.sin(2*np.pieachSampleNumberfreq/sps)
The 'np' part is just the 'module' some of these functions are coming from. np.pi is just pi, np.sin is sin, and I don't know what exactly np.arrange does. Duration is simply how long the note is played for, and sps is 'samples per second'. Frequency is of course the frequency of the wave.
And yes, I know this is kind of a programming question, but this involves far more complicated mathematics than programmers normally deal with.