Closed DrArcularis closed 1 year ago
I tried a simple fix of calling ampModulator.phase(0) and freqModulator.phase(0) from within the applyChanges() method in electron.js. However this did not have appear to have any effect. I suspect that p5.Oscillator's phase() method may be broken...
Calling ampModulator.start() and freqModulator.start() has the desired effect. I'll submit a pull request.
That's wonderful, I think that should do the trick. We just need to make sure that this will translate to riders when playing remotely. Have you checked?
I tested this with a local server ("node index.js") and then opened a browser window for the driver (http://localhost:5000/ -> Create Session), and a browser window for the rider (http://localhost:5000/player/play/**). By monitoring the levels with Audacity, it appears that clicking the apply button does reset the amplitude at least, and I assume that it is also resetting the frequency. I do realize though that the internet latency for riders may result in them seeing a phasing that is not the same as what the driver sees. But hopefully it is pretty close.
Give driver some means to control phase of some or all of the oscillators. This would be most useful for Amplitude Modulation oscillators, to control whether the AM of the two channels is synchronized or alternating. However, it could also be applied to Frequency Modulation oscillators, for example to use the same FM on each channel with a specified frequency separation. It could even be applied to the carrier oscillator, to control the strength of the sum or difference "triphase" signal when the two channels have identical frequencies.