SunVox Engine for JavaScript

Multi-platform modular music creation studio
Post Reply
User avatar
NightRadio
Site Admin
Posts: 3944
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

SunVox Engine for JavaScript

Post 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
GENNA
Posts: 36
Joined: Wed Apr 25, 2018 7:42 pm

Re: SunVox Engine for JavaScript

Post 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!
GENNA
Posts: 36
Joined: Wed Apr 25, 2018 7:42 pm

Re: SunVox Engine for JavaScript

Post 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.
User avatar
NightRadio
Site Admin
Posts: 3944
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: SunVox Engine for JavaScript

Post 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 :)
GENNA
Posts: 36
Joined: Wed Apr 25, 2018 7:42 pm

Re: SunVox Engine for JavaScript

Post 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!
User avatar
NightRadio
Site Admin
Posts: 3944
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: SunVox Engine for JavaScript

Post 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
hseiken
Posts: 175
Joined: Thu Jul 17, 2008 3:52 am

Re: SunVox Engine for JavaScript

Post 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. ;)
WARNINGThis angry old nerd may rant about modern computers or computer culture! It is not directed at you 99% of the time! Ignore it if it seems silly or personal!
GENNA
Posts: 36
Joined: Wed Apr 25, 2018 7:42 pm

Re: SunVox Engine for JavaScript

Post 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:
GENNA
Posts: 36
Joined: Wed Apr 25, 2018 7:42 pm

Re: SunVox Engine for JavaScript

Post 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
User avatar
NightRadio
Site Admin
Posts: 3944
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: SunVox Engine for JavaScript

Post 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.
GENNA
Posts: 36
Joined: Wed Apr 25, 2018 7:42 pm

Re: SunVox Engine for JavaScript

Post 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
Rondobotic
Posts: 51
Joined: Tue Dec 01, 2015 5:50 am

Re: SunVox Engine for JavaScript

Post 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...
peterdj
Posts: 1
Joined: Fri Mar 22, 2019 9:10 pm

Re: SunVox Engine for JavaScript

Post 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?
User avatar
NightRadio
Site Admin
Posts: 3944
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: SunVox Engine for JavaScript

Post 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.
Post Reply