MelodyCraftWS


NameMelodyCraftWS JSON
Version 0.2.8 PyPI version JSON
download
home_pagehttps://github.com/sergio11/melodycraftWS
Summary🎶 Transform text into beautiful melodies and stream real-time WebSockets to clients! 🚀
upload_time2023-10-30 20:12:23
maintainer
docs_urlNone
authorSergio Sánchez Sánchez
requires_python>=3.7, <4
license
keywords music text websocket melody
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # MelodyCraftWS 🎵

[![PyPI version](https://badge.fury.io/py/MelodyCraftWS.svg)](https://badge.fury.io/py/MelodyCraftWS)

MelodyCraftWS is a Python package that combines the power of text-based melody generation with real-time notifications using WebSockets. This project demonstrates the magic of turning lyrics or text into beautiful melodies and keeping you informed about the progress.

<p align="center">
  <img src="https://img.shields.io/badge/flask-%23000.svg?style=for-the-badge&logo=flask&logoColor=white" />
  <img src="https://img.shields.io/badge/gunicorn-%298729.svg?style=for-the-badge&logo=gunicorn&logoColor=white" />
  <img src="https://img.shields.io/badge/python-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54" />
</p>

🚀 **Features:**
- Generate melodies from text input.
- Estimated duration based on the number of words and average WPM.
- Real-time progress updates via WebSockets.
- Send success or error notifications to the client.

## Implementation Details 🛠️

This project is built using the following tools and libraries:

- [Flask](https://flask.palletsprojects.com/): A micro web framework for building web applications.
- [Flask-SocketIO](https://flask-socketio.readthedocs.io/): A Flask extension for WebSockets.
- [Audiocraft](https://github.com/yourusername/audiocraft): A Python library for music and audio generation.

## Usage 📦

1. Install the package via `pip`:
   
```bash
pip install MelodyCraftWS
```

2. Create a Flask application and integrate the package to generate melodies and send WebSocket events.

```python
# Import the necessary components and set up the MelodyCraftServer
from MelodyCraftWS import MelodyCraftServer

server = MelodyCraftServer()
```

3. Start your application, and it's ready to generate melodies from text and send notifications in real-time.

```python
if __name__ == '__main__':
    server.run(debug=True)
```

### How to Generate Melodies 🎶

Send a POST request to the */generate_melody* endpoint with the text parameter containing the lyrics or text you want to transform into a melody.

The estimated duration is calculated based on the text's word count and an average words per minute (WPM) rate.

The melody is generated using the Audiocraft library, and real-time updates are sent to the client via WebSockets.

Success or error notifications are sent depending on the outcome.

#### Client Component

The client component, MelodyCraftClient, connects to the MelodyCraft server, sends text input for melody generation, and receives the generated melodies. It also allows custom event listeners for additional functionality.

##### Step 1: Preparation of the Client

Ensure you have the MelodyCraftClient class defined in a file, such as melodycraft_client.py.

```python
# melodycraft_client.py

from MelodyCraftWS import MelodyCraftClient

if __name__ == '__main__':
    # Replace 'server_url' and 'client_id' with the actual values
    server_url = 'http://your-server-url.com'
    client_id = 'your_client_id'

    # Create an instance of the MelodyCraftClient
    client = MelodyCraftClient(server_url, client_id)

    # Define a custom event listener for 'custom_event'
    def custom_event_handler(data):
        print('Custom Event Received:', data)

    # Add the custom event listener
    client.add_event_listener('custom_event', custom_event_handler)

    # Example usage: Generate a melody
    client.generate_melody('Text input for melody generation')

    # Wait for user input to exit
    input('Press Enter to disconnect...')
    client.disconnect()
```

##### Step 2: Running the Client

Open a separate terminal and navigate to the location of the melodycraft_client.py file.
Run the client by executing the following command:

```bash
python melodycraft_client.py
```

This will start the client and connect to the server. You can use the client to generate melodies, receive custom events, and interact with the MelodyCraft server.

Make sure the values of 'server_url' and 'client_id' in the client file (melodycraft_client.py) are configured with the actual values corresponding to your server. You can also add or remove custom events and adjust the handling logic according to your needs.

### License 📜
This project is licensed under the MIT License - see the LICENSE file for details.

Feel free to contribute, report issues, and make this project even better!

### 🌟 Enjoy creating melodies with MelodyCraftWS! 🌟



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/sergio11/melodycraftWS",
    "name": "MelodyCraftWS",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7, <4",
    "maintainer_email": "",
    "keywords": "music,text,WebSocket,melody",
    "author": "Sergio S\u00e1nchez S\u00e1nchez",
    "author_email": "dreamsoftware92@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/bb/7a/3bb6d18520129d9c8dec672ea99447bfaf475fd3828e3a343830d31fe2e2/MelodyCraftWS-0.2.8.tar.gz",
    "platform": null,
    "description": "# MelodyCraftWS \ud83c\udfb5\r\n\r\n[![PyPI version](https://badge.fury.io/py/MelodyCraftWS.svg)](https://badge.fury.io/py/MelodyCraftWS)\r\n\r\nMelodyCraftWS is a Python package that combines the power of text-based melody generation with real-time notifications using WebSockets. This project demonstrates the magic of turning lyrics or text into beautiful melodies and keeping you informed about the progress.\r\n\r\n<p align=\"center\">\r\n  <img src=\"https://img.shields.io/badge/flask-%23000.svg?style=for-the-badge&logo=flask&logoColor=white\" />\r\n  <img src=\"https://img.shields.io/badge/gunicorn-%298729.svg?style=for-the-badge&logo=gunicorn&logoColor=white\" />\r\n  <img src=\"https://img.shields.io/badge/python-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54\" />\r\n</p>\r\n\r\n\ud83d\ude80 **Features:**\r\n- Generate melodies from text input.\r\n- Estimated duration based on the number of words and average WPM.\r\n- Real-time progress updates via WebSockets.\r\n- Send success or error notifications to the client.\r\n\r\n## Implementation Details \ud83d\udee0\ufe0f\r\n\r\nThis project is built using the following tools and libraries:\r\n\r\n- [Flask](https://flask.palletsprojects.com/): A micro web framework for building web applications.\r\n- [Flask-SocketIO](https://flask-socketio.readthedocs.io/): A Flask extension for WebSockets.\r\n- [Audiocraft](https://github.com/yourusername/audiocraft): A Python library for music and audio generation.\r\n\r\n## Usage \ud83d\udce6\r\n\r\n1. Install the package via `pip`:\r\n   \r\n```bash\r\npip install MelodyCraftWS\r\n```\r\n\r\n2. Create a Flask application and integrate the package to generate melodies and send WebSocket events.\r\n\r\n```python\r\n# Import the necessary components and set up the MelodyCraftServer\r\nfrom MelodyCraftWS import MelodyCraftServer\r\n\r\nserver = MelodyCraftServer()\r\n```\r\n\r\n3. Start your application, and it's ready to generate melodies from text and send notifications in real-time.\r\n\r\n```python\r\nif __name__ == '__main__':\r\n    server.run(debug=True)\r\n```\r\n\r\n### How to Generate Melodies \ud83c\udfb6\r\n\r\nSend a POST request to the */generate_melody* endpoint with the text parameter containing the lyrics or text you want to transform into a melody.\r\n\r\nThe estimated duration is calculated based on the text's word count and an average words per minute (WPM) rate.\r\n\r\nThe melody is generated using the Audiocraft library, and real-time updates are sent to the client via WebSockets.\r\n\r\nSuccess or error notifications are sent depending on the outcome.\r\n\r\n#### Client Component\r\n\r\nThe client component, MelodyCraftClient, connects to the MelodyCraft server, sends text input for melody generation, and receives the generated melodies. It also allows custom event listeners for additional functionality.\r\n\r\n##### Step 1: Preparation of the Client\r\n\r\nEnsure you have the MelodyCraftClient class defined in a file, such as melodycraft_client.py.\r\n\r\n```python\r\n# melodycraft_client.py\r\n\r\nfrom MelodyCraftWS import MelodyCraftClient\r\n\r\nif __name__ == '__main__':\r\n    # Replace 'server_url' and 'client_id' with the actual values\r\n    server_url = 'http://your-server-url.com'\r\n    client_id = 'your_client_id'\r\n\r\n    # Create an instance of the MelodyCraftClient\r\n    client = MelodyCraftClient(server_url, client_id)\r\n\r\n    # Define a custom event listener for 'custom_event'\r\n    def custom_event_handler(data):\r\n        print('Custom Event Received:', data)\r\n\r\n    # Add the custom event listener\r\n    client.add_event_listener('custom_event', custom_event_handler)\r\n\r\n    # Example usage: Generate a melody\r\n    client.generate_melody('Text input for melody generation')\r\n\r\n    # Wait for user input to exit\r\n    input('Press Enter to disconnect...')\r\n    client.disconnect()\r\n```\r\n\r\n##### Step 2: Running the Client\r\n\r\nOpen a separate terminal and navigate to the location of the melodycraft_client.py file.\r\nRun the client by executing the following command:\r\n\r\n```bash\r\npython melodycraft_client.py\r\n```\r\n\r\nThis will start the client and connect to the server. You can use the client to generate melodies, receive custom events, and interact with the MelodyCraft server.\r\n\r\nMake sure the values of 'server_url' and 'client_id' in the client file (melodycraft_client.py) are configured with the actual values corresponding to your server. You can also add or remove custom events and adjust the handling logic according to your needs.\r\n\r\n### License \ud83d\udcdc\r\nThis project is licensed under the MIT License - see the LICENSE file for details.\r\n\r\nFeel free to contribute, report issues, and make this project even better!\r\n\r\n### \ud83c\udf1f Enjoy creating melodies with MelodyCraftWS! \ud83c\udf1f\r\n\r\n\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "\ud83c\udfb6 Transform text into beautiful melodies and stream real-time WebSockets to clients! \ud83d\ude80",
    "version": "0.2.8",
    "project_urls": {
        "Homepage": "https://github.com/sergio11/melodycraftWS"
    },
    "split_keywords": [
        "music",
        "text",
        "websocket",
        "melody"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cf68f385e978c585a857e030a9d432cf8c0521887f4cd9517a72dafdae60993a",
                "md5": "ba4e9c9969a36146d9dfbca00e436b56",
                "sha256": "ee3c4238af41fbc3cb90dfa1213d8b3d2f30c04cd864116351abb4d4b300a770"
            },
            "downloads": -1,
            "filename": "MelodyCraftWS-0.2.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ba4e9c9969a36146d9dfbca00e436b56",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7, <4",
            "size": 7595,
            "upload_time": "2023-10-30T20:12:15",
            "upload_time_iso_8601": "2023-10-30T20:12:15.467507Z",
            "url": "https://files.pythonhosted.org/packages/cf/68/f385e978c585a857e030a9d432cf8c0521887f4cd9517a72dafdae60993a/MelodyCraftWS-0.2.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bb7a3bb6d18520129d9c8dec672ea99447bfaf475fd3828e3a343830d31fe2e2",
                "md5": "001c951dae8565cf9c7729eb8863c89e",
                "sha256": "fc1b6aa7b0d5721af5fc496ceab268115370225e982cc757e73e48fa61573de3"
            },
            "downloads": -1,
            "filename": "MelodyCraftWS-0.2.8.tar.gz",
            "has_sig": false,
            "md5_digest": "001c951dae8565cf9c7729eb8863c89e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7, <4",
            "size": 6623,
            "upload_time": "2023-10-30T20:12:23",
            "upload_time_iso_8601": "2023-10-30T20:12:23.072931Z",
            "url": "https://files.pythonhosted.org/packages/bb/7a/3bb6d18520129d9c8dec672ea99447bfaf475fd3828e3a343830d31fe2e2/MelodyCraftWS-0.2.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-30 20:12:23",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sergio11",
    "github_project": "melodycraftWS",
    "github_not_found": true,
    "lcname": "melodycraftws"
}
        
Elapsed time: 0.16109s