English Amiga Board

English Amiga Board (http://eab.abime.net/index.php)
-   Coders. Releases (http://eab.abime.net/forumdisplay.php?f=115)
-   -   Optimized Player 6.1 Playroutine 'p6107.lha' (http://eab.abime.net/showthread.php?t=51557)

Photon 13 March 2010 17:25

Optimized Player 6.1 Playroutine 'p6107.lha'
 
Important: I've updated The Player (P61) playroutine since this post! The latest version, P6112 is available from Aminet. Use that instead.

Spent more time than expected on optimizing p6106.lha from Aminet. Optimization was done last weekend+Monday for testing a bunch of modules, and then I tried SetPosition (the routine to jump to a certain songposition under program control), and it didn't work.

Well, it didn't work in the original either, most likely it has never worked with compressed patterndata. So the routine was probably untouched since the playroutine versions before ThePlayer came :)

After digging into the original code even more (bluergh) and using what I learned when I recoded the decrunch-part, I made it aware of the compression scheme, and it worked. Then I made it callable on any P61_cn (on any frame) and take effect immediately.

While I was there I noticed a bug in SetPosition that was also present in Bxx/Dxx/NextPattern, but not in P61_Init, to set the 'new pattern trackdata ptrs'. This is probably seldom noticed, it only takes effect when compressed patterndata is >32K. The new correct code also was a few cycles faster.

This took several days and lots of cursing, and then it was time for final-testing, documentation and general cleanup.

I ran speed measurement of all the modules and made a table, which showed "playroutine takes max 5.5 scanlines instead of 7.5" for all modules. Except one, the worst case one, which was only 1.7 scanlines faster instead of 2.


I also uploaded it to Aminet just now, so it should be available there soon I hope.

I've delved deeper than anyone since the original authors, I think. (And I hated every minute of it. :P) So if you have questions or feedback, ask me now before I've forgotten everything. :)

There's a lot of documentation and comments in the sources and readme though.

pmc 13 March 2010 17:39

Legendary work Photon! :bowdown

kriz 13 March 2010 17:44

Real cool work man!!

hitchhikr 13 March 2010 20:36

Nice, but it's still based on protracker which wasn't really good to begin with and didn't exploit the whole range of Paula's capabilities.

pmc 13 March 2010 22:10

Quote:

Originally Posted by hitchhikr
Nice, but it's still based on protracker which wasn't really good to begin with and didn't exploit the whole range of Paula's capabilities.

In that case, what would you recommend as a better alternative...?

hitchhikr 13 March 2010 22:54

A brand new protracker :D

pmc 13 March 2010 23:14

A new version of ProTracker would be nice.

But what would a new version need in order to be the daddy...?

hitchhikr 14 March 2010 00:17

Cleaner code (basically restarting from zero using the same look for the interface with a more modern twist), more octaves, waveforms envelopes and maybe modulations presets for instruments.

Frog 14 March 2010 12:18

isn't it called DigiBooster tracker ?

TCD 14 March 2010 14:06

Quote:

Originally Posted by Frog (Post 651642)
isn't it called DigiBooster tracker ?

True. Bet hitchhikr wants to do it from scratch, open sourced and for free. Might take a while to get it done and then it surely would have to be 'backwards' compatible to PT anyway. Happy coding guys ;)

hitchhikr 14 March 2010 15:15

Frog: Digibooster was just a clone of protracker with 8 channels (no envelopes or anything fancy). Digibooster pro imported several FastTracker II features (like volume envelopes) but won't work on an A500 (it needs a 68020 minimum) also afaik it uses AHI (so probably no Paula) and the replay routine is outrageously huge and yes, it's a closed source commercial product.

Photon 15 March 2010 01:04

Thx 4 kudos!

Tried Musicline? What I've heard of it reveals that the quality is there.


When it comes to music programs that go beyond the Protracker features, envelopes are fine, and you can do some effects basically for free, but as soon as you add more channels and/or sound processing, you're looking at a lot more CPU time consumed. For the ordinary solutions - buffering and sound mixing - this needs to take place frequently and on time, which means a frequent interrupt which must finish in time for the next interrupt.

On the 68000, this solution basically means "not too much CPU/DMA used besides playing the music, or it will be run ass-slow". Which means that for games or demos, or even normal Workbench use, you need 68020 and probably fastram.

Extra octaves is easy, just sample the instrument for a couple of octaves to increase the range. There's no other way of magically making very low notes sound good on any platform. The only thing you can do if quality is lacking on a sample "that is already on your harddisk" is to resample+filter+eq it in a high-end program, or convert it from 16-bit to "14-bit" and add even more CPU processing to the replay.

At the high octaves end, there is no way to beat the 28KHz limit other than feed individual samples to Paula very rapidly using an interrupt or similar, which on 68000 will steal a huge chunk of the CPU time just because ...the musician won't resample a sound? :)


I like Protracker, and I like how sampled instruments/vocals give more life to a song. I'm not saying I don't love chipmusic, because I'm guilty of having fresh.ogg on while coding a lot of the time :) But of the features hitchhikr lists, many of them can be made on high-end equipment before composing, such as studio PCs and virtual or real analog synthesizers.

The Amiga isn't really made for chipmusic, which was invented for lower spec home computers that had synthesizer chips to help the slow CPU play sounds. Amiga steps that up to a different technology, samples, and helps the slow CPU play samples. Porting chipmusic to Amiga makes it awkward, and raising the bar to PC specs (more channels, higher quality) makes it even more of a bastard ;) In many visual or calculation aspects, tricks can be pulled to wring more out of the hardware, but with the audio hardware it's different. There's no way out for high spec chipmusic than to raise the CPU specs of the Amiga platforms capable of running it.

Also, no high end music program will make a song interesting or enjoyable. Composition and 'immersion in the barrage of sounds' is at least to me what makes me play a song again.

There I go, lecturing (or informing) again. But it was like, 'musicians want just a few more channels and just play it an octave higher, how hard can it be!?' and ... this is how hard it can be. :)

I bet you know all this already. But actually I got some ideas while typing (a favorite hobby of mine) this. I already have some 8 channel experiments with synth-like effects from back when, but I have many projects I need to finish before I start on a whole new music program.


If you don't mind stepping up the specs though, check out MusicLine. It has 8 channels, chip music instruments and samples.

pmc 15 March 2010 09:50

Quote:

Originally Posted by Photon
I like Protracker

So do I. :)

With all those demos and games using ProTracker songs and sooooo many classic .mods and great memories from listening to that stuff it can't be *that* bad. :D

So, again, great work on the replayer code fixes. :great

TheDarkCoder 16 March 2010 13:40

Well done Photon!

I did the 610.6 patch and that time I had noticed that SetPos didn't work.
But I was unable to fix it, a deep understanding of the p61 working was needed and I don't have it :-(

My patch was just the consequence of noticing a evident bug using 020 flag and my own researches on interrupts management on the Amiga.

So I am very happy that you finally fixed the stuff! ;)

Noname 16 March 2010 18:50

Quote:

Originally Posted by Photon (Post 651461)
Download it here.
I've delved deeper than anyone since the original authors, I think. (And I hated every minute of it. :P) So if you have questions or feedback, ask me now before I've forgotten everything. :)

Good stuff. Although I haven't tried it, yet, I wanted to mention that P61 sometimes needed some pattern position(s?) in the beginning of a song after a reboot to get the speed right. Always felt like some variables or registers had not been initialised correctly. Have you discovered this issue as well?

Leffmann 17 March 2010 02:31

Great fix Photon, thanks a lot

Quote:

Originally Posted by Noname (Post 652331)
Good stuff. Although I haven't tried it, yet, I wanted to mention that P61 sometimes needed some pattern position(s?) in the beginning of a song after a reboot to get the speed right. Always felt like some variables or registers had not been initialised correctly. Have you discovered this issue as well?

Sounds odd. Not sure why a reboot would cause this if stopping and reinitialising the module wouldn't. The Amiga audio hardware is not aware of pattern speed and position, those are concepts that only exist in the replay routine.

A common mistake is to return from an interrupt, in which you call the replay routine, before the interrupt request bit has been cleared, and the interrupt might trigger immediately again and the replay routine gets called twice. Maybe that's it?

Photon 17 March 2010 13:12

Quote:

Originally Posted by Noname (Post 652331)
Good stuff. Although I haven't tried it, yet, I wanted to mention that P61 sometimes needed some pattern position(s?) in the beginning of a song after a reboot to get the speed right. Always felt like some variables or registers had not been initialised correctly. Have you discovered this issue as well?

Well, if you can describe it more accurately (if you remember) or send a module that doesn't replay right (with the converter's play button), or suggest a test case I might have a chance to fix it.

There are two things I don't understand in your description:
1) need some pattern positions? Make the song longer by inserting one or two whole patterns? I think you mean the musician forgot to put an Fxx command in the very first step in the first pattern of the song? If there is no Fxx command there, you get F06 by default.
2) after a reboot? You sure you don't mean song restart? If the song changes speed during the song, and it not reset at the very first step (see 1)), then it will continue at the last set speed and not revert to default speed 6 - as it would if you start playing the module from the start.

You can test this in Protracker if you set speed 2 as default in the Setup panel. All the songs that play correctly then have set the speed properly.

Noname 19 March 2010 00:33

Guys, I mixed things up. The bug I mentioned was inherent to Tracker Packer and could be fixed by playing the module for a moment, then restarting it. Sorry for the confusion.

@Leffmann: I am not actively trying to get it working right now. My observation was from ten years ago, when I made P61 work on A4060 and integrated it into my demosystem in the first place.

pmc 19 March 2010 08:24

Quote:

Originally Posted by Noname
My observation was from ten years ago... my demosystem...

What demos did you make Noname? Got any links to them so we can see your work...? :)

Noname 19 March 2010 10:31

Quote:

Originally Posted by pmc (Post 653205)
What demos did you make Noname? Got any links to them so we can see your work...? :)

I started with Sector 7 and then joined Haujobb in 1997, after releasing Synergy with JCS and Marc. Our bigger productions, each with screenshots, are available at Amiga Demoscene Archive (c.f. list filtered by noname).


All times are GMT +2. The time now is 06:23.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.

Page generated in 0.04513 seconds with 11 queries