Jump to content
Mclaneinc

Altirra sound issue.

Recommended Posts

Hi Avery,

 

I know Pokey isn't ultra documented so emulation is hard to be exact but I thought I'd ask this :

 

In this thread

 

http://atariage.com/forums/topic/164189-the-new-donkey-kong-arcade-for-8-bit/page-7?do=findComment&comment=2955384

 

there's an updated Donkey Kong with a tune at the start, to me it sounds out of tune on certain notes so I asked the guy who did the tune about it and he said it sounds ok on real hardware...

 

Any idea's? (apart from don't ask questions about pokey :) )

 

EDIT: Read the replies first before even looking at Altirra please..

Edited by Mclaneinc

Share this post


Link to post
Share on other sites

Well, as a musician I think it sounds acceptable (mind you, I'm a jazz musician). I don't think Pokey is necessarily pitch perfect on real hardware anyway, though (at least not to my ears).

Share this post


Link to post
Share on other sites

I doubt it's an Altirra issue. Pokey only has 8-bit pitch control by default so it's normal for higher notes to be slightly out of tune unless extra steps are taken by the programmer.

  • Like 1

Share this post


Link to post
Share on other sites

Must be me, I am musically deaf as a post but it did sound a bit wobbly to me...

 

If I play it as NTSC it sounds better.....Maybe me then...

 

Thanks people..

Edited by Mclaneinc

Share this post


Link to post
Share on other sites

>If I play it as NTSC it sounds better

CPU and POKEY base frequency are slightly different between PAL & NTSC, so not only the replay speed is different, but also the pitch. Depending on which system the tune was composed it'll sound right or not.

Share this post


Link to post
Share on other sites

Considering the blunt answer I'm guessing that the emulator was blamed without actually checking anything. Here's what's playing at one instantaneous point:

AUDF1: 1d  AUDC1: a5  Output: 0  (840 cycles until fire) (passive: 840 cycles)
AUDF2: 2f  AUDC2: a4  Output: 0  (616 cycles until fire) (passive: 1344 cycles)
AUDF3: 00  AUDC3: 00  Output: 1  (28 cycles until fire) (passive: 28 cycles)
AUDF4: 25  AUDC4: c4  Output: 0  (84 cycles until fire) (passive: 1064 cycles)
AUDCTL: 00, 17-bit poly, 64KHz

All four channels are on the 64KHz clock, and three of the channels are set to $1D, $25, and $2F, which are 1065.3Hz, 841.1Hz, and 665.8Hz. The two higher notes are 4.05 semitones and 8.14 semitones above the lowest note, not to mention the additional harmonics from the 4-bit polynomial. Not hugely out of tone, but enough for it to be noticed by some people. So yeah, due to precision issues with the divisors, the music's technically a little out of tone at times. Enough to worry about? Probably not.

 

Attached is the raw recording from a real 800XL, for comparison.

 

PAL systems do run at a slightly different frequency than NTSC, but you are much less likely to notice that because it will simply cause the entire scale to slide slightly -- it affects absolute pitch, whereas relative pitch errors are much more noticeable.

 

donkey.zip

  • Like 3

Share this post


Link to post
Share on other sites

Not hugely out of tone, but enough for it to be noticed by some people.

 

 

I guess I'm officially tone deaf. It sounds good for 8-bit music.

Share this post


Link to post
Share on other sites

Thank you for looking at it Avery, nice to know my hearing is good :)

 

Sorry to cause a fuss of sorts, I just thought it sounded slightly odd and thought I'd ask, as seen I did try and check all avenues before asking you to look at it.

 

On a plus, great to know Altirra is doing it 100%...Thank you again...

Share this post


Link to post
Share on other sites

If the main melody were converted to a 16-bit voice, it would sound a bit better.

Share this post


Link to post
Share on other sites

I'm glad you brought this up. I have been trying to recreate a basic program I wrote many years ago on the 800 that would randomly play music based on the chosen scale. It worked fine then but using Altirra is a different story - it sounds bad.

 

I noticed last night that the table of "pitch values for the musical notes" provided in the original Atari documentation does NOT match the table provided in the ALTIRRA manual.

Share this post


Link to post
Share on other sites

I'm glad you brought this up. I have been trying to recreate a basic program I wrote many years ago on the 800 that would randomly play music based on the chosen scale. It worked fine then but using Altirra is a different story - it sounds bad.

 

I noticed last night that the table of "pitch values for the musical notes" provided in the original Atari documentation does NOT match the table provided in the ALTIRRA manual.

 

The scale given in the Altirra BASIC manual is an example. There is no single set of values for musical scale and you can use the ones from the Atari BASIC manual as well. The relative pitch between the values is more important than the absolute values, so getting a good set of values isn't as simple as just converting the raw Hz values to POKEY values.

 

Altirra uses the same frequencies for period values as the real POKEY does. If you are getting out of pitch tunes, double-check your program.

Share this post


Link to post
Share on other sites

I see what the problem is (at least for me).

 

I used an electronic chromatic tuner to verify the published pitch values against the musical notes.

 

If you try and match pitch values of 60 to 255 to musical notes, you can come pretty close (in most cases spot on)..

 

If, on the other hand, you try and match pitch values of 0 to 59 to musical notes, you can only approximate. Has to do with the scaling of the higher pitch values such that a small pitch value change in that range results in a coarse change in the musical note sounded.

 

So I just work with the lower notes now....

Share this post


Link to post
Share on other sites

Yes, with 8-bit period values the pitch accuracy gets pretty bad as you go to the higher octaves. To get reasonable accuracy for more octaves you either need to go to 16-bit periods (linked channels) or use aliasing tricks with the distortion value to alias the sound to a lower octave.

 

To reiterate, though, just mapping the frequency values won't necessarily get you the best scale due to absolute vs. relative pitch. To get a good scale, you need to select how many notes you want in the scale and then optimize the scale by sliding it up or down a little bit to optimize relative pitch accuracy. People won't notice much if the whole scale is 1% high, but they'll really notice if one note is sour because it's 1% high relative to the rest of the scale. Because the error gets worse with higher pitches, this forces a tradeoff between the number of notes in the scale and the worst case error. You can determine such a scale by running an optimization algorithm... or you can just steal the pitch values from an existing player.

  • Like 3

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...