I'm trying to play multiple sine waves at once in Python using pysinewave, but I need to make them sound quieter as they go up in pitch. The problem I'm running into is making them at different volumes when playing them at the same time.
Here's what I've tried:
import time
from pysinewave import SineWave
base_freq = 440
num_harmonics = 10
base_volume = 20
sinewaves = []
for n in range(1, num_harmonics + 1):
s = SineWave(pitch_per_second=0)
s.set_frequency(base_freq * n)
print(base_freq * n)
s.set_volume(base_volume/n)
sinewaves.append(s)
for s in sinewaves:
s.play()
time.sleep(3)
for s in sinewaves:
s.stop()
pysinewavedoes not seem to be a widely known package, so I estimate chances of you finding an expert in that package here are slim. With that being the case, perhaps explain how the observed behavior of the code presented differs from what you expect? It's not clear to me, at least, that the behavior would fail to satisfy the criteria you give.