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 Coding > Playing PAL music in NTSC...
2009-01-09 03:42
The Phantom

Registered: Jan 2004
Posts: 360
Playing PAL music in NTSC...

Ok people, have a tough one here, well, at least for me.

A long while ago, Fungus taught me how to play PAL music on NTSC. A few minutes ago, I compared something I was working on in both PAL and NTSC and the difference was staggering.

Here's the routine...

fixit

lda #$06
beq reset
dec fixit+$01
jmp $1003 (play music)

reset

lda #$06
sta fixit+$01
rts

I'd like to play music in NTSC as it sounds in PAL, as it SHOULD sound, any suggestions?

Thanks in advance
2009-01-09 04:38
chatGPZ

Registered: Dec 2001
Posts: 11127
use a timer interrupt at 50hz :)
2009-01-09 08:16
Devia

Registered: Oct 2004
Posts: 401
You may be able to play tunes at PAL speed on NTSC systems, but they will still not sound the same as the SID is clocked differently. The notes will not have the same pitch as on PAL.
In theory this could be fixed by changing the note frequency table of the player, but in many cases, e.g. tone portamento, it would not be enough for a 100% conversion.
2009-01-09 10:29
Frantic

Registered: Mar 2003
Posts: 1627
I might be completely wrong now, in case I missed something, but I *think* the timer should be set to $4FB3, using a timer interrupt, to play at the correct speed at least. As far as I understand, that would lead to a "framerate" of the music being 50.12454212 hz (on an NTSC machine), like the PAL framerate...

2009-01-09 22:25
6R6

Registered: Feb 2002
Posts: 244
Sidplay64 V0.4
Will play sid songs in ntsc or pal speed on your c64.
Its using the timer thingy mentioned..


2009-01-09 23:25
Steppe

Registered: Jan 2002
Posts: 1510
Quote: I might be completely wrong now, in case I missed something, but I *think* the timer should be set to $4FB3, using a timer interrupt, to play at the correct speed at least. As far as I understand, that would lead to a "framerate" of the music being 50.12454212 hz (on an NTSC machine), like the PAL framerate...



Frantic, how did you calculate that? A PAL C64 has $4CC8 cycles, and that should be the value to put into the CIA timer to get a tune to play a PAL speed. 63 cylces a line and 312 lines, right?
2009-01-09 23:47
assiduous
Account closed

Registered: Jun 2007
Posts: 343
pal is 985.248 khz,ntsc is 1022.7 khz,it takes shorter time for an ntsc machine to execute a clock cycle. Frantic`s calculations are correct:

985248/1022700 == 0.963379...
19656(4cc8)/20403(4fb3) == 0.963387...
2009-01-09 23:52
Frantic

Registered: Mar 2003
Posts: 1627
Glad to hear that my brain works. ;)

Also.. Note that I said $4FB3 rather than $4fB4.. just like you have to use $4cc7 as a timer value rather than $4cc8 to get $4cc8 cycles period. (Just to keep things straight - whether we are talking what to set the timer to, or whether we are talking about the number of cycles).
2009-01-09 23:53
Steppe

Registered: Jan 2002
Posts: 1510
Thanks for clearing that up!
2009-01-10 00:29
Frantic

Registered: Mar 2003
Posts: 1627
Just to act like Mr Exemplary, I also wrote this stuff down in a small article on codebase, just to show how I think codebase should/can be used. ;)

http://codebase64.org/doku.php?id=base:playing_music_on_pal_and..
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
bepp/ΤRIΛD
hedning/G★P
Didi/Laxity
zscs
psych
d'Arc/Topaz Beerline
DonChaos
Guests online: 151
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 Wafer Demo  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (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 Coders
1 Axis  (9.8)
2 Graham  (9.8)
3 Lft  (9.8)
4 Crossbow  (9.8)
5 HCL  (9.8)

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