Page 1 of 1

SunVox Engine for JavaScript

Posted: Sat Aug 04, 2018 2:14 pm
by NightRadio
SunVox library for developers has been updated to v1.9.4c!
With a lot of changes, including JavaScript support!
Look at the example: JS SunVox Player with endless generative demo songs.

Image

Re: SunVox Engine for JavaScript

Posted: Sun Aug 19, 2018 1:07 am
by GENNA
This looks pretty rad. So, how difficult would you say it would be to create a simple page that would select a sunvox file at random and begin playing it whenever someone visited the page? The user would have the option to stop playing the file, or select another file at random.

I've been working with generative music for years and I've been finding SunVox to be pretty accommodating for some of my projects. I should mention, however, that I have very little JS experience. Still, I think this is definitely worth looking into.

Thanks for all of the great work you do, NightRadio!

Re: SunVox Engine for JavaScript

Posted: Sun Aug 19, 2018 7:06 am
by GENNA
Actually, I am happy to report I've already made quite a bit of headway with this project. Having said that, I do want to make sure I'm adhering to the proper protocols.

Alexander, so long as I include the statement about it being powered by SunVox, a link to your web site and the statement regarding OGG Vorbis and Xhip.org I am ok to use this, correct? This project is not for commercial purposes, but I want to ensure that I am giving proper credit. Also, please let me know if I should remove this post and move this discussion to a private message.

Once again, thank you.

Re: SunVox Engine for JavaScript

Posted: Sun Aug 19, 2018 1:05 pm
by NightRadio
Actually, I am happy to report I've already made quite a bit of headway with this project.
It's great!

Alexander, so long as I include the statement about it being powered by SunVox, a link to your web site and the statement regarding OGG Vorbis and Xhip.org I am ok to use this, correct?
Yes, that's right.
Please don't forget to share a link to your project when it is finished :)

Re: SunVox Engine for JavaScript

Posted: Sat Aug 25, 2018 1:48 am
by GENNA
So, after having some playtime with the JS version I am running into some issues. One is file size, which is understandable. Some of my projects use rather large samples and I could see why that would create a problem when trying to load. However, I've also noticed that none of my songs that use MetaModules will play, nor will any of my songs that use more than a few percent of the CPU.

Is there any documentation available about what the limitations are for the JS version of SunVox? If not, I understand. I am more than happy to keep experimenting to see what works and what doesn't.

Thanks!

Re: SunVox Engine for JavaScript

Posted: Sun Aug 26, 2018 12:55 am
by NightRadio
Is there any documentation available about what the limitations are for the JS version of SunVox?
Not yet, sorry. So far I do not really know these limitations too :) I should check this in more detail...
Please can you send me some of your songs that don't play correctly in JS player?
nightradio@gmail.com

Re: SunVox Engine for JavaScript

Posted: Mon Sep 03, 2018 11:48 pm
by hseiken
@GENNA I'm sure you're well aware of this, but do not assume that everyone has a system that can play crazy complicated tracks. Even some songs that are shipped with Sunvox won't play on my main computer without overloading the CPU. I personally would keep tracks to simple chiptunes or sampler-based tracks with only a few FX. Especially for handheld devices that might be browsing your page. ;) 8 Cores at 4Ghz isn't exactly standard for most people. ;)

Re: SunVox Engine for JavaScript

Posted: Tue Sep 04, 2018 4:37 am
by GENNA
@NightRadio, my apologies for not replying sooner. I've been away from my computer for extended periods over the past two weeks. I'm back to experimenting though and will send you a few examples.

@hseiken, you are absolutely right. I think I definitely sometimes take my system for granted. It's fairly high-spec as I use it for live performance as well. Also, I'm new to the whole JavaScript thing so I'm really not sure what sort of limitations or flexibility is available there. I do need to remember that keeping things simple is best - thank you! :good:

Re: SunVox Engine for JavaScript

Posted: Sat Nov 17, 2018 12:03 am
by GENNA
I finally have some time to re-visit this; however, I have what I hope is a simple JavaScript question - is there any way to have a SunVox file play automatically when the web page is loaded? I've done some searching online but this seems to be eluding me.

Any examples or directions toward helpful resources is greatly appreciated.

Thanks!

John

Re: SunVox Engine for JavaScript

Posted: Sun Nov 18, 2018 11:46 am
by NightRadio
Is there any way to have a SunVox file play automatically when the web page is loaded?
You can try to add sv_play_from_beginning(0) right after the sv_load_from_memory().
This will definitely not work in Safari for iOS: https://developer.apple.com/library/con ... ounds.html
(see "Playing Sounds" section):
... the Web Audio API requires sounds to be triggered from an explicit user action, such as a tap ...
I think the other browsers go the same way.

Re: SunVox Engine for JavaScript

Posted: Mon Nov 19, 2018 8:40 pm
by GENNA
Alex,

That worked; however, you make a great point about the other browsers. That is something that never occurred to me, so it looks like I'll be sticking with the buttons after all.

Thanks again for your help!

John

Re: SunVox Engine for JavaScript

Posted: Tue Dec 04, 2018 6:51 am
by Rondobotic
Looking forward to what you have been working on GENNA!

I am too interested in presenting something similar one day.... when I have time..... time...

Re: SunVox Engine for JavaScript

Posted: Fri Mar 22, 2019 9:17 pm
by peterdj
For the JS engine, I noticed that you're using wasm. I'm using an engine where I load multiple samples. Since they all need to be AIFF or WAV files, they can get pretty big, so I'm running up against the memory limitation "cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X" etc. I did some digging and it seems you have the module set to 256 pages in the wasm file itself. What do you think of going to 512?

Re: SunVox Engine for JavaScript

Posted: Sat Mar 23, 2019 11:46 am
by NightRadio
I did some digging and it seems you have the module set to 256 pages in the wasm file itself. What do you think of going to 512?
Thanks for this info!
I will check it before the new version release.