kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
24.15k stars 972 forks source link

icat for audio (+over ssh) #7722

Closed Kettukaa closed 2 months ago

Kettukaa commented 2 months ago

Is your feature request related to a problem? Please describe.

As a developer working with audio files over SSH connections, I often face workflow disruptions due to the need to transfer audio files back and forth or rely on unstable and janky SSHFS connections. This process is time-consuming and can hinder rapid development. The existing "icat" feature in Kitty for displaying images is extremely useful, and a similar functionality for audio would significantly improve the workflow for audio-related tasks over SSH.

Describe the solution you'd like

I propose implementing an "acat" (audio cat) feature in Kitty terminal, similar to the existing "icat" for images. This feature would allow users to play audio files directly within the terminal, even over SSH connections. Ideally, the solution would include:

  1. A command-line interface to play audio files (e.g., acat audiofile.mp3)
  2. Basic playback controls (play, pause, stop, seek(?))
  3. Support for common audio formats (MP3, WAV, FLAC, etc.)
  4. Volume control
  5. The ability to stream audio data over SSH without downloading the entire file

Describe alternatives you've considered

  1. Using SSHFS to mount remote directories locally and play audio files using local media players. However, this can be unstable, awkward, and doesn't provide a seamless terminal-integrated experience.

  2. Implementing a web-based solution where audio files are served through a local web server. This adds complexity and requires additional setup.

  3. Using existing command-line audio players like mpv over SSH. While functional, these lack tight integration with the terminal and may not provide an optimal user experience. It is also worth noting that similar alternatives also existed for image-over-ssh, but icat was still worthwhile to add.

  4. Developing a separate GUI application for remote audio playback (think: having a socket app where audio files can be streamed through). This would be more complex and lose the benefits of terminal integration.

Additional context

This feature would be particularly beneficial for developers working on audio-related projects, audio machine learning engineers, and system administrators managing audio assets on remote servers. It would leverage Kitty's existing capabilities for handling multimedia content and extend them to the audio domain, providing a more complete terminal-based development environment for multimedia projects.

kovidgoyal commented 2 months ago

Not something I am personally interested in, but you are welcome to contribute it via a PR. There will be lots of considerations in designing such a protocol though, so be prepared for a long slog.

Note that you can already transfer arbitrary files over SSH connections in kitty using the transfer kitten https://sw.kovidgoyal.net/kitty/kittens/transfer/

and you can simply do

ls --hyperlink=auto

and then click on the sound file and kitty will present you with a prompt to open/edit/save the file, which will work for playing audio files over SSH via your local computer's media player.

https://sw.kovidgoyal.net/kitty/kittens/remote_file/