# Udio Wrapper
![Udio Wrapper](banner.jpeg)
Written by @Flowese
<a href="https://colab.research.google.com/drive/11BqjonOql85BkB4tbxpI_lq2rfGkc60Y?usp=sharing" target="_blank"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open Demo In Colab"></a>
## Description
`udio_wrapper` is a Python package that allows you to generate music tracks from Udio's API using textual prompts. This package is designed to interact with Udio's API and is not officially endorsed by Udio.
## Advantages Over Other Models
Unlike other music generation models, Udio offers a unique feature of extending or conditioning new tracks based on existing ones, making it ideal for iterative and creative music production processes.
## Legal Disclaimer
This package is created for educational and research purposes. By using this package, you agree to do so at your own risk. This package is not affiliated, endorsed, or sponsored by Udio in any way.
## Requirements
- Python 3.x
- pip
## Installation
### From PyPI
To install the package from PyPI, run the following command:
```bash
pip install udio_wrapper
```
To upgrade the package from PyPI, run the following command:
```bash
pip install --upgrade --no-cache-dir udio_wrapper
```
### From GitHub Repository
To install the package directly from the GitHub repository, run:
```bash
pip install git+https://github.com/flowese/UdioWrapper.git
```
## Configuration
### Obtaining the Authorization Token
1. Sign up at [Udio](https://www.udio.com/).
2. Once registered, open your browser's inspector:
- In Chrome: `Ctrl+Shift+I` or `F12` on Windows, `Cmd+Option+I` on Mac.
3. Go to the `Application` tab.
4. On the left panel, locate and click on `Cookies`, then select the Ideogram website.
5. Find the cookie named `sb-api-auth-token`.
6. Click on `sb-api-auth-token` and copy the value in the `Value` field.
![Udio Wrapper](screen_cookies.jpeg)
### Usage
To use `udio_wrapper`, import the `UdioWrapper` class and provide the necessary parameters.
## Usage Examples
The following examples demonstrate various ways to use the `UdioWrapper` to generate music based on different scenarios:
```python
auth_token = "your-auth-token-here" # Replace this with your actual authentication token
udio_wrapper = UdioWrapper(auth_token)
```
1. Creating a Short Song
You can specify the prompt, seed, custom lyrics.
```python
short_song_no_download = udio_wrapper.create_song(
prompt="Relaxing jazz and soulful music",
seed=-1,
custom_lyrics="Short song lyrics here"
)
print("Short song generated without downloading:", short_song_no_download)
```
2. Extending a Song
Extend a previously created song by providing its path and ID for conditioning. This method also allows for lyric customization.
```python
extend_song_download = udio_wrapper.extend(
prompt="A dynamic version of relaxing jazz and soulful music",
seed=-1,
audio_conditioning_path="url-generated-song",
audio_conditioning_song_id="previous-song-id",
custom_lyrics="Extended version lyrics"
)
print("Extended song generated and downloaded:", extend_song_download)
```
3. Adding an Outro
Generate an outro for your music sequence using the last song as a base. This includes custom lyrics.
```python
outro_song_download = udio_wrapper.add_outro(
prompt="A smooth ending to our jazz session",
seed=-1,
audio_conditioning_path="url-generated-song",
audio_conditioning_song_id="last-extended-song-id",
custom_lyrics="Outro lyrics here"
)
print("Outro song generated and downloaded:", outro_song_download)
```
4. Creating a Complete Song Sequence
Generate a full sequence of songs, including multiple extensions and an outro. This process involves defining prompts and lyrics for each part of the sequence.
```python
complete_song_sequence = udio_wrapper.create_complete_song(
short_prompt="On a full moon night",
extend_prompts=["the soft sound of the saxophone fills the air", "creating an atmosphere of mystery and romance"],
outro_prompt="Thus ends this melody, leaving an echo of emotions in the heart",
num_extensions=2,
custom_lyrics_short="Short song lyrics here",
custom_lyrics_extend=["Lyrics for first extension", "Lyrics for second extension"],
custom_lyrics_outro="Outro lyrics here"
)
print("Complete song sequence generated and downloaded:", complete_song_sequence)
```
#### Parameters
- **`auth_token`** *(Required)*: The authorization token you obtained from Udio, which is necessary for authenticating and making API requests.
Each method in the `UdioWrapper` class can take several parameters to control song generation and processing. Below is a breakdown of the parameters and their usage:
- **prompt** *(str)*: A text prompt describing the theme or emotion of the song. This is the creative input from which the song generation is based.
- **seed** *(int, optional)*: A seed number to ensure the reproducibility of the song generation. Using the same seed with the same parameters will generate the same audio output. Default is `-1`, which results in random generation each time.
- **custom_lyrics** *(str, optional)*: Lyrics written by the user to be included in the song. If no lyrics are provided, the generation relies solely on the musical style implied by the prompt.
- **audio_conditioning_path** *(str, optional)*: The file path to an audio file that will serve as a base or influence for the song being generated. This is used primarily for extending songs or generating outros based on a previous song.
- **audio_conditioning_song_id** *(str, optional)*: The identifier of a previously generated song that will be used to influence the current song generation. This is necessary when creating extended songs or outros that are meant to follow a specific musical piece.
- **num_extensions** *(int, optional)*: Specifies the number of extended songs to generate in a sequence. This parameter is only used in the method that generates a complete song sequence. Default is `1`.
- **extend_prompts** *(list of str, optional)*: A list of prompts for generating each extension in a sequence. Each prompt should ideally reflect a progression or variation in style or theme from the previous song.
- **outro_prompt** *(str, optional)*: A prompt specifically for generating an outro. This should convey a sense of conclusion or finale relative to the musical sequence.
These parameters allow full customization of the music generation process, from the initial creation through extensions to the final outro, giving users the ability to tailor both the music and lyrics to fit their specific needs or artistic vision.
## License
This project is licensed under the MIT License.
## Contributing
If you'd like to contribute to this project, feel free to fork the repository and send a pull request, or open an issue to discuss what you'd like to change. All contributions are welcome!
## TODO
### Pending Tasks and Features
- Improve error handling and response validation.
- Implement a user-friendly web interface for easier interaction with the API.
-----
Raw data
{
"_id": null,
"home_page": "https://github.com/flowese/UdioWrapper",
"name": "udio-wrapper",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "audio, music, generation, API, AI, Udio",
"author": "Flowese",
"author_email": "flowese@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/41/d7/4529281b8c19690e4f94bd6b54d62f4a4b0a73fe4c60e607282cdbd8f0bd/udio_wrapper-0.0.3.tar.gz",
"platform": null,
"description": "\n# Udio Wrapper\n\n![Udio Wrapper](banner.jpeg)\n\nWritten by @Flowese\n\n<a href=\"https://colab.research.google.com/drive/11BqjonOql85BkB4tbxpI_lq2rfGkc60Y?usp=sharing\" target=\"_blank\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open Demo In Colab\"></a>\n\n## Description\n\n`udio_wrapper` is a Python package that allows you to generate music tracks from Udio's API using textual prompts. This package is designed to interact with Udio's API and is not officially endorsed by Udio.\n\n## Advantages Over Other Models\n\nUnlike other music generation models, Udio offers a unique feature of extending or conditioning new tracks based on existing ones, making it ideal for iterative and creative music production processes.\n\n## Legal Disclaimer\n\nThis package is created for educational and research purposes. By using this package, you agree to do so at your own risk. This package is not affiliated, endorsed, or sponsored by Udio in any way.\n\n## Requirements\n\n- Python 3.x\n- pip\n\n## Installation\n\n### From PyPI\n\nTo install the package from PyPI, run the following command:\n\n```bash\npip install udio_wrapper\n```\n\nTo upgrade the package from PyPI, run the following command:\n```bash\npip install --upgrade --no-cache-dir udio_wrapper\n```\n\n\n### From GitHub Repository\n\nTo install the package directly from the GitHub repository, run:\n\n```bash\npip install git+https://github.com/flowese/UdioWrapper.git\n```\n\n## Configuration\n\n### Obtaining the Authorization Token\n\n1. Sign up at [Udio](https://www.udio.com/).\n2. Once registered, open your browser's inspector:\n - In Chrome: `Ctrl+Shift+I` or `F12` on Windows, `Cmd+Option+I` on Mac.\n3. Go to the `Application` tab.\n4. On the left panel, locate and click on `Cookies`, then select the Ideogram website.\n5. Find the cookie named `sb-api-auth-token`.\n6. Click on `sb-api-auth-token` and copy the value in the `Value` field.\n\n![Udio Wrapper](screen_cookies.jpeg)\n\n### Usage\n\nTo use `udio_wrapper`, import the `UdioWrapper` class and provide the necessary parameters.\n\n## Usage Examples\n\nThe following examples demonstrate various ways to use the `UdioWrapper` to generate music based on different scenarios:\n\n```python\nauth_token = \"your-auth-token-here\" # Replace this with your actual authentication token\nudio_wrapper = UdioWrapper(auth_token)\n```\n\n1. Creating a Short Song\nYou can specify the prompt, seed, custom lyrics.\n```python\n\nshort_song_no_download = udio_wrapper.create_song(\n prompt=\"Relaxing jazz and soulful music\",\n seed=-1,\n custom_lyrics=\"Short song lyrics here\"\n)\nprint(\"Short song generated without downloading:\", short_song_no_download)\n```\n2. Extending a Song\nExtend a previously created song by providing its path and ID for conditioning. This method also allows for lyric customization.\n```python\n\nextend_song_download = udio_wrapper.extend(\n prompt=\"A dynamic version of relaxing jazz and soulful music\",\n seed=-1,\n audio_conditioning_path=\"url-generated-song\",\n audio_conditioning_song_id=\"previous-song-id\",\n custom_lyrics=\"Extended version lyrics\"\n)\nprint(\"Extended song generated and downloaded:\", extend_song_download)\n```\n\n3. Adding an Outro\nGenerate an outro for your music sequence using the last song as a base. This includes custom lyrics.\n```python\n\noutro_song_download = udio_wrapper.add_outro(\n prompt=\"A smooth ending to our jazz session\",\n seed=-1,\n audio_conditioning_path=\"url-generated-song\",\n audio_conditioning_song_id=\"last-extended-song-id\",\n custom_lyrics=\"Outro lyrics here\"\n)\nprint(\"Outro song generated and downloaded:\", outro_song_download)\n```\n\n4. Creating a Complete Song Sequence\nGenerate a full sequence of songs, including multiple extensions and an outro. This process involves defining prompts and lyrics for each part of the sequence.\n```python\ncomplete_song_sequence = udio_wrapper.create_complete_song(\n short_prompt=\"On a full moon night\",\n extend_prompts=[\"the soft sound of the saxophone fills the air\", \"creating an atmosphere of mystery and romance\"],\n outro_prompt=\"Thus ends this melody, leaving an echo of emotions in the heart\",\n num_extensions=2,\n custom_lyrics_short=\"Short song lyrics here\",\n custom_lyrics_extend=[\"Lyrics for first extension\", \"Lyrics for second extension\"],\n custom_lyrics_outro=\"Outro lyrics here\"\n)\nprint(\"Complete song sequence generated and downloaded:\", complete_song_sequence)\n```\n\n#### Parameters\n\n- **`auth_token`** *(Required)*: The authorization token you obtained from Udio, which is necessary for authenticating and making API requests.\n\n\nEach method in the `UdioWrapper` class can take several parameters to control song generation and processing. Below is a breakdown of the parameters and their usage:\n\n- **prompt** *(str)*: A text prompt describing the theme or emotion of the song. This is the creative input from which the song generation is based.\n\n- **seed** *(int, optional)*: A seed number to ensure the reproducibility of the song generation. Using the same seed with the same parameters will generate the same audio output. Default is `-1`, which results in random generation each time.\n\n- **custom_lyrics** *(str, optional)*: Lyrics written by the user to be included in the song. If no lyrics are provided, the generation relies solely on the musical style implied by the prompt.\n\n- **audio_conditioning_path** *(str, optional)*: The file path to an audio file that will serve as a base or influence for the song being generated. This is used primarily for extending songs or generating outros based on a previous song.\n\n- **audio_conditioning_song_id** *(str, optional)*: The identifier of a previously generated song that will be used to influence the current song generation. This is necessary when creating extended songs or outros that are meant to follow a specific musical piece.\n\n- **num_extensions** *(int, optional)*: Specifies the number of extended songs to generate in a sequence. This parameter is only used in the method that generates a complete song sequence. Default is `1`.\n\n- **extend_prompts** *(list of str, optional)*: A list of prompts for generating each extension in a sequence. Each prompt should ideally reflect a progression or variation in style or theme from the previous song.\n\n- **outro_prompt** *(str, optional)*: A prompt specifically for generating an outro. This should convey a sense of conclusion or finale relative to the musical sequence.\n\n\nThese parameters allow full customization of the music generation process, from the initial creation through extensions to the final outro, giving users the ability to tailor both the music and lyrics to fit their specific needs or artistic vision.\n\n\n## License\n\nThis project is licensed under the MIT License.\n\n## Contributing\n\nIf you'd like to contribute to this project, feel free to fork the repository and send a pull request, or open an issue to discuss what you'd like to change. All contributions are welcome!\n\n## TODO\n\n### Pending Tasks and Features\n\n- Improve error handling and response validation.\n- Implement a user-friendly web interface for easier interaction with the API.\n\n-----\n",
"bugtrack_url": null,
"license": null,
"summary": "Generates songs using the Udio API using textual prompts.",
"version": "0.0.3",
"project_urls": {
"Homepage": "https://github.com/flowese/UdioWrapper"
},
"split_keywords": [
"audio",
" music",
" generation",
" api",
" ai",
" udio"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "779251f51984e0526f08089aac06f3df88ec1091a4018458198893d8e7a2354b",
"md5": "2449d09c5622b63f7ee63b1bbb07918a",
"sha256": "170d6a95bd51348b7a97930e7de20f3cd56c72bb55c602aa34ac5acb1d1b83cc"
},
"downloads": -1,
"filename": "udio_wrapper-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2449d09c5622b63f7ee63b1bbb07918a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 7353,
"upload_time": "2024-04-15T15:34:04",
"upload_time_iso_8601": "2024-04-15T15:34:04.708578Z",
"url": "https://files.pythonhosted.org/packages/77/92/51f51984e0526f08089aac06f3df88ec1091a4018458198893d8e7a2354b/udio_wrapper-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "41d74529281b8c19690e4f94bd6b54d62f4a4b0a73fe4c60e607282cdbd8f0bd",
"md5": "770fe997b85cad43bc0566bc97935c4f",
"sha256": "71b3f5c1e76457f753b73bb68a1bb3cb8ae96da681e184cd921ec84f25df5b79"
},
"downloads": -1,
"filename": "udio_wrapper-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "770fe997b85cad43bc0566bc97935c4f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 7312,
"upload_time": "2024-04-15T15:34:06",
"upload_time_iso_8601": "2024-04-15T15:34:06.063920Z",
"url": "https://files.pythonhosted.org/packages/41/d7/4529281b8c19690e4f94bd6b54d62f4a4b0a73fe4c60e607282cdbd8f0bd/udio_wrapper-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-15 15:34:06",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "flowese",
"github_project": "UdioWrapper",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "udio-wrapper"
}