Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user eightbitswide ! (Registered 2024-12-24) You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Music fading, file loading
2004-07-31 08:31
Optimus

Registered: Jan 2002
Posts: 122
Music fading, file loading


I don't know anything about music coding, more than just initialiazing and calling the player. But how easy it is to fade out the music? Do I have to write SID code? My last choice would be to write the music so that it fades in one point, but perhaps I would prefer to press a key and music fading at any point..

Then, is there a system call or anything to load a PRG file from the disk? So that I can load from my asm code the next part of my demo. A simple example..

p.s. I know I should be searching this in my docs instead before asking here, but somehow I felt I don't have much time. I hope you can give me an answer, I am still learning a bit..
2004-07-31 09:17
Case

Registered: Aug 2002
Posts: 142
Some music players have there own "fade" routines in, or another way to do it is to find the player's volume code ($d418) and write a routine that decreases this.

there are kernal routines for loading from disk, however they are very slow. I would suggest you look at some of the old multi-part demos and find the fast-loaders they used and then use it yourself ... or make yourself a cool irq loader, theres loads of them out there (covert bit-ops) for example.
2004-07-31 09:49
SIDWAVE
Account closed

Registered: Apr 2002
Posts: 2238
find the byte in player that controls D418, then:

LDA .volume
ORA #$10 (if filter is 10, else use 30 or 00)
use what the player uses!
STA D418
RTS


if you find the STA D418 in musicplayer, and replace with JSR to your new small routine..

Then decrease value of .volume to fade..
2004-07-31 10:12
Optimus

Registered: Jan 2002
Posts: 122
>there are kernal routines for loading from disk, however they are very slow

I was afraid of that. However, the files of the parts might not be that big. Now I am thinking it again, perhaps I will just fit both parts compressed in memory and uncompress each part when I need it. Like an onefiler.

Thanks for the rest about the music. Sounds easy..
2004-07-31 10:55
Vai

Registered: Mar 2002
Posts: 50
What I normaly do for music fade: replace the sta $d418 in the player to $03ff (or whatever you want ;) )
Than implement this in the init of your code:

lda #$0f
sta $03fe
...

Than place this in the IRQ:

lda $03ff
and #$f0
ora $03fe
sta $d418
...

If you decrease $03fe in a small timer till 0 the music fades nicely.

2004-08-02 09:03
Oswald

Registered: Apr 2002
Posts: 5094
optimus:

most (or all?) "modern" music players have a subroutine for fadeout. Look at the player, you should find more jmps than just those 2 to the play and the init routine. Check what the rest of the jmps do, you should find one that plays with d418, or controlls some other part of the player that writed d418.

btw, about d418: the lowmost 4 bits are for the volume, and the 4th bit (4th, if you count em from 0) is for filter, now as 99.9% of music uses filter better leave this bit on, if you plan to controll d418 "manually".

for faaast loading download this release:

Fixup #$00

read the note for instructions.

you should know, that fastloaders replaces the code inside the 1541, so there's a quite big init routine for those loaders with the code for the drive, that will be send into the drive during init. Now this part you can run only once, then forget about it, and just have the loader in the memory.

happy coding!
2004-08-04 20:06
ready.

Registered: Feb 2003
Posts: 441
I was looking for an IRQ loader a few months ago, I found useful The Dreams loader. Look at http://www.the-dreams.de Go to the source-codes section and download Dreamload V2.3, I found it easy to use. Also get the XA assembler to compile the loader source code from the same site. Hope you've got all ya need, if not just ask. later Ready.
2004-08-19 20:57
St0fF

Registered: Oct 2002
Posts: 40
music fading: well yes, most newer players have a fade routine. on the other hand: the volume is very rarely changed in most tracks, if it gets changed at all - so just count down the register of the player, where the volume resides(the one that or_s in the low nybble before storing to $d418). nothing is easier than this.
Dreamload: has very low transfer speed for 2bit transfer if you don't have a lot of rastertime. it's in the way Doc Baccy coded the transfer - doing the gcr-decode while transferring ...
2004-08-19 22:29
Cruzer

Registered: Dec 2001
Posts: 1048
Talking about loaders, if you want the easiest solution, then use a non-irq loader. This means no music/gfx while loading, but it's faster, fills less and is much easier to use.

For instance you can rip the loader I have used in You Know The Routine 1+2. In the first part of YKTR1 it's placed in $0a00-$0bff, but has to be copied to $c000 before loading. Then you just need to put the filename (or some of the first chars followed by a '*') into $c1e3, and jsr $c000 to load a file.
2004-08-20 07:42
HCL

Registered: Feb 2003
Posts: 728
A fast IRQ-loader reaches about 75% speed of a fastloader, and you can play music + show gfx meanwhile. -> The break will feel much longer with a fastloader (my opinion).
2004-08-20 09:42
JackAsser

Registered: Jun 2002
Posts: 2014
Agree, and an IRQ-loader isn't that hard to use either, just make sure that the image you're displaying and the music you're playing + the code for handling this doesn't collide with the new part that you're loading.

/JackAsser
2004-08-20 13:27
Cruzer

Registered: Dec 2001
Posts: 1048
I'm not sure I believe that 75% of fastloader speed, but anyway, the main advantage of a fastloader is that it only fills about $200 bytes. This means that the previous part can use all the remaining $fe00 bytes (99.2% of the mem.) An irq-loader takes more, plus you need some gfx or other stuff that also eats bytes => less memory for the previous effect.
2004-08-20 18:36
Graham
Account closed

Registered: Dec 2002
Posts: 990
no argument actually, since an irqloader once installed also is about 1 to 2 blocks in memory. the one in deus ex machina uses less than $0200 bytes, but $0100 bytes is translation tables which can be avoided with better code.
2004-08-20 19:35
hollowman

Registered: Dec 2001
Posts: 474
the smallest version of krills loader i've used takes $0100 bytes after install.
2004-08-21 01:04
Cruzer

Registered: Dec 2001
Posts: 1048
$100 for an irq-loader? Guess I'm outta excuses then. :) Ok, you still need some extra space for loader gfx/fx, but if the memory is filled up I guess you could just have a blank screen w/ music for a little while, while loading some loadertainment-stuff.

Guess it would be possible to make a fastloader that fills less than $100 though, if it was installed once like an irq-loader. And I would still recommend the fastloader option for n00b's like Optimus. :)
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
SLC
Guests online: 126
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 The Demo Coder  (9.6)
6 Edge of Disgrace  (9.6)
7 What Is The Matrix 2  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 Cubic Dream  (9.6)
3 Party Elk 2  (9.6)
4 Copper Booze  (9.6)
5 X-Mas Demo 2024  (9.5)
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 NTSC-Fixers
1 Pudwerx  (10)
2 Booze  (9.7)
3 Stormbringer  (9.7)
4 Fungus  (9.6)
5 Grim Reaper  (9.3)

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