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: 11386
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: 1648
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: 245
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: 1648
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: 1648
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
New Design/Excess
kbs/Pht/Lxt
MightyAxle
LDX#40
algorithm
Peacemaker/CENSOR/Hi..
Mibri/ATL^MSL^PRX
Guests online: 93
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.3)
Top Graphicians
1 Mirage  (9.8)
2 Archmage  (9.7)
3 Pal  (9.6)
4 Carrion  (9.6)
5 Sulevi  (9.6)

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