{"id":1177,"date":"2011-12-06T15:53:34","date_gmt":"2011-12-06T13:53:34","guid":{"rendered":"http:\/\/www.kameli.net\/marq\/?p=1177"},"modified":"2011-12-08T15:52:09","modified_gmt":"2011-12-08T13:52:09","slug":"sinclair-ql-sound-pitch-and-frequency","status":"publish","type":"post","link":"http:\/\/www.kameli.net\/marq\/?p=1177","title":{"rendered":"Sinclair QL sound pitch and frequency"},"content":{"rendered":"<p>The sound &#8220;capabilities&#8221; of Sinclair QL are controlled through a single call to the IPC. You pass it two pitches, plus numerous strange parameters that distort the sound in more or less useful ways. To my great surprise I couldn&#8217;t find any description of the pitch parameter in any book or web page. For example, The SuperBASIC handbook goes to great detail with other parameters, but doesn&#8217;t explain how the pitch is calculated. I&#8217;m starting to feel like nobody really understood it and just quoted some technical manuals \ud83d\ude42 Well, here&#8217;s my take on it, based on FFT analysis and a bit of math.<\/p>\n<p>Pitch and frequency are inversely related, like on the Amiga, where you use <em>periods<\/em>. The highest tone you can output is pitch 0, which, according to Audacity&#8217;s FFT is 1313 Hz. At the other extreme there&#8217;s pitch 255, which produces a 43 Hz tone. Assuming that the formula is of the form <em>a\/(x+c)<\/em>, we get approximately the following relationship between frequency (f) and pitch (p):<\/p>\n<ul>\n<li>f = 11336.256 \/ (p + 8.634)<\/li>\n<li>p = 11336.256 \/ f &#8211; 8.634<\/li>\n<\/ul>\n<p>When dealing with integer numbers you get a good enough approximation with <em>p=11336\/f-8<\/em>. You can download a precalculated list of note pitches and frequencies <a href=\"http:\/\/www.kameli.net\/~marq\/ql\/QLpitch.txt\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The sound &#8220;capabilities&#8221; of Sinclair QL are controlled through a single call to the IPC. You pass it two pitches, plus numerous strange parameters that distort the sound in more or less useful ways. To my great surprise I couldn&#8217;t find any description of the pitch parameter in any book or web page. For example, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25,15],"tags":[],"class_list":["post-1177","post","type-post","status-publish","format-standard","hentry","category-koodi","category-retro"],"_links":{"self":[{"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=\/wp\/v2\/posts\/1177","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1177"}],"version-history":[{"count":4,"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=\/wp\/v2\/posts\/1177\/revisions"}],"predecessor-version":[{"id":1185,"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=\/wp\/v2\/posts\/1177\/revisions\/1185"}],"wp:attachment":[{"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1177"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1177"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}