How would I set a Sound pitch to a note?

What formula would I use to set the pitch of a Sound to a note relative to middle C using semitones? Then how would I apply that pitch?

I’m currently using this formula, which seems to work:
image
image

local note = 69 -- Change this value to the MIDI number of the note you want to set
local frequency = 440 * (2 ^ ((note - 69) / 12))
script.Parent.Pitch = frequency / 440 -- Set the frequency relative to A4 note

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.