Need to make certain sine waves quieter than others when all playing at same time using pysinewave
10:22 09 Nov 2025

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()

Any help is SO appreciated! Also, if you have a problem with my question, please just tell me, since I'm new to askinng on Stack. Thank y'all!

python audio