CTkVisualizer


NameCTkVisualizer JSON
Version 1.0.8 PyPI version JSON
download
home_pagehttps://github.com/iLollek/CTkVisualizer
SummaryA customtkinter widget for playing and visualizing Audio.
upload_time2024-10-30 07:31:56
maintainerNone
docs_urlNone
authoriLollek
requires_python>=3.8
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # CTkVisualizer

---

**A Visualizer that actually represents the Audio that's playing.**

![alt text](image.png)

*Inspired from [Akascape's TkVisualizer](https://github.com/Akascape/TkVisualizer/)*

**Install it by running:**
``pip install CTkVisualizer``
(Verify that you're atleast running with Version 1.0.3)

---

## Disclaimer

- This Widget is absolutely unfriendly to Integrate since it doesn't just Visualize Audio (what you might expect), it also plays it using ``pygame.mixer``. Unfortunately, this makes it do more than what a Widget is supposed to do. Usually you'd want to handle the Audio Playing seperately, and not in some GUI Widget. I wasn't able to implement it any other way. I tried my best to compensate for it by providing Audio Control Methods with the Widget natively, like ``pause()``, ``resume()`` and ``set_volume()``

- This Widget has serious Problems with **vertical Resizing!** Horizontal Resizing works like a Charm, the Bars get thicker, but vertically, the Bars will get "chopped off"

- This Widget has been tested with WAVE files (.wav) and MPEG3 Files (.mp3), both worked fine.

---

## Quick Overview
*This Overview just helps you get started quickly.*

- **`play_new_song(self, path_to_WAVE_file: str, finish_callback=None)`**
    - Loads and plays a new audio file while stopping any currently playing song.
    - **Parameters**:
        - `path_to_WAVE_file`: The path to the new audio file.
        - `finish_callback`: A callback to execute when the song finishes loading (default is None).
    - [!] You would most likely want to run this Threaded for performance reasons!

- **`pause(self)`**
    - Pauses the currently playing audio.

- **`play(self)`**
    - Resumes playback of the paused audio.

- **`resume(self)`**
    - Resumes playback of the audio if it was paused.

- **`is_playing(self)`**
    - Checks if audio is currently playing.
    - **Returns**: True if audio is playing, False otherwise.

- **`change_color(self, color)`**
    - Changes the color of all audio bars.
    - **Parameters**:
        - `color`: The new RGB color for the audio bars.

- **`get_music_filename(self)`**
    - Gets the base filename of the currently loaded music file.
    - **Returns**: The base filename of the music file without extension, or None if no file is loaded.

- **`set_volume(self, volume: float)`**
    - Sets the volume for the currently playing audio.
    - **Parameters**:
        - `volume`: A float value representing the volume level, where 0.0 is muted and 1.0 is the maximum volume.
    - **Raises**: ValueError if the volume is not between 0.0 and 1.0.

---

### Quick Overview - Quickstart

```
import customtkinter as ctk
from CTkVisualizer import AudioVisualizer

# Create the main application window
root = ctk.CTk()
root.title("Audio Visualizer")

# Initialize the audio visualizer
visualizer = AudioVisualizer(root, "path/to/your/audio/file.wav")
visualizer.pack(expand=True, fill="both")

# Run the application
root.mainloop()
```

---

### Quick Overview - Try the Demo!

If you want a quick and practical overview of how it works, you can look at ``AudioMusicVisualizerDemo.py`` - There I also added some Buttons to change the Color of the Bars or Play/Pause the Song.

---

If you have any suggestions or if you happen to find any Bugs, please report them by [opening an Issue](https://github.com/iLollek/CTkVisualizer/issues/new)

If you like this Project, feel free to help me out by leaving a Star or Sponsoring me! ⭐

Lastly, if you made anything cool with this Project, please tell me! I'd love to see it. Just open an Issue about it or tell me via Discord: @ilollek

---

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/iLollek/CTkVisualizer",
    "name": "CTkVisualizer",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "iLollek",
    "author_email": "loris_06@yahoo.de",
    "download_url": "https://files.pythonhosted.org/packages/c9/e0/2e2f155e7cab67192aee994bb6fb60d7cd43b69c107d064de22c5172d9b1/CTkVisualizer-1.0.8.tar.gz",
    "platform": null,
    "description": "# CTkVisualizer\r\n\r\n---\r\n\r\n**A Visualizer that actually represents the Audio that's playing.**\r\n\r\n![alt text](image.png)\r\n\r\n*Inspired from [Akascape's TkVisualizer](https://github.com/Akascape/TkVisualizer/)*\r\n\r\n**Install it by running:**\r\n``pip install CTkVisualizer``\r\n(Verify that you're atleast running with Version 1.0.3)\r\n\r\n---\r\n\r\n## Disclaimer\r\n\r\n- This Widget is absolutely unfriendly to Integrate since it doesn't just Visualize Audio (what you might expect), it also plays it using ``pygame.mixer``. Unfortunately, this makes it do more than what a Widget is supposed to do. Usually you'd want to handle the Audio Playing seperately, and not in some GUI Widget. I wasn't able to implement it any other way. I tried my best to compensate for it by providing Audio Control Methods with the Widget natively, like ``pause()``, ``resume()`` and ``set_volume()``\r\n\r\n- This Widget has serious Problems with **vertical Resizing!** Horizontal Resizing works like a Charm, the Bars get thicker, but vertically, the Bars will get \"chopped off\"\r\n\r\n- This Widget has been tested with WAVE files (.wav) and MPEG3 Files (.mp3), both worked fine.\r\n\r\n---\r\n\r\n## Quick Overview\r\n*This Overview just helps you get started quickly.*\r\n\r\n- **`play_new_song(self, path_to_WAVE_file: str, finish_callback=None)`**\r\n    - Loads and plays a new audio file while stopping any currently playing song.\r\n    - **Parameters**:\r\n        - `path_to_WAVE_file`: The path to the new audio file.\r\n        - `finish_callback`: A callback to execute when the song finishes loading (default is None).\r\n    - [!] You would most likely want to run this Threaded for performance reasons!\r\n\r\n- **`pause(self)`**\r\n    - Pauses the currently playing audio.\r\n\r\n- **`play(self)`**\r\n    - Resumes playback of the paused audio.\r\n\r\n- **`resume(self)`**\r\n    - Resumes playback of the audio if it was paused.\r\n\r\n- **`is_playing(self)`**\r\n    - Checks if audio is currently playing.\r\n    - **Returns**: True if audio is playing, False otherwise.\r\n\r\n- **`change_color(self, color)`**\r\n    - Changes the color of all audio bars.\r\n    - **Parameters**:\r\n        - `color`: The new RGB color for the audio bars.\r\n\r\n- **`get_music_filename(self)`**\r\n    - Gets the base filename of the currently loaded music file.\r\n    - **Returns**: The base filename of the music file without extension, or None if no file is loaded.\r\n\r\n- **`set_volume(self, volume: float)`**\r\n    - Sets the volume for the currently playing audio.\r\n    - **Parameters**:\r\n        - `volume`: A float value representing the volume level, where 0.0 is muted and 1.0 is the maximum volume.\r\n    - **Raises**: ValueError if the volume is not between 0.0 and 1.0.\r\n\r\n---\r\n\r\n### Quick Overview - Quickstart\r\n\r\n```\r\nimport customtkinter as ctk\r\nfrom CTkVisualizer import AudioVisualizer\r\n\r\n# Create the main application window\r\nroot = ctk.CTk()\r\nroot.title(\"Audio Visualizer\")\r\n\r\n# Initialize the audio visualizer\r\nvisualizer = AudioVisualizer(root, \"path/to/your/audio/file.wav\")\r\nvisualizer.pack(expand=True, fill=\"both\")\r\n\r\n# Run the application\r\nroot.mainloop()\r\n```\r\n\r\n---\r\n\r\n### Quick Overview - Try the Demo!\r\n\r\nIf you want a quick and practical overview of how it works, you can look at ``AudioMusicVisualizerDemo.py`` - There I also added some Buttons to change the Color of the Bars or Play/Pause the Song.\r\n\r\n---\r\n\r\nIf you have any suggestions or if you happen to find any Bugs, please report them by [opening an Issue](https://github.com/iLollek/CTkVisualizer/issues/new)\r\n\r\nIf you like this Project, feel free to help me out by leaving a Star or Sponsoring me! \u2b50\r\n\r\nLastly, if you made anything cool with this Project, please tell me! I'd love to see it. Just open an Issue about it or tell me via Discord: @ilollek\r\n\r\n---\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A customtkinter widget for playing and visualizing Audio.",
    "version": "1.0.8",
    "project_urls": {
        "Homepage": "https://github.com/iLollek/CTkVisualizer"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "31b3fc3f67b704f066201f2e397de5b844ea52caa3bf586a1e2c435be00cf862",
                "md5": "28125e6330c640b08461235d326aa289",
                "sha256": "fb497265c358f991c041e7e87a388117a8c09968ecf97d83afdaab5e351e5996"
            },
            "downloads": -1,
            "filename": "CTkVisualizer-1.0.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "28125e6330c640b08461235d326aa289",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 6518,
            "upload_time": "2024-10-30T07:31:54",
            "upload_time_iso_8601": "2024-10-30T07:31:54.937508Z",
            "url": "https://files.pythonhosted.org/packages/31/b3/fc3f67b704f066201f2e397de5b844ea52caa3bf586a1e2c435be00cf862/CTkVisualizer-1.0.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c9e02e2f155e7cab67192aee994bb6fb60d7cd43b69c107d064de22c5172d9b1",
                "md5": "e578cc96016b4ad36b0057d3625682f1",
                "sha256": "63dfebb642c9232721196b1862119fb2683d70c76730aff99fea1f8f6a827e70"
            },
            "downloads": -1,
            "filename": "CTkVisualizer-1.0.8.tar.gz",
            "has_sig": false,
            "md5_digest": "e578cc96016b4ad36b0057d3625682f1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 6050,
            "upload_time": "2024-10-30T07:31:56",
            "upload_time_iso_8601": "2024-10-30T07:31:56.336228Z",
            "url": "https://files.pythonhosted.org/packages/c9/e0/2e2f155e7cab67192aee994bb6fb60d7cd43b69c107d064de22c5172d9b1/CTkVisualizer-1.0.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-30 07:31:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "iLollek",
    "github_project": "CTkVisualizer",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "ctkvisualizer"
}
        
Elapsed time: 0.38018s