It will plot a sine wave with adjustable parameters.
The actual problem: Audio does not update
This works fine locally inside VSCode in a Jupyter notebook with the SageMath 10.2 kernel. I've selected the same environment in CoCalc and it only creates the audio file once. Users can even hear the sound. But if they change a value of an interactive slider, the audio is not recreated and you still hear the initially rendered sound. E.g. the frequency does not change when you change the frequency slider. Locally, the audio file is refreshed every time I wiggle any slider.
Note that while the audio does not refresh, the visual representation does indeed refresh, e.g. we see more oscillations with a higher frequency.
Description
With
from IPython.display import Audio
, we can play audio constructed in code. For example, consider this simple notebook with the following code:It will plot a sine wave with adjustable parameters.
The actual problem: Audio does not update
This works fine locally inside VSCode in a Jupyter notebook with the SageMath 10.2 kernel. I've selected the same environment in CoCalc and it only creates the audio file once. Users can even hear the sound. But if they change a value of an interactive slider, the audio is not recreated and you still hear the initially rendered sound. E.g. the frequency does not change when you change the frequency slider. Locally, the audio file is refreshed every time I wiggle any slider.
Note that while the audio does not refresh, the visual representation does indeed refresh, e.g. we see more oscillations with a higher frequency.