anklang icon indicating copy to clipboard operation
anklang copied to clipboard

Audio Catalogue Browser

Open tim-janik opened this issue 1 year ago • 4 comments

Anklang needs a facility to index, browse and select audio files that can be used in samplers like LiquidSFZ, with fluidsynth or for audio tracks.

Here are some design considerations:

  • We need an indexer that scans directories for sample files, ideally out of process, so scanning can operate in the background (reniced).
  • We could use LMDB to store indexed files in ~/.cache/anklang/indexer.db, that takes care of robustness and we avoid needing another IPC layer.
  • Locations of interest:
    • XDG_DATA_HOME: /anklang/samples /sounds
    • [CFG] $(prefix)/share/sounds $(prefix)/share/anklang/samples /usr/share/sounds /usr/local/share/sounds
    • [CFG] XDG_MUSIC_DIR, XDG_AUDIO_DIR[*], XDG_DOWNLOAD_DIR
    • [CFG] XDG_DATA_DIRS + /sounds
    • XDG_SAMPLE_DIRS[*], XDG_AUDIO_DIRS[*]
    • $ANKLANG_SAMPLE_DIRS, $ANKLANG_AUDIO_DIRS
  • Sample packs provided by Anklang should probably end up in $XDG_DATA_HOME/anklang/sounds or similar and be unconditionally scanned.
  • The indexer might need to read anklangrc.json in order to honor user settings.
  • The indexer should be started in the background when the Anklang GUI is running and possibly via AnklangEngine --crawl or so.
  • Is there a clever way to avoid re-indexing all directory hierarchies upon restart? For Anklang packages we can make sure to trigger invalidation as needed, but for paths like/usr/share/sounds or ~/Music/ that are potentially huge, I wonder if it is good enough to to carry out rescans with only maxdepth=2 or so.
  • In cases where the user knows that new content has been added deep in some ~/Music/ hierarchy, it makes sense to add a [Rescan] button.
  • I have looked at some sample packages by other DAWs and /usr/share/sounds, there are a lot of tags or categories that can be extracted from just crawling file and directory names, without having to inspect file contents. One trick here is to cross match dir/filename strings against /usr/share/dict/words to yield meaningful tag and category names.
  • Content scanning is a whole different can of worms that we might want to not open just yet.
  • Just the dir + file name already yields file type, short name, in many cases genre, sometimes BPM. For a WAVE selection dialog with content filtering based on tags, that is good enough for a start.
  • The current file browser could be extended with another pane (left side) to select tags from a list, and the current filename input field could become a search bar when in catalogue selection mode. The new pane could serve as bookmark list for ordinary file selection.
  • We might even want to support users actively switching between file-sector and catalogue-browser mode (via notebook tabs?), depending on where they need to pick an audio snippet from.

[*]: Note that $XDG_AUDIO_DIR and related search paths are not in the official spec, but it would make sense to introduce this. With ~/Music for music to listen to, ~/Videos for movies to watch, it could make sense to have ~/Audio for sample files, and MIDI clips, multisample files, etc. [CFG]: Some of these dirs could potentially span large hierarchies, it could make sense to allow users to configure automatic scanning of these via the preferences.

tim-janik avatar Feb 14 '24 22:02 tim-janik

you have icons for the all audio file formats?

Reaper10 avatar Mar 30 '24 19:03 Reaper10