mrk Posted September 17, 2021 Share Posted September 17, 2021 (edited) Recently I was working a bit on POKEY emulator working in a browser (this is a part of bigger project - atari emulator in a browser, I'll create separate topic about that soon) and I want to share results with you: https://github.com/mrk-its/web-pokey Please take a look on live examples https://github.com/mrk-its/web-pokey#live-examples and let me know what do you think about that. For example this https://mrk.sed.pl/web-pokey/examples/pokey-regs/ demo allows you to provide values of POKEY registers, please let me know if you find significant differences between real atari / Altirra and generated sound (you can copy & paste link with register values here). Other example is SAP type R player: https://mrk.sed.pl/web-pokey/examples/sap-player/#https://atarionline.pl/forum/?PostBackAction=Download&AttachmentID=16744 Let me know what do you think about, thanks! Edited September 18, 2021 by mrk 8 3 Quote Link to comment Share on other sites More sharing options...
VinsCool Posted September 18, 2021 Share Posted September 18, 2021 Looks really nice! Just a question, how do we feed SAP files into the player? Quote Link to comment Share on other sites More sharing options...
mrk Posted September 18, 2021 Author Share Posted September 18, 2021 (edited) 15 hours ago, VinsCool said: Just a question, how do we feed SAP files into the player? Simply append SAP url to player url with '#' as separator EDIT: few examples from project README: https://mrk.sed.pl/web-pokey/examples/sap-player/#https://atarionline.pl/forum/?PostBackAction=Download&AttachmentID=16742 https://mrk.sed.pl/web-pokey/examples/sap-player/#https://atarionline.pl/forum/?PostBackAction=Download&AttachmentID=16743 https://mrk.sed.pl/web-pokey/examples/sap-player/#https://atarionline.pl/forum/?PostBackAction=Download&AttachmentID=16744 Edited September 18, 2021 by mrk 2 Quote Link to comment Share on other sites More sharing options...
ascrnet Posted September 18, 2021 Share Posted September 18, 2021 Great job thanks for sharing it, some time ago i wanted to make a music player for my wiki. i did it, but i didn't like very much the mp3 result. i tried to test your web pokey using the following form, but without results. ? https://mrk.sed.pl/web-pokey/examples/sap-player/#https://www.atariware.cl/archivos/sap/bruce_lee.sap Quote Link to comment Share on other sites More sharing options...
mrk Posted September 18, 2021 Author Share Posted September 18, 2021 (edited) 1 hour ago, ascrnet said: i tried to test your web pokey using the following form, but without results. ? https://mrk.sed.pl/web-pokey/examples/sap-player/#https://www.atariware.cl/archivos/sap/bruce_lee.sap because this is not 'type R' SAP: SAP AUTHOR "<?>" NAME "Bruce Lee" DATE "1984" NTSC TYPE B FASTPLAY 262 INIT 982C PLAYER 98BC TIME 01:04.278 I'll add some section displaying header and information about invalid sap type. Unfortunately other than 'R' types require some kind of atari emulation, so supporting them is a bit harder - definitely doable, but out of scope of this example Edited September 18, 2021 by mrk 1 Quote Link to comment Share on other sites More sharing options...
ascrnet Posted September 18, 2021 Share Posted September 18, 2021 29 minutes ago, mrk said: because this is not 'type R' SAP thanks for the clarification, I thought it supports all types B,C,D. ? 30 minutes ago, mrk said: I'll add some section displaying header and information about invalid sap type. Unfortunately other than 'R' types require some kind of atari emulation, so supporting them is a bit harder ? Quote Link to comment Share on other sites More sharing options...
mrk Posted September 18, 2021 Author Share Posted September 18, 2021 24 minutes ago, ascrnet said: I thought it supports all types B,C,D. ? I've just pushed update - SAP header / error message is visible now 2 Quote Link to comment Share on other sites More sharing options...
rensoup Posted September 18, 2021 Share Posted September 18, 2021 3 hours ago, mrk said: I've just pushed update - SAP header / error message is visible now Is it possible to play a local file ? Does the header need to be complete ? I can save SAPR easily with my RMT2LZSS converter but I don't fill the duration parameter nor the play type. Quote Link to comment Share on other sites More sharing options...
mrk Posted September 18, 2021 Author Share Posted September 18, 2021 (edited) 1 hour ago, rensoup said: Is it possible to play a local file ? Not yet, but I can easily add that. 1 hour ago, rensoup said: Does the header need to be complete ? I can save SAPR easily with my RMT2LZSS converter but I don't fill the duration parameter nor the play type. Header doesn't need to be complete, but `type` needs to be present. I can make it optional, assuming R if not present. type defaults to `R` if not present (just fixed) Edited September 18, 2021 by mrk 2 Quote Link to comment Share on other sites More sharing options...
rensoup Posted September 19, 2021 Share Posted September 19, 2021 (edited) ok I've changed my converter to output time just in case, small test: emkay's hybris mod conversion hybrisl1.sap https://mrk.sed.pl/web-pokey/examples/sap-player/#https://atariage.com/forums/applications/core/interface/file/attachment.php?id=876075 VinsCool's Xenon conversion: https://mrk.sed.pl/web-pokey/examples/sap-player/#https://atariage.com/forums/applications/core/interface/file/attachment.php?id=876078 VinsCool's Battle Squadron conversion at 100hz (too slow, messed up the conversion) https://mrk.sed.pl/web-pokey/examples/sap-player/#https://atariage.com/forums/applications/core/interface/file/attachment.php?id=876077 Enderdude's Bionic commando at 100hz (too slow, messed up the conversion) https://mrk.sed.pl/web-pokey/examples/sap-player/#https://atariage.com/forums/applications/core/interface/file/attachment.php?id=876076 The 100hz tunes should have been 50hz but my converter has a bug and outputs the raw data... perhaps a switch to select playback frequency ? The 50hz tunes seems to play fine! no idea if they're dead accurate but it sounds pretty good, very nice! Bionic_Stage_1mk.sap Battle Squadron Title 100hz Final.sap Xenon Final.sap Edited September 19, 2021 by rensoup 2 Quote Link to comment Share on other sites More sharing options...
mrk Posted September 19, 2021 Author Share Posted September 19, 2021 (edited) 12 hours ago, rensoup said: The 100hz tunes should have been 50hz but my converter has a bug and outputs the raw data... perhaps a switch to select playback frequency ? Fixing these files is as simple as adding FASTPLAY 156 line to header, right? Here are fixed versions: Battle_Squadron_Title_100hz_Final_fixed.sap Bionic_Stage_1mk_fixed.sap Quote The 50hz tunes seems to play fine! no idea if they're dead accurate but it sounds pretty good, very nice! That's great to hear! If something sounds wrong please point me frame number(s) from player, I'll try to debug it. Battle_Squadron_Title_100hz_Final_fixed.sap Bionic_Stage_1mk_fixed.sap Edited September 19, 2021 by mrk 4 Quote Link to comment Share on other sites More sharing options...
rensoup Posted September 19, 2021 Share Posted September 19, 2021 10 hours ago, mrk said: Fixing these files is as simple as adding FASTPLAY 156 line to header, right? Here are fixed versions: Yes indeed, sounding great as well ! Confirmation from the authors ? @VinsCool @emkay @EnderDude 2 Quote Link to comment Share on other sites More sharing options...
EnderDude Posted September 19, 2021 Share Posted September 19, 2021 18 minutes ago, rensoup said: Yes indeed, sounding great as well ! Confirmation from the authors ? @VinsCool @emkay @EnderDude You have my confirmation! 100hz can be useful to go between two different frequencies and have finer phasing control, but it does come at a cost! 1 Quote Link to comment Share on other sites More sharing options...
emkay Posted September 19, 2021 Share Posted September 19, 2021 On a first listen it sounds correct. 1 Quote Link to comment Share on other sites More sharing options...
VinsCool Posted September 19, 2021 Share Posted September 19, 2021 33 minutes ago, rensoup said: Yes indeed, sounding great as well ! Confirmation from the authors ? @VinsCool @emkay @EnderDude Battle Squadron sounds spot on to me! Sounds about exactly what I remember doing for it. 20 hours ago, rensoup said: VinsCool's Xenon conversion: Hmm something with the Poly5 (Distortion 2) emulation is off, things sound weird with it ? 1 Quote Link to comment Share on other sites More sharing options...
mrk Posted September 19, 2021 Author Share Posted September 19, 2021 (edited) 18 minutes ago, VinsCool said: Hmm something with the Poly5 (Distortion 2) emulation is off, things sound weird with it ? I had some problems with Poly5 some time ago and instead of computing it copied table from atari800. Now I reverted it (for test) Could you test it again? Any difference? Edited September 19, 2021 by mrk Quote Link to comment Share on other sites More sharing options...
VinsCool Posted September 19, 2021 Share Posted September 19, 2021 7 minutes ago, mrk said: I had some problems with Poly5 some time ago and instead of computing it copied table from atari800. Now I reverted it. Could you test it again? Any difference? I can't say I could notice a difference really... I know ASAP player also has similar issues with Poly5 sounds for some reason. This is what is sounds like from my hardware for reference (PAL 800xl) Quote Link to comment Share on other sites More sharing options...
rensoup Posted September 19, 2021 Share Posted September 19, 2021 10 minutes ago, EnderDude said: You have my confirmation! 100hz can be useful to go between two different frequencies and have finer phasing control, but it does come at a cost! nah, not when encoded with LZSS, it'll still be faster than a RMT tune played back at 50hz... I've added the 100hz & 50hz versions, I can't really tell the difference but I don't have a great HW audio setup (ears aren't in good shape either!) Bionic_Stage_1_50hz.obx Bionic_Stage_1.obx 1 Quote Link to comment Share on other sites More sharing options...
rensoup Posted September 19, 2021 Share Posted September 19, 2021 28 minutes ago, mrk said: I had some problems with Poly5 some time ago and instead of computing it copied table from atari800. Now I reverted it (for test) How accurate do you think your emulator is ? @ivop's been looking into changing the Pokey emulator used in RMT perhaps your would be a potential candidate ? 1 Quote Link to comment Share on other sites More sharing options...
mrk Posted September 19, 2021 Author Share Posted September 19, 2021 9 minutes ago, VinsCool said: I can't say I could notice a difference really... I know ASAP player also has similar issues with Poly5 sounds for some reason. As I see Poly5 is on channel3 (with 1.79Mhz clock), right? I'll try to compare sound for few AUDC3 / AUDF3 register values with Altirra, thanks! 1 1 Quote Link to comment Share on other sites More sharing options...
VinsCool Posted September 19, 2021 Share Posted September 19, 2021 12 minutes ago, mrk said: As I see Poly5 is on channel3 (with 1.79Mhz clock), right? I'll try to compare sound for few AUDC3 / AUDF3 register values with Altirra, thanks! Here's the channel 3 itself playing alone (also recorded from the same hardware, used in the oscilloscope video) if you think this may be helpful Xenon In-Game Music #1 STEMS-03.wav 1 Quote Link to comment Share on other sites More sharing options...
mrk Posted September 19, 2021 Author Share Posted September 19, 2021 5 minutes ago, rensoup said: How accurate do you think your emulator is ? I'm just trying to figure it out - that's also why I'm asking about your opinion here I think it is built on solid base and implements already most of pokey features (one missing thing is SKCTL support: two-tone or pokey reset), personally I'm quite happy with results. 15 minutes ago, rensoup said: @ivop's been looking into changing the Pokey emulator used in RMT perhaps your would be a potential candidate ? Maybe, but it works in web browser (with WebAudio API, like recent chrome or firefox), so it would require embedding browser some way. But this implementation is quite simple and probably can be quite easy ported to other language. 1 Quote Link to comment Share on other sites More sharing options...
mrk Posted September 19, 2021 Author Share Posted September 19, 2021 7 minutes ago, VinsCool said: Here's the channel 3 itself playing alone (also recorded from the same hardware, used in the oscilloscope video) if you think this may be helpful Thanks, it should be helpful 1 Quote Link to comment Share on other sites More sharing options...
ivop Posted September 19, 2021 Share Posted September 19, 2021 (edited) 36 minutes ago, rensoup said: How accurate do you think your emulator is ? @ivop's been looking into changing the Pokey emulator used in RMT perhaps your would be a potential candidate ? Perhaps it hasn't been clear yet, but the main problem with RMT is its inherent timing, which is... ehm... wrong, and cannot be fixed without the RMT source code. Even if phaeron were to create a Pokey library for RMT based on Altirra, it would be all over the place, timing wise. So, a waste of time. We have to make do with apokeysnd during composition, even though its resampling is fixed and does not vary between NTSC and PAL. Edit: in the end, we need a new tracker editor Hi emkay! But after all these years, I must say he was right all along about needing a new tracker, even though not for the exact reasons discovered recently. Edited September 19, 2021 by ivop 2 Quote Link to comment Share on other sites More sharing options...
ivop Posted September 19, 2021 Share Posted September 19, 2021 4 minutes ago, mrk said: Maybe, but it works in web browser (with WebAudio API, like recent chrome or firefox), so it would require embedding browser some way. I don't think it's worth the trouble, as the RMT timing problem will always remain. 4 minutes ago, mrk said: But this implementation is quite simple and probably can be quite easy ported to other language. Yes, I looked at your javascript source code, and it's pretty, pretty, pretty clean 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.