JAVASCRIPT YM2612~!!!

For anything related to sound (YM2612, PSG, Z80, PCM...)

Moderator: BigEvilCorporation

neologix
Very interested
Posts: 122
Joined: Mon May 07, 2007 5:19 pm
Location: New York, NY, USA
Contact:

JAVASCRIPT YM2612~!!!

Post by neologix » Tue Jun 28, 2011 12:25 am

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!!! ^______________^ )

neologix
Very interested
Posts: 122
Joined: Mon May 07, 2007 5:19 pm
Location: New York, NY, USA
Contact:

Post by neologix » Fri Jul 01, 2011 9:00 pm

update: audio preview NOW WORKS IN FIREFOX >= 4, SAFARI 5, AND CHROME! many thanks to the XAudioJS library by grantgalitz for making this happen!

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Sat Jul 02, 2011 2:18 am

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.

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Sat Jul 02, 2011 7:28 am

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
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

neologix
Very interested
Posts: 122
Joined: Mon May 07, 2007 5:19 pm
Location: New York, NY, USA
Contact:

Post by neologix » Sat Jul 02, 2011 8:48 am

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.

sega16
Very interested
Posts: 251
Joined: Sat Jan 29, 2011 3:16 pm
Location: U.S.A.

Post by sega16 » Mon Jul 04, 2011 3:50 pm

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.

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Mon Jul 04, 2011 6:57 pm

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.

neologix
Very interested
Posts: 122
Joined: Mon May 07, 2007 5:19 pm
Location: New York, NY, USA
Contact:

Post by neologix » Mon Jul 04, 2011 10:03 pm

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.

neologix
Very interested
Posts: 122
Joined: Mon May 07, 2007 5:19 pm
Location: New York, NY, USA
Contact:

Post by neologix » Wed Jul 13, 2011 2:36 pm

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

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Wed Jul 13, 2011 9:04 pm

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.

neologix
Very interested
Posts: 122
Joined: Mon May 07, 2007 5:19 pm
Location: New York, NY, USA
Contact:

Post by neologix » Wed Jul 13, 2011 11:34 pm

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.

neologix
Very interested
Posts: 122
Joined: Mon May 07, 2007 5:19 pm
Location: New York, NY, USA
Contact:

Post by neologix » Mon Aug 29, 2011 11:29 pm

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

Eke
Very interested
Posts: 884
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke » Wed Aug 31, 2011 3:36 pm

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.

neologix
Very interested
Posts: 122
Joined: Mon May 07, 2007 5:19 pm
Location: New York, NY, USA
Contact:

Post by neologix » Wed Aug 31, 2011 3:59 pm

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.

neologix
Very interested
Posts: 122
Joined: Mon May 07, 2007 5:19 pm
Location: New York, NY, USA
Contact:

Post by neologix » Sun Jul 06, 2014 1:36 am

IT FINALLY WORKS!!!!! ^________________^

Get it from the GitHub.

Post Reply