chiptune2.js
chiptune2.js copied to clipboard
Get pattern
Hello! So I'm not an expert on JS, and I'm trying to figure out how to get a visualization in pattern, just like the trackers, if possible. (Preferentially with a code snippet, I usually understand those better D: )
This library is for playback only. I'm not personally familiar with other libraries providing such functionality.
Sorry for the late response. The library behind chiptunejs libopenmpt
can do everything you'd expect from a tracker. It's the same code that OpenMPT is built upon. Exposing the functionality to JS is not always straight forward unfortunately. The first step is always to check libopenmpt C-API which we can call from JS.
You can find functions like openmpt_module_get_current_pattern
and openmpt_module_format_pattern_row_channel
that sound like they're be related to what you're trying to do.
A call from JS would look something like that:
libopenmpt._openmpt_module_get_current_pattern(this.currentPlayingNode.modulePtr);
It should return the index of the currently playing pattern. You can use that to go further.
By default only a limited number of functions are exposed via Emscripten to JS. So you might have to look into building a custom version of libopenmpt.js
from the libopenmpt source. Make sure to use the Makefile based build system.