Skip to content

Web version of vgmPlay

Technical discussion about the VGM format, and all the software you need to handle VGM files.

Moderator: Staff

  • tinyrsid Offline
  • Posts: 35
  • Joined: 2015-05-19, 22:03:39

Web version of vgmPlay

Post by tinyrsid »

Just did a WebAudio version of vgmPlay: http://www.wothke.ch/webvgm/

Cheers.
  • User avatar
  • grauw Offline
  • Posts: 150
  • Joined: 2015-02-22, 3:40:22

Post by grauw »

Very nice!
  • User avatar
  • MaliceX Offline
  • Posts: 226
  • Joined: 2012-09-29, 11:45:48
  • Location: Australia
  • Contact:

Post by MaliceX »

Whoaaaaa. This thing actually works! Although the clock speed seems to be a tad too slow (though I suspect it might be the audio handler being rendered at 48kHz and played at 44.1kHz), it seems to achieve the task nicely. Interestingly, certain lower clocked VGM's also have a lower sample rate which is a nice side effect. :)

BTW, welcome!
-dj.tuBIG/MaliceX

Post by Kaminari »

They sound more like they're replayed at 50 Hz instead of 60, but otherwise the quality is indeed very nice.
  • User avatar
  • RichterEX2 Offline
  • Posts: 191
  • Joined: 2012-03-30, 9:28:37
  • Location: Georgia, USA

Post by RichterEX2 »

Everything plays super high-pitched and fast on my end. Probably because I usually have my audio out set to 192Khz.
  • User avatar
  • MrKsoft Offline
  • Posts: 25
  • Joined: 2012-05-24, 19:11:36

Post by MrKsoft »

Yeah, it definitely varies depending on the output rate of your audio adapter. I just switched from the default 44100 to 48000 on my sound card and now everything sounds correct.
The Wafflenet OPL Archive
PC/DOS demoscene & tracker music... in VGM format!
  • tinyrsid Offline
  • Posts: 35
  • Joined: 2015-05-19, 22:03:39

Post by tinyrsid »

MaliceX wrote:Whoaaaaa. This thing actually works! Although the clock speed seems to be a tad too slow (though I suspect it might be the audio handler being rendered at 48kHz and played at 44.1kHz), it seems to achieve the task nicely. Interestingly, certain lower clocked VGM's also have a lower sample rate which is a nice side effect. :)

BTW, welcome!

oops.. I forgot to add my WebAudio-side resampling code.. (e.g. like I am using in my SpectreZX player: http://www.wothke.ch/tinyrsid/index.php ... io-players).. so samples are generated for 44.1kHz but are currently played with whatever rate the browser is using.. (Chome 48kHz, Firefox 44.1kHz - or whatever audio settings you have on your machine..)

I better fix that :-)
  • User avatar
  • MaliceX Offline
  • Posts: 226
  • Joined: 2012-09-29, 11:45:48
  • Location: Australia
  • Contact:

Post by MaliceX »

Hi tinyrsid,

I did some more testing last night and I've encountered a number of issues.
  • some vgm files using OKIM6258 or HuC6280 output via Data Block commands don't appear to work correctly.
  • OPL2/3 (adlibemu dosbox core?) Rhythm mode snare drum internal noise generator is not modulating the operator.
  • Fade segment during playback blocks loading next song.
  • You can only drag a vgm into the player once. Repeated attempts are blocked for previously played files. The next/prev buttons also currently don't appear to do anything useful in that regard.
  • There seems to be an ongoing JS error saying something about a value being over the size limit being logged during playback in FireBug
Some of the bugs don't exist in the standalone vgmplay code, so I suspect something may have been accidenrally broken on porting to emacripten.
-dj.tuBIG/MaliceX
  • tinyrsid Offline
  • Posts: 35
  • Joined: 2015-05-19, 22:03:39

Post by tinyrsid »

tinyrsid wrote: I better fix that :-)
done
  • tinyrsid Offline
  • Posts: 35
  • Joined: 2015-05-19, 22:03:39

Post by tinyrsid »

MaliceX wrote:Hi tinyrsid,

I did some more testing last night and I've encountered a number of issues.
  • some vgm files using OKIM6258 or HuC6280 output via Data Block commands don't appear to work correctly.
  • OPL2/3 (adlibemu dosbox core?) Rhythm mode snare drum internal noise generator is not modulating the operator.
  • Fade segment during playback blocks loading next song.
  • You can only drag a vgm into the player once. Repeated attempts are blocked for previously played files. The next/prev buttons also currently don't appear to do anything useful in that regard.
  • There seems to be an ongoing JS error saying something about a value being over the size limit being logged during playback in FireBug
Some of the bugs don't exist in the standalone vgmplay code, so I suspect something may have been accidenrally broken on porting to emacripten.
thx for testing.. unfortunately I don't have any idea about the inner workings/features of the original vgmPlay.. I might just not be using the "right" emulation mode for single threaded use of the vgmPlay code.. some insights from somebody familiar with the vgmPlay code might help to resolve the issues quickly.. (it also would be useful to know what song files are using a specific feature and are therefore useful test cases - at first I had used code snippets from PlayVGM_UI() but am now using FillBuffer() directly because it did not seem to make any difference with the songs that I had played..)

However there might just be some bugs left in the original code which prevent it from running correctly when compiling with Emscripten. I don't know what HW architectures vgmPlay has already been successfully tested on... (The author of the original code of one of my other players had also claimed his code was portable when in fact he had always used is on some kind of x86 platform ;-) and I already fixed some potential unaligned memory access issues...

Regarding the UI: The buttons switch between different songs in the configured playlist - but I only put in one song at the moment.. I fixed the issue of repeated "drops" being blocked..
  • tinyrsid Offline
  • Posts: 35
  • Joined: 2015-05-19, 22:03:39

Post by tinyrsid »

MaliceX wrote: [*]There seems to be an ongoing JS error saying something about a value being over the size limit being logged during playback in FireBug[/list]
Might have been due to the displayed frequency spectrum... I just updated the HTML/CSS so that the page also works in Firefox - which it didn't before. I hope this also resolved the above issue.

Post by vampirefrog »

sweet player bro
do you mind if we use it on our site? it would decrease server bandwidth usage if we server VGM files instead of mp3's like we do now. that and later we can add a visualisation mode that shows the actual chip notes.

I've taken a look, and it seems to eat up 50% cpu (so, 1 of 2 cores) all of the time, even when paused. How low do you think you can get the CPU consumption to go?
  • tinyrsid Offline
  • Posts: 35
  • Joined: 2015-05-19, 22:03:39

Post by tinyrsid »

vampirefrog wrote:sweet player bro
do you mind if we use it on our site? it would decrease server bandwidth usage if we server VGM files instead of mp3's like we do now. that and later we can add a visualisation mode that shows the actual chip notes.

I've taken a look, and it seems to eat up 50% cpu (so, 1 of 2 cores) all of the time, even when paused. How low do you think you can get the CPU consumption to go?
sure, go ahead and use it (sources can be found here: https://github.com/wothke/vgmplay-0.40.5)..

As for the CPU load I think that most of it is actually coming from the visuals.. (On my old 3GHz P4 the page runs at around 50% CPU - but the moment I change the browser tab (and the music keeps playing in the respective invisible background browser tab) CPU load immediately drops to 15%-25% in Chrome and to 7%-15% in Firefox (depending on the song).. CPU-load wise, replacing the visuals would certainly be a quick win.. other than that, the code is already built with all the performance optimizing compiler options that I am aware of... next thing would be to look into the original C code to see what can be done there..

As for the remaining flaws (see comments above): It would be helpful to have some background info from somebody familiar with the original vgmPlay design. Maybe you know somebody that could lend me a helping hand? :-)

Admin edit: fixed github link

Post by vampirefrog »

I might know a guy.
  • tinyrsid Offline
  • Posts: 35
  • Joined: 2015-05-19, 22:03:39

Post by tinyrsid »

vampirefrog wrote:I might know a guy.
cool.. maybe he can drop me a PM or email..
Post Reply