dudaanton622 downloadsLive-coding music environment — Strudel REPL integrated into your vault.
This plugin integrates the incredible live-code music environment, strudel.cc, into Obsidian. The goal is to make Strudel more accessible and to provide a convenient way to store and play your musical patterns directly within your notes.
Disclaimer: I am not affiliated in any way with the developers of Strudel and distribute their code under its AGPL 3.0 license. You can find the entire source code for the Strudel project here.
Disclaimer 2: Please be aware that this plugin executes arbitrary JavaScript code from your notes, which carries inherent risks. Do not copy-paste code into your vault unless you understand what it does.
Most of Strudel's code has been left unchanged. I had to include its source code in the project instead of using the pre-built npm packages because those packages are not sufficiently sandboxed and execute network-loaded code, which violates Obsidian's plugin security policy. Here’s what has been changed or added:
strudel code block, allowing you to control playback in Obsidian's live-preview mode.pianoroll widget is currently included. It adapts to your Obsidian theme, so color customization from code is not supported at the moment.globalThis object; a dedicated scope object is used instead. Also, the loading and eval of remote JS files for audio fonts (from here) have been removed. Instead, the plugin now loads a pre-compiled JSON from here.strudel code blocks, based on the work from here.Functionality differs between the official website and this plugin. Not all packages have been included, so some features (like gamepad support) may not work. I also haven't been able to test MIDI device functionality.
Mobile Support: The plugin does not play audio on iOS. This is likely due to limitations in Safari's WebView, as playback also fails in the mobile Safari browser. However, I have kept the plugin enabled for mobile devices, as it should work correctly on Android.
While the plugin is awaiting approval in the community plugin list, you can install it manually by downloading it from the "Releases" section of this page. In your vault, inside the .obsidian/plugins folder, create a new folder named obsidian-strudel-plugin and place the downloaded files there.
After that, reload the community plugins list, and "Strudel REPL" should appear.
You can also install the plugin via the BRAT community plugin. In BRAT's settings, add dudaanton/obsidian-strudel-plugin to the list of beta plugins. This will allow you to get early updates before they are officially released.
In the settings, you can specify a folder for caching audio samples and their map files (JSONs), for example, Attachments/Sounds. If you enable the Save to cache toggle, samples downloaded during playback will be saved to this folder. Otherwise, only already cached samples will be played from the cache, while others will be downloaded on each use.
You can also specify sources for samples in the settings, one per line. For more information on supported formats and links, please refer to the official documentation: https://strudel.cc/learn/samples/. By default, samples from felixroos/dough-samples are included, but you can remove them or add your own. Specifying these links in the settings saves you from having to declare them in every new code block.
Simply add a strudel code block to any note like this:
```strudel
// your strudel code
```
A play button will appear above it. Try adding some examples from the official website's workshop to see how it works: https://strudel.cc/workshop/getting-started/.
The official Strudel website also offers high-quality tutorials to help you learn how to write your own musical patterns.
Clone the repository and navigate into it:
git clone https://github.com/dudaanton/obsidian-strudel-plugin/
cd obsidian-strudel-plugin
Copy the .env.example file to .env:
cp .env.example .env
Edit the .env file in any text editor, setting the TARGET_VAULT_DIR variable to the path of the plugin folder in your vault, for example, /Users/myname/obsidian/.obsidian/plugins/strudel.
Then, run the script to install dependencies, build the project, and copy the final files to that folder:
npm run deploy:prod