morph timer issue
-
I'm trying to write a synthesizer with web audio and client side javascript. I'm using a mechanism along the lines of github.com/cwilso/metronome (boils down to window.setTimeout) to schedule oscillators nearer to when the music needs them, because scheduling them all up front was taking an impossible amount of ram.
Results on a test piece of music: works reasonably as expected in Firefox on 2020 m1 macbook air, stutters in Firefox on Ubuntu Unity (presumably because the machine only has two cores and 4 gb of ram). I was hoping to at least get stuttering audio in Morph on Ubuntu Touch Focal OTA-1 on the Pixel 3a, because that would indicate that my code was probably valid even if the hardware is underpowered.
Instead, I'm seeing this message in the log viewer app:
[23/05/2023 16:51] QObject::startTimer: Timers cannot be started from another thread [23/05/2023 16:52] QObject::killTimer: Timers cannot be stopped from another thread
Does anyone who understands better how Morph works than I do have any ideas about what the issue might be?
I tried on my Pinephone but Morph is too old to recognize the replaceAll method, but I might try this in Firefox on Mobian on the Pinephone to get another data point when I get a chance to set up a Mobian install.
-
- Tried with Mobian 12 and Firefox 102.11.0esr on the Pinephone. Perhaps is working (speaker icon appeared momentarily in the tab) but runs out of ram before any sound plays.
- github.com/cwilso/metronome works fine on Morph - it's using a worker thread rather than setTimeout, and one oscillator per note rather than six or seven as I use
- setTimeout appears to be working plausibly based on a minimal working example from MDN, so that alone isn't the problem
- tried a much shorter test run with only five notes instead of a minute of music, and without using setTimeout; sometimes, but not reliably every time, getting warning in the console
[29/05/2023 03:36] qml: System low on memory, but unable to pick a tab to unload
There are two variables, the hardware capacity and the software. Until some phone becomes available with a decent amount of ram, there's probably not a way to find out whether Morph could do the job with enough computing resources or whether Morph is missing some needed component that desktop Firefox has.
-
@andrew907 I don't know what the problem was, probably an issue with limited memory, but I reworked my code to rely primarily on offline audio contexts. Morph is still giving me the error messages about stopping and starting timers from another thread, but it's also generating the music as expected based on my preliminary test. Very slowly, but we can chalk that up to the hardware rather than Ubuntu Touch, because the ram use spikes above 90%. We can mark this issue as resolved.
-