system-sounds


Namesystem-sounds JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://pypi.org/project/system-sounds/
Summarylist available system sound files
upload_time2023-09-14 11:35:55
maintainer
docs_urlNone
authorMark Parker
requires_python>=3.10,<4.0
licenseMIT
keywords system-sounds audio-playback cross-platform music sounds system-music user-music sound-library audio-library
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # system-sounds

## Table of Contents
1. [Description](#description)
2. [Installation](#installation)
   - [pip](#pip)
   - [poetry](#poetry)
3. [Usage](#usage)
   - [Listing System Sounds](#listing-system-sounds)
   - [Listing User's Music](#listing-users-music)
   - [Listing Both System Sounds and Music](#listing-both-system-sounds-and-music)
   - [Playing a Sound](#playing-a-sound)
   - [Advanced Usage - Custom Directory and Extensions](#advanced-usage---custom-directory-and-extensions)
4. [Alternatives for Playback](#alternatives-for-playback)
   - [sounddevice + soundfile](#sounddevice--soundfile)
   - [playsound](#playsound)
   - [pyaudio](#pyaudio)

---

### Description
The System Sounds library provides a straightforward interface to list and play system and user music sounds. It is cross-platform, supporting macOS, Linux, and Windows. 

### Installation

To install the library, use one of the following package managers:

#### pip
```
pip install system-sounds
```

#### poetry
```
poetry add system-sounds
```

### Usage

#### Listing System Sounds:
To retrieve a list of available system sounds, use:
```python
from system_sounds import list_system_sounds

sounds = list_system_sounds()
print(sounds)
```

#### Listing User's Music:
To retrieve a list of music from the user's default music directory, use:
```python
from system_sounds import list_music

music = list_music()
print(music)
```

#### Listing Both System Sounds and Music:
To retrieve a combined list of system sounds and user music, use:
```python
from system_sounds import list_all

all_sounds = list_all()
print(all_sounds)
```

#### Playing a Sound:
To play a sound, use the `play_sound` function:
```python
from system_sounds import play_sound

play_sound("path_to_sound_file.wav")
```

#### Advanced Usage - Custom Directory and Extensions:
If you'd like to list files from a custom directory or look for sound files with specific extensions, utilize the `list_files_from_directory` function:

```python
from system_sounds import list_files_from_directory

custom_sounds = list_files_from_directory("/path/to/directory", extensions={'.wav', '.ogg'})
print(custom_sounds)
```

### Alternatives for Playback

The library uses system commands to play sounds, which might not be optimal or available for every scenario. For fallback or alternative methods, consider using:

#### sounddevice + soundfile:
This combination allows for playback and reading of sound files in various formats.
  
  Installation:
  ```
  pip install sounddevice soundfile
  ```

  Example usage:
  ```python
  import soundfile as sf
  import sounddevice as sd

  data, samplerate = sf.read('path_to_sound_file.wav')
  sd.play(data, samplerate)
  sd.wait()
  ```

#### playsound:
A pure Python solution without dependencies.

  Installation:
  ```
  pip install playsound
  ```

  Example usage:
  ```python
  from playsound import playsound

  playsound('path_to_sound_file.mp3')
  ```

#### pyaudio:
Allows you to play and record audio on various platforms.

  Installation:
  ```
  pip install pyaudio
  ```

  Example usage requires reading the sound file with a library like `wave` and then playing it with `pyaudio`.

Remember, while these alternatives provide more features or flexibility, they might also introduce additional dependencies or complexities to your application.

            

Raw data

            {
    "_id": null,
    "home_page": "https://pypi.org/project/system-sounds/",
    "name": "system-sounds",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10,<4.0",
    "maintainer_email": "",
    "keywords": "system-sounds,audio-playback,cross-platform,music,sounds,system-music,user-music,sound-library,audio-library",
    "author": "Mark Parker",
    "author_email": "mark@parker-programs.com",
    "download_url": "https://files.pythonhosted.org/packages/cf/39/cc39b322cf71e5e0cfe04c04b942322daed26520d9b1e07b00e300ced89b/system_sounds-0.1.1.tar.gz",
    "platform": null,
    "description": "# system-sounds\n\n## Table of Contents\n1. [Description](#description)\n2. [Installation](#installation)\n   - [pip](#pip)\n   - [poetry](#poetry)\n3. [Usage](#usage)\n   - [Listing System Sounds](#listing-system-sounds)\n   - [Listing User's Music](#listing-users-music)\n   - [Listing Both System Sounds and Music](#listing-both-system-sounds-and-music)\n   - [Playing a Sound](#playing-a-sound)\n   - [Advanced Usage - Custom Directory and Extensions](#advanced-usage---custom-directory-and-extensions)\n4. [Alternatives for Playback](#alternatives-for-playback)\n   - [sounddevice + soundfile](#sounddevice--soundfile)\n   - [playsound](#playsound)\n   - [pyaudio](#pyaudio)\n\n---\n\n### Description\nThe System Sounds library provides a straightforward interface to list and play system and user music sounds. It is cross-platform, supporting macOS, Linux, and Windows. \n\n### Installation\n\nTo install the library, use one of the following package managers:\n\n#### pip\n```\npip install system-sounds\n```\n\n#### poetry\n```\npoetry add system-sounds\n```\n\n### Usage\n\n#### Listing System Sounds:\nTo retrieve a list of available system sounds, use:\n```python\nfrom system_sounds import list_system_sounds\n\nsounds = list_system_sounds()\nprint(sounds)\n```\n\n#### Listing User's Music:\nTo retrieve a list of music from the user's default music directory, use:\n```python\nfrom system_sounds import list_music\n\nmusic = list_music()\nprint(music)\n```\n\n#### Listing Both System Sounds and Music:\nTo retrieve a combined list of system sounds and user music, use:\n```python\nfrom system_sounds import list_all\n\nall_sounds = list_all()\nprint(all_sounds)\n```\n\n#### Playing a Sound:\nTo play a sound, use the `play_sound` function:\n```python\nfrom system_sounds import play_sound\n\nplay_sound(\"path_to_sound_file.wav\")\n```\n\n#### Advanced Usage - Custom Directory and Extensions:\nIf you'd like to list files from a custom directory or look for sound files with specific extensions, utilize the `list_files_from_directory` function:\n\n```python\nfrom system_sounds import list_files_from_directory\n\ncustom_sounds = list_files_from_directory(\"/path/to/directory\", extensions={'.wav', '.ogg'})\nprint(custom_sounds)\n```\n\n### Alternatives for Playback\n\nThe library uses system commands to play sounds, which might not be optimal or available for every scenario. For fallback or alternative methods, consider using:\n\n#### sounddevice + soundfile:\nThis combination allows for playback and reading of sound files in various formats.\n  \n  Installation:\n  ```\n  pip install sounddevice soundfile\n  ```\n\n  Example usage:\n  ```python\n  import soundfile as sf\n  import sounddevice as sd\n\n  data, samplerate = sf.read('path_to_sound_file.wav')\n  sd.play(data, samplerate)\n  sd.wait()\n  ```\n\n#### playsound:\nA pure Python solution without dependencies.\n\n  Installation:\n  ```\n  pip install playsound\n  ```\n\n  Example usage:\n  ```python\n  from playsound import playsound\n\n  playsound('path_to_sound_file.mp3')\n  ```\n\n#### pyaudio:\nAllows you to play and record audio on various platforms.\n\n  Installation:\n  ```\n  pip install pyaudio\n  ```\n\n  Example usage requires reading the sound file with a library like `wave` and then playing it with `pyaudio`.\n\nRemember, while these alternatives provide more features or flexibility, they might also introduce additional dependencies or complexities to your application.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "list available system sound files",
    "version": "0.1.1",
    "project_urls": {
        "Documentation": "https://github.com/MarkParker5/system-sounds/blob/master/README.md",
        "Homepage": "https://pypi.org/project/system-sounds/",
        "Repository": "https://github.com/MarkParker5/system-sounds"
    },
    "split_keywords": [
        "system-sounds",
        "audio-playback",
        "cross-platform",
        "music",
        "sounds",
        "system-music",
        "user-music",
        "sound-library",
        "audio-library"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1b0dc1e7b6e00fad83de707b59922a9e341cbd139c5ac6cbcaa9d94671160294",
                "md5": "931a30121b3946886a2cfc23c7b2452b",
                "sha256": "ea37a7d76c6b09b28dd014e37d3dc14ba833a2b112e44051d0696881de9e46fc"
            },
            "downloads": -1,
            "filename": "system_sounds-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "931a30121b3946886a2cfc23c7b2452b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<4.0",
            "size": 4066,
            "upload_time": "2023-09-14T11:35:53",
            "upload_time_iso_8601": "2023-09-14T11:35:53.846379Z",
            "url": "https://files.pythonhosted.org/packages/1b/0d/c1e7b6e00fad83de707b59922a9e341cbd139c5ac6cbcaa9d94671160294/system_sounds-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cf39cc39b322cf71e5e0cfe04c04b942322daed26520d9b1e07b00e300ced89b",
                "md5": "f8e1478254c32ad9f29d9dc65da225ef",
                "sha256": "bb3f2f1048c132e45f5313dac3c53b52940e68f9718c02a1376c7512dc2c78af"
            },
            "downloads": -1,
            "filename": "system_sounds-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "f8e1478254c32ad9f29d9dc65da225ef",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<4.0",
            "size": 3565,
            "upload_time": "2023-09-14T11:35:55",
            "upload_time_iso_8601": "2023-09-14T11:35:55.383798Z",
            "url": "https://files.pythonhosted.org/packages/cf/39/cc39b322cf71e5e0cfe04c04b942322daed26520d9b1e07b00e300ced89b/system_sounds-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-14 11:35:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "MarkParker5",
    "github_project": "system-sounds",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "system-sounds"
}
        
Elapsed time: 0.13390s