Frequency to Sound.Pitch / Sound.PlaybackSpeed?

So, I’m making a musical tesla coil, I’m getting midi pitches from a .mid file with python, then converting that note to a frequency, then sending that stuff to roblox. But, the frequency gets to like 100 - 300, so how would I convert that to work with Sound.Pitch / Sound.PlaybackSpeed?

Part of the code:

while true do
	local data = getAndDecode()
	local midiPitch = data["midiPitch"]
	local midiFreq = data["midiFreq"]
	
	print(midiPitch, midiFreq)
	
	TestSound.Pitch = midiFreq
	
	wait(1)
end

Frequencies:

1 Like

I’m not exactly sure how you should change PlaybackSpeed to match the frequency. There is also this feature:

For some reason, this can be computationally expensive.

yo someone on discord helped me
look it updates every 1 second and sounds like something now:

update: i set the update time to 0.1 seconds and some parts were audible
literally the math i had to do for the playbackspeed was local DesiredFrequency = (midiFreq / 440)