import pandas as pd
import numpy as np
import soundfile as sf
data=pd.read_excel(path)
mean=np.mean(data)
freq=data+(data-mean)*15
# Create soundfile
sampling_frequency=44100
duration=10
numtones=len(freq)
tone=[]
for i in freq:
# This part is to make sure that each individual frequency is not cut off halfway the period
# max1 is the time for each element in freq
max1=duration/numtones
# 1/i is the period of one element of freq
# int(max1/(1/i)) is the amount of times an element of freq can repeat within time max1, rounded down to a whole number.
# int(max1/(1/i))*(1/i) is the length the sine wave has to have to come full circle at the end
max2=int(max1/(1/i))*(1/i)
x=np.linspace(0,max2,max2*sampling_frequency)
sin=np.sin(2*np.pi*i*x)
tone=np.append(tone,sin[1:])
# sd.play(tone, sampling_frequency)
sf.write("output.wav", tone, sampling_frequency)