I'm trying to teach myself Python and I have a simple program that records some audio and sends it to an output file. I can't seem to figure out exactly how to increment the file each time I run it to avoid overwriting the previous one (output1.wav, output2.wav, etc). It seems simple, but as I said I am very new to Python and can't seem to get it to work.
import os
import sounddevice as sd
from scipy.io.wavfile import write
os.chdir(r'C:\Path')
fs = 44100
seconds = 20
myrecording = sd.rec(int(seconds * fs), samplerate=fs, channels=2)
sd.wait()
write('output.wav', fs, myrecording)