Sinclair QL sound pitch and frequency

December 6th, 2011

The sound “capabilities” 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’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’t explain how the pitch is calculated. I’m starting to feel like nobody really understood it and just quoted some technical manuals 🙂 Well, here’s my take on it, based on FFT analysis and a bit of math.

Pitch and frequency are inversely related, like on the Amiga, where you use periods. The highest tone you can output is pitch 0, which, according to Audacity’s FFT is 1313 Hz. At the other extreme there’s pitch 255, which produces a 43 Hz tone. Assuming that the formula is of the form a/(x+c), we get approximately the following relationship between frequency (f) and pitch (p):

  • f = 11336.256 / (p + 8.634)
  • p = 11336.256 / f – 8.634

When dealing with integer numbers you get a good enough approximation with p=11336/f-8. You can download a precalculated list of note pitches and frequencies here.

Filed under: koodi,retro

1 Comment Add your own

Kommentin kirjoitus

You must be logged in to post a comment.

RSS feed for comments on this post.


Kommenttien virta

Aiheet