All discussions

Ideas

Support for Backround Audio for the WASM version

XenoxYT opened this discussion
View on GitHub

Sadly spin effects and pulse effects dont work because there is no backround audio support in the WASM version yet.

3 replies

  1. ruanklein replied

    In fact, background support has been available in the WebAssembly version since the feature was introduced.

    However, the behavior is different. You need to host your WAV audio file somewhere and provide the URL using the @background option, for example:

    @background https://hub.synapseq.org/packages/synapseq-pink-noise.wav
    
    spin-one
      background spin 400 rate 10 intensity 45 amplitude 50
      tone 300 binaural 10 amplitude 15
    spin-two
      background spin 200 rate 5 intensity 75 amplitude 50
      tone 300 binaural 5 amplitude 15
    
    00:00:00 silence
    00:00:15 spin-one
    00:02:00 spin-one
    00:03:30 spin-two
    00:04:30 spin-two
    00:05:30 spin-one
    00:07:00 spin-two
    00:09:30 spin-one
    00:10:00 silence
    

    Keep in mind that SynapSeq can read up to 10MB of the provided WAV file, whether it is 8-bit, 16-bit, or 24-bit.

  2. XenoxYT replied

    Is there a way to change this behavior and to allow using local files in the same directory?

  3. ruanklein replied

    Is there a way to change this behavior and to allow using local files in the same directory?

    At the moment, the WASM version only allows http and https URLs for @background and @presetlist, since the browser environment does not provide direct access to local filesystem paths.

    In a future version, I plan to extend the whitelist to also allow blob URLs. This would make it possible to upload a local file in the browser, generate a Blob URL (e.g. using URL.createObjectURL()), and reference it in the sequence like this:
    @background blob:...

    However, this is mainly intended as a convenience for browser-based experimentation. The recommended approach remains hosting the audio externally (for example via http://localhost or a storage bucket) and referencing it through a regular URL. That keeps the behavior consistent between CLI and WASM versions and avoids browser-specific coupling.

    So direct local filesystem paths (like ./rain.wav) will not be supported in the WASM version due to browser security constraints, but Blob URLs will likely be supported in a future release.

Reply on GitHub

This is a static mirror of the SynapSeq GitHub Discussions.