Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working Offline #35

Closed
controlledaccident opened this issue Aug 8, 2023 · 10 comments
Closed

Working Offline #35

controlledaccident opened this issue Aug 8, 2023 · 10 comments

Comments

@controlledaccident
Copy link

controlledaccident commented Aug 8, 2023

Should the plugin work fully offline?

The audio (sometimes) doesn't seem to play — without allowing network connections to "paulrosen.github.io" upon Obsidian launch.

The cursor(?) bounces along the notes, but there's no audio output.

Many thanks

@alensiljak
Copy link
Collaborator

Theoretically yes. I believe abcjs has switched to using sound fonts and is downloading it from the given URL.
There might be settings to configure this behaviour.

@controlledaccident
Copy link
Author

I suspected as much. Ah ok, from here:

https://paulrosen.github.io/abcjs/audio/synthesized-sound.html

"This requires an internet connection for the "sound fonts". You can supply your own sound fonts, so if you want to deliver them locally you can get by without the network. The default sound fonts come from this github repo?"

But that link is 404.

By settings do you mean passing some sort of JSON?

@alensiljak
Copy link
Collaborator

I'd expect to be able to generate sound from MIDI without sampled sounds (sound font). But, based on the docs (linked above) I'm not sure if that is still possible.

The relevant URLs, from abcjs, are below:

var originalSoundFontUrl = "https://paulrosen.github.io/midi-js-soundfonts/abcjs/";
var defaultSoundFontUrl = "https://paulrosen.github.io/midi-js-soundfonts/FluidR3_GM/";
var alternateSoundFontUrl = "https://paulrosen.github.io/midi-js-soundfonts/MusyngKite/";

@alensiljak
Copy link
Collaborator

alensiljak commented Aug 9, 2023

For the recent implementation in the plugin, see https://github.com/abcjs-music/obsidian-plugin-abcjs/blob/main/cfg.ts

I don't think it would be practical to distribute sound fonts with the plugin but am not sure what happens if they are not available (i.e. when offline). Probably no sound.

@miesvanderrobot
Copy link

There are some decent very small GM Soundfonts out there. Maybe you could bundle one with the plugin as a fallback to use when online connection to a larger, better-sounding one is unavailable?

For a good balance of small vs "sounds good enough to modern ears", I really like GeneralUser GS by S. Christian Collins. Under 30mb in size, sounds impressively good for its diminutive size. Might require some testing to determine which version of it sounds best in abcjs, as in newer versions it uses some advanced SF features that may not be supported.

@alensiljak
Copy link
Collaborator

alensiljak commented Aug 11, 2023

Honestly, I find that to be an overkill for a plugin of this type. I'm not sure how the audio works right now, if the original sound font is this big. It can't possibly download the whole file over a mobile connection so there must be some magic involved.

@miesvanderrobot
Copy link

Right, that's very likely. It's probably buffering only the notes that are actually used in the tune being rendered, which would be a subset of the total data size.

But the issue we're discussing here is making it possible to work offline. Obsidian itself is totally usable offline, so wouldn't it make sense to make plugins usable offline as well? Apart from this one thing, nothing else about abcjs is online-only.

@controlledaccident
Copy link
Author

But the issue we're discussing here is making it possible to work offline. Obsidian itself is totally usable offline, so wouldn't it make sense to make plugins usable offline as well?

Exactly why I opened this thread.

@alensiljak
Copy link
Collaborator

Apart from this one thing, nothing else about abcjs is online-only.

I agree and adding audio seems to have created more problems than it solved.
My suggestion is #41, where audio has to be explicitly enabled and a sound font configured so anyone can use whatever they want, or not.

@alensiljak
Copy link
Collaborator

The plugin already works offline. If the audio does not work that is due to abcjs requirements. This plugin provides abcjs functionality to Obsidian.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants