Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Composing > The old PAL/NTSC question
2023-09-29 07:29
TWW

Registered: Jul 2009
Posts: 541
The old PAL/NTSC question

Hiho

So I was fiddling around with a v-sync'ed / fully stabilized NMI timer in conjunction with IRQ timers so that any screen effect can be controlled by a tight NMI while music is played by a CIA timer (which would allow you to adjust the timing so the player routine is called at the same intervall pr second on all models).

Now I would like to test this and there are a couple of issues which needs to be ironed out (Disclaimer, I know fuck all about music):

#1 - As I understand it by reading this forum, it is not enough to call the routine at a fixed / pr. second interval, you also need to change some of the note / frequency tables in the player routine itself. Can someone confirm and elaborate?

#2 - Given #1 is neccessary, is there any SID available which could be used to test this, where the location and contents of these tables are known so it would be trivial to make said test?
 
... 7 posts hidden. Click here to view all posts....
 
2023-09-29 16:00
chatGPZ

Registered: Dec 2001
Posts: 11130
Speaking of that, did anyone yet come up with a table that shows least quantization errors (by carefully tuning it up or down a bit)? I did this on other platforms (where freq is even less accurate) and it did make a great difference.
2023-09-29 16:03
acrouzet

Registered: May 2020
Posts: 80
Quote: Speaking of that, did anyone yet come up with a table that shows least quantization errors (by carefully tuning it up or down a bit)? I did this on other platforms (where freq is even less accurate) and it did make a great difference.

A friend of mine calculated one. In the end, it doesn't make a difference (at least to my ears) cause the SID has such a fine frequency resolution.
2023-09-29 16:10
chatGPZ

Registered: Dec 2001
Posts: 11130
Yeah, perhaps doesn't matter much for SID. A tiny bit of detune can be good too :)
2023-09-29 19:40
acrouzet

Registered: May 2020
Posts: 80
Quote: I always wondered why the didnt print a small BASIC program in the Manual that calculates the note frequencies... instead of that giant table :)

Precision error?

On the software side however, a common technique for reducing the space taken up by a full tuning table (at the expense of pitch accuracy on high notes) is to find an octave where all the frequency values have a high byte of 01, and store just the low bytes in the player. To get the freq. values back, add back the high bytes of 01 and shift left to get the rest of the octaves.

The most accurate (interval-wise) low bytes in this case are:
0D 1D 2E 40 53 67 7C 93 AB C4 DF FC

To me, this does make an audible difference. Here's an example of these values in use: The Rainbow Test
2023-09-29 21:55
chatGPZ

Registered: Dec 2001
Posts: 11130
I really like the approach LFT used... similar, but more in- between steps (which gives you nice base for linear vibrato and slides)
2023-09-30 01:05
Fungus

Registered: Sep 2002
Posts: 623
The even tempered scale isn't mathematically correct either. For example when tuning pianos they start in the middle and they tune the rest of the keyboard relative to middle A.

Guitar is the same, we often tune some notes a little bit flat in order to make the entire guitar play more in tune when with keyboards as the instrument can't have exact pitches without special frets.

The human ear tolerates a little flatness more than sharpness too. There's lots of interesting studies on it.
2023-09-30 01:26
McMeatLoaf

Registered: Jan 2005
Posts: 105
Quote: Quoting Fungus
the values are actually correct for NTSC as they are taken from the Programmers Reference Guide.
Wasn't there this story about HAL Labs Japan and composing tunes strictly by The Book, which came out utterly detuned in the end? :)

Might have been another case, though, like sticking to an early datasheet while SID changes were on the way, too.

But anyways, yes, the difference between NTSC and PAL isn't so big.
Having a different intonation would probably make more of a dent in a given tune.


With "utterly detuned" I can only imagine something in the vein of mistaking the pitch register (the upper 8-bits I'd guess) as an index to some 12-tone equal temperament-based pitch lookup table, which AFAIK was one of Bob Yannes' unimplemented ideas?

As for Rob Hubbard's A440 pitch table, I checked some pitch tables and among the non-one off, *notably* out-of-tune ones, at least mathematically, were Dave Kelly along with Maniacs of Noise's sore A#1, if you don't count Parker Bros who use 8-bit pitch but downpitched 2 octaves (divided by 4, so in effect "10-bit" pitch). Background Music Editor does something similar but in reverse by up-pitching a low-octave table, so it's actually somewhat off-tune.
2023-09-30 03:56
acrouzet

Registered: May 2020
Posts: 80
Okay. So to get back to the original post topic, here are my answers to OP's questions. I'm actually quite interested in the hyper-specific topic of sound chip tuning tables, if you haven't noticed that already.

1. Stone is right in that, within the realm of SID frequency and envelope timings, changing the clock speed of the CPU is effectively like speeding up or slowing down a song, so all SID music will sound "in-tune" no matter what region your C64 is meant for (unless you're playing along on an instrument with a different tuning reference). In fact, the difference in clock speed between regions is so slight that you shouldn't notice a difference unless you have absolute pitch.

2. Try any .sid with player ID "JCH_NewPlayer", "Vibrants/Laxity", or "Rob_Hubbard". Open the .sid in a hex editor and search for "16 01 27 01". Then, starting from "16", select bytes until you've selected 192 of them. The entire tuning table should now be selected. You can now replace that table with a Little Endian Interleaved Table generated with this tool I made: https://docs.google.com/spreadsheets/d/1zjroenEv8O8WT05sCiKdbX_..
2023-09-30 06:27
TWW

Registered: Jul 2009
Posts: 541
Thanks all for your input and clarifications. Most usefull! I'll give this a try.

Cheers!
2023-10-01 23:00
Bansai

Registered: Feb 2023
Posts: 34
Quoting chatGPZ
I really like the approach LFT used... similar, but more in- between steps (which gives you nice base for linear vibrato and slides)

Fred Gray on Legend of Kage (and Roadrunner among other tunes) used this scheme with 4 steps between semitones:

L_MICROTONE_FREQTAB
 .byte $97,$7E,$6E,$80,$4D,$82,$32,$84 ; B-6 first in row
 .byte $1E,$86,$11,$88,$0C,$8A,$0E,$8C ; C-7 first in row
 .byte $18,$8E,$29,$90,$41,$92,$62,$94 ; C#7 first in row
 .byte $8B,$96,$BB,$98,$F4,$9A,$35,$9D ; D-7 first in row
 .byte $7E,$9F,$D0,$A1,$2B,$A4,$8E,$A6 ; D#7 first in row
 .byte $FA,$A8,$6F,$AB,$EE,$AD,$75,$B0 ; E-7 first in row
 .byte $06,$B3,$A1,$B5,$45,$B8,$F3,$BA ; F-7 first in row
 .byte $AC,$BD,$6E,$C0,$3A,$C3,$11,$C6 ; F#7 first in row
 .byte $F3,$C8,$DF,$CB,$D6,$CE,$D8,$D1 ; G-7 first in row
 .byte $E6,$D4,$FE,$D7,$23,$DB,$52,$DE ; G#7 first in row
 .byte $8F,$E1,$D6,$E4,$2B,$E8,$8B,$EB ; A-7 first in row
 .byte $F8,$EE,$72,$F2,$F9,$F5,$8C,$F9 ; A#7 first in row

...vibratos and glides scale nicely across the entire pitch range regardless of what your note of interest is. The only downside is the right shift loop burning some rastertime to get to the correct octave.

Regarding detune frequency not scaling properly, earlier Whittaker players (e.g., Quartet, Street Surfer, etc.) specified an absolute +/- SID freq added for vibrato which he had to vary manually from octave to octave, then later on (e.g., Menace) he scaled vibrato up automatically according to octave, but for the note before you jumped from one octave to the next, your vibrato would be shallow--if that's the right word--by almost 2x of what it should be if it were scaled with frequency. Microtone-based tables are a very nice solution to that problem, though I suppose one could interpolate an approximation that was fast and good enough. I need to revisit the code as it's been a while, but if I remember correctly, I think the FAME player might do just that. I know there is special handling for glides with it.
Previous - 1 | 2 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
zscs
Guests online: 91
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Memento Mori  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Dawnfall V1.1  (9.5)
8 Quadrants  (9.5)
9 Daah, Those Acid Pil..  (9.5)
10 Birth of a Flower  (9.5)
Top Groups
1 Nostalgia  (9.3)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Logo Graphicians
1 Sander  (9.9)
2 Facet  (9.6)
3 Mermaid  (9.4)
4 Pal  (9.4)
5 Shine  (9.3)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.047 sec.