Page 1 of 2

JAVASCRIPT YM2612~!!!

Posted: Tue Jun 28, 2011 12:25 am
by neologix
STEP 1 OF MY MASTER PLAN IS COMPLETE!!!!!!!!!!

Ladies and gentlemen, I present to you as a proof of concept: the JS2612.

http://www.luxatom.com/vst-2612.php

Not only did I FINALLY get graphable output, I also succeeded in mocking up the connection between a YM2612 (based on genplus-gx) and some implementation (albeit reduced) of the VST SDK. The output is from a constant fnum, but now I can actually put a frequency-to-fnum conversion to take a given MIDI note and generate.

One day I will update my supporting VST.js to actually output sound instead of the raw numbers, but not today! Today is for celebrating the BIRTH of the JS2612!

ym2612-js on github

(cross-posted to smspower, spritesmind, project2612)


(update - if you have firefox 4 or higher, there is a really basic audio preview now on the example page!!! ^______________^ )

Posted: Fri Jul 01, 2011 9:00 pm
by neologix
update: audio preview NOW WORKS IN FIREFOX >= 4, SAFARI 5, AND CHROME! many thanks to the XAudioJS library by grantgalitz for making this happen!

Posted: Sat Jul 02, 2011 2:18 am
by Chilly Willy
Well, seems to work on FF5.0 in Xubuntu... a little slow on my 1.6 GHz CoreDuo, but it is a pretty old system.

Posted: Sat Jul 02, 2011 7:28 am
by TmEE co.(TM)
Works nicely in Opera 11.11, though there's significant delay when sound starts to play, but playback is not choppy etc. 2GHz Athlon 64 here

Posted: Sat Jul 02, 2011 8:48 am
by neologix
I myself experienced a weird delay in safari during first playback after changing the preset, but subsequent playbacks worked fine; I think it has something to do w/filling the audio buffer in a timely manner, but I'm still getting used to xaudiojs.

Oh, and next update to the JS2612 will attempt speed optimizations so it could work decently in the Sphere engine, but I also have an update for VST.js planned that will test out editing individual parameters.

Posted: Mon Jul 04, 2011 3:50 pm
by sega16
I think being able to edit the values would make this the ultimate ym2612 instrument creator.Imagine being able to work on making an instrument on any computer.

Posted: Mon Jul 04, 2011 6:57 pm
by Chilly Willy
Well, it's one platform-independent way of making instruments that anyone can use. Maybe if you add a chat box to the page, you could have people interacting easier while trying instruments.

Posted: Mon Jul 04, 2011 10:03 pm
by neologix
fundamentals first ;) the "edit individual parameters" update is definitely the higher priority one, and will give immediate results once done correctly, not only for the JS2612 but also for the other proof-of-concept js vst I made - a js port of the mda dx10 vst.

regarding socializing instrument creation, that's more of a "future possible plans" thing which will be easier to handle if/when a php ym2612 core is made, as server-side tech would also allow more direct database interaction to save, load, and all-around source control instruments.

also, social instrument creation & chatboxing sounds like something more suited to an established site like project2612; if/when I get to that point I'll definitely be approaching dark pulse and other p2612 admins abt it first, and if that's not possible THEN I'll be doing it myself.

Posted: Wed Jul 13, 2011 2:36 pm
by neologix
update: you can now edit individual parameters with semi-realtime results (ie, changes take effect when you let go of the button)! i did whatever i could in safari 5, chrome 14, and firefox 5, but if there's an issue w/it working in x or y browser let me know. also, i need to add some visual feedback that something's happening (a throbber or something), so you don't have to tell me that.

http://www.luxatom.com/vst-2612.php

Posted: Wed Jul 13, 2011 9:04 pm
by Chilly Willy
That works, but sometimes, on Firefox 6, the PLAY button isn't responsive... you have to click it multiple times, and sometimes it will play, and sometimes it only plays part of the sound, and sometimes it works the way it's supposed to several times in a row, then stops working.

Posted: Wed Jul 13, 2011 11:34 pm
by neologix
i get a similar reaction when i open it in safari 5, but that was even before i added parameter editing. all my firefoxes are still at 5, tho.

i updated the version of xaudiojs it uses. i'm still trying to get used to it and web audio in general, so maybe i'm still doing it wrong. in any case, there isn't much work left for me to do to the js2612 before moving on to other chips.

Posted: Mon Aug 29, 2011 11:29 pm
by neologix
ym2612 now updated w/eke's latest (beginning of august) optimizations and a speed-up (hopefully) for converting floats to ints!

https://github.com/apollolux/ym2612-js

Posted: Wed Aug 31, 2011 3:36 pm
by Eke
Did you measured any speedup from this changes ?

I think I noticed a few improvment on Wii (PowerPC) but was not sure about other platforms. Most noticeable change was to perform envelope update for all channels/operators in a single loop, instead of calling the same function for each channel. The rest is some trivial variable/register opimization, not sure if it improves anything on x86.

Posted: Wed Aug 31, 2011 3:59 pm
by neologix
funnily enough, acc. to github's online diff, it looks like i already had the vast majority of those optimizations (especially the "perform X updates in a single loop" ones)!

i seem to have broken my calculate_channel function locally, however, so nothing is being generated. i'll be back after i fix that.

edit - ok, i'm back. it seems in my test page since i technically only write to channel 1 and i uncommented calculating other channels the untouched channels give me an error. commenting the other channels restores generation of sound in my test. as for speed, it feels a little faster (i edited the "convert to int" to be faster in javascript), but that seems to be offset by how crappy safari 5.1 has become so far.

Posted: Sun Jul 06, 2014 1:36 am
by neologix
IT FINALLY WORKS!!!!! ^________________^

Get it from the GitHub.