Is there a way to change the Global Tunning in Hertz? (440Hz)
-
Hi Everyone, I now there is a Global Pitch factor function in HISE but is in Semitones, is there a way to control the global tunning but in the frequency domain? Like 440Hz, 432Hz, etc.?
-
Never Mind! ChatGTP helped me with this one.
This is the snippet for anyone that needs the formula:
HiseSnippet 1095.3oc4WE0aaaCDlJ1Za1cKXsnXXOJTrGbFJxryxZGvdnNwwNKn0IFQoY8sBFoy1DghTihJatEEHuu+SC6mv9oz+AaGojijSzRS8Z6Ca9gDyi2Q9cG+tORORICfjDoh3z3nYw.w4Sc8mIzS6MkxDj81g3rp6PZhFTdYl1dVLMIABINN010XvoQch8yqez1TNUD.ElHjikr.3IrHltv5ntOlw4CngvQrnRduY28BjhdRtLEwSM21jXZvozIv9Tiaq3Rb9n9gLsT4qoZHg3TeaY3L+oxeQj4+wrD1IbvLnCwGWnLyCj7PChMemzaJiGNZddmPHNtiJpB0xpB20cHKjcg8hpwmamvqHhx0CmUVDd0V.dcJCu1kfWEPxoDjpmAoa65GnXw5hYL34Vt6IvCmwTrrWFJY9RV42cb6IQOD50inmBCT3fKhn0CZ299d3eV6GZ1rISvYBvabpHPyjBOo3wB4IcLgqj7VAxnXo.Wn66cFkmBq07kMazWLAiY8DPuKWdBkOhoClNfFfEgVc1v6q8FR0SWmKmzxFi223s4lsWC+2E12XMbyafaRhjCqGqXB8aSjuBQ97DbBn6MGjstmE72aMC1xSgdTN+DjQ0ZwLCWkR479RMbfnkM6Z9pldWdpwiqbt70hCpJm1PzUWWfsDoQm.px0Vii3o+hTJ2+YJUYFePVIojiRwdBl9fXHe7UIcj75ng9kiJzUsk7sZN4ymyBAEggbrO10VDIV.eQS74urK4o6sCUSmuL3Jh6RLnzLSB3rCbFJIjwoa3tCjbpVFa8M+nCI0uwM8WuXC+i3tyJ18m0MhEFxgQxDlo.WFWnHVrO6EPYEqHZwJc9u0MIc7XFZw006GeAIRFBlNrAJ3mSAQvLRTI8tyOsaHLllx0GekJvU6dQcCYXJmpWTLwnflOgAsk6fMcoBLKlUFuWVgo9MSgoP.rxC9aHbusqs8tZ7tRE3Eo.uuwatd8m41e7XHPW.15tCd10JN+NGJqlAka45iRh1KQs.4Kri89I5Yf2tf.TlhZmq4dz+7ldOZ7M9dzCBz31ejhJRhkIKrv9PD6HruKorwml.FR+glS4x16IopJm50OZ.ljUFiOUmprzkshjoB8BziZ23yjxpaK10Tx+JtIs96qK2+f158uWo3cyaQZLGi9rnXNzWbFvQscKFuCJla0CmacQR9PoPFOUJXAkY.GBZEaxDPUF6UlPao03c2EVta2CANPKyl+ptOAYgT0Pqv8RUK57V+trJOu9R2L35Y5L89ugBes+epvenLUyDSvmcprOMX+zHeTXM.PjHD.27nLmULhiYiaaFmorJBsC9K7S9jcLicxmry7I+frGQz.k74AYOryvk+DqELuE1edUC724gi8t7K5vO3apXOOHXwk5JAtwxF32trAt4xF32srA9fkMvGtrA98u4.MWZsUpVFk0xRHCG029BbGm9BJx3scGj+F.elwD4
-
If we assume the default is 440, you can use Engine.getSemitonesFromPitchRatio(targetHz/440) to get the semitone float which you can then pass into setGlobalPitchFactor().
-
@aaronventure Oh, it was more simple than i thought, I did the whole Formula:
12 * Math.log(frequency / referenceFrequency) / Math.log(2);