| |
Starfox
Registered: Jul 2014 Posts: 42 |
Coding a small demo. Rules about music?
Hello,
I'm coding a small demo, after having coded the last one 27 years ago (lol), and while coding it I have used an older GREAT placeholder tune. Now, I could keep using that tune in the release as I got in contact with the composer, and he said I could use it, no problem.
But the music routine is taking a bit too much rastertime (peaks at around 30 lines), and that's just too much - since my effect takes up almost all available rastertime, and because of that I have to cut back the size of the effect, which is a bummer.
I know there are more optimized routines out there today that take much less rastertime, but I am concerned that since it is of newer date, that it would not be acceptable to just use one of those tunes?
I also got the idea that maybe I could transplant the music data from the placeholder tune into a newer more optimized player, but it seems like a bit of a challenge lol.
Anyone have any ideas as to what I could do?
Peter |
|
... 17 posts hidden. Click here to view all posts.... |
| |
Starfox
Registered: Jul 2014 Posts: 42 |
It's doing something that can't really be changed and takes 52 cycles per line (STA/STX/STY) + 9 for "loop" + 2 wasted cycles on a nop to make it 63 cycles. I bet someone can already guess the overall theme of the effect by now.
I guess without the "loop" I would have 11 cycles free per line. Maybe that would be enough to play some notes?? |
| |
Flavioweb
Registered: Nov 2011 Posts: 463 |
I suppose you need the cycles, both for "normal" play or "dumped" play, almost in a "consistent block", otherwise is useless to -gain- 10/11 cycles per line because you can't execute a "play" here to "dump" and play sounds, or execute code outside irqs...
And if you need to be in cycle-exact timing with raster beam, it's just impossible to "move" cycles from where they "are".
The only thing is to reduce cycles in the "work" part outside visualization area...
Maybe using some precalculated values or so... in the part of code that isn't just lda/sta'ing bytes around...
But you need 1890 cycles... |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
1 raster tracker will do if 30 lines tracker almost cuts it. |
| |
Starfox
Registered: Jul 2014 Posts: 42 |
Flavioweb, Yeah, I did consider using the last cycles of 200+ rasterlines to do an LDA ADDR - STA ADDR to help the draw routine, but other problems pop up then, where the effect become kind of distorted because to make it look decent - I have to find the best compromise between the number of real rasterlines, and how many times they are duplicated to make the effect fill as much of the screen as possible. And yeah, I will have to figure out if I can use even more precalculated tables.
But the routine is nothing special, I just wanted to see if I could code a small demo again after all these years =)
Oswald, I checked that player out, and I also tried experimenting with reading the sid registers when the IO area is in ram mode, and then writing them back after switching back to normal mode. The music sounded a little weird and distorted, but it wasn't hard to recognize. I'm not sure it's worth the hassle though as it would take up too much ram, but it is an interesting idea =) |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
yup, the timing & order of the sid writes is a sensitive thing. |
| |
Dr.j
Registered: Feb 2003 Posts: 277 |
@Starfox: sorry to interfere but i think the easy and
comfort way is to..simply find another sid from dozens
of HVSD sids that they aren't that big rasters consumers , i believe most of the tunes with Jch player and the latest most used players are okey to use or better to use hermit
1 raster player like Oswald already suggest |
| |
Starfox
Registered: Jul 2014 Posts: 42 |
Ahh, yeah probably screwed up the timing and order of writing the values back =/ I even made some music routines back in the day, but can't remember anything about it lol.
And I guess you are right Dr.J, but I will give just a little more time to see if I can make it work with this tune. And as you suggest, it should be possible to find something. I gotta admit, I only heard a few tunes in that hermit player. They sounded a bit like it was made for a 4k demo =) |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
I think order is more important than timing. But cant help you out with that. |
| |
4mat
Registered: May 2010 Posts: 66 |
Writing the sid registers in reverse order is "better" in a lot of cases. |
| |
Starfox
Registered: Jul 2014 Posts: 42 |
Tried reverse order and it now sounds identical. Now I just need to calculate if there's enough memory left (probably not) but I have an idea I want to try where it starts off by recording voice 1, and while recording it scans for patterns so it only stores each different pattern, and it updates an index table where it keeps track of which pattern just appeared. then dump that voice out, and do it again with the next voice, and the next.
Then I should have kind of patterns for each voice, and just make a small player that plays pattern X for each voice.
Should work in theory lol
Also, I'm already noticing (by dumping the sid data to screen) that some values never change, that might be space saved |
Previous - 1 | 2 | 3 - Next |