web audio API / jsxm question
Just a question in reference to jsxm you said this:
uses the Web Audio API merely as a place to stuff PCM samples into, rather than taking full advantage of its relevant features (perhaps that was the right decision, given the results)
Could you elaborate? What challenges have you experienced? I've come to a similar conclusion in building a synth but i'm not smart enough to know why :shrug:
I mostly just meant that jsxm played smoother and more faithfully than my xm-player, without hiccups between patterns or when many channels are playing. When you use the Web Audio API's full feature set, you kind of give up some control over individual samples. The browser might choose to use a slightly different algorithm to achieve some bit of audio processing than FT2 did, so any music that happens to depend on those small differences would sound slightly wrong. You also give up some control about when certain bits of processing happen, which can lead to the hiccups I mentioned (though I think some of them are due to contention with graphics rendering from the scrolling xm-player does while playing, which you can turn off). OTOH if you see the Web Audio API as merely a destination for PCM samples that you compute yourself, you can render the whole song ahead of time using exactly the same algorithm as FT2 (assuming you know it!), and be relatively sure that you'll get the same samples out as FT2 does.
Another kind of thing that happens is that the Web Audio API might not directly support something FT2 did, so you have to either hack around it with some relatively slow javascript code, or leave it unimplemented. This was the case with ping-pong loops; IIRC the Web Audio API only really supported looping an audio sample in one direction (forward), not bouncing back when you reach the ends of the sample.