Skip to content

Commit

Permalink
Adding instrumental tests
Browse files Browse the repository at this point in the history
  • Loading branch information
IdkwhatImD0ing committed Mar 25, 2024
1 parent f9a6420 commit 47052c2
Show file tree
Hide file tree
Showing 3 changed files with 222 additions and 1 deletion.
221 changes: 221 additions & 0 deletions examples/intrumental.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from suno import SongsGen\n",
"from dotenv import load_dotenv\n",
"import os\n",
"load_dotenv() \n",
"\n",
"SUNO_COOKIE = os.getenv(\"SUNO_COOKIE\")\n",
"i = SongsGen(SUNO_COOKIE)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Waiting for results<span style=\"color: #808000; text-decoration-color: #808000\">...</span>\n",
"</pre>\n"
],
"text/plain": [
"Waiting for results\u001b[33m...\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">.</pre>\n"
],
"text/plain": [
"."
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">.</pre>\n"
],
"text/plain": [
"."
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">.</pre>\n"
],
"text/plain": [
"."
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">.</pre>\n"
],
"text/plain": [
"."
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">.</pre>\n"
],
"text/plain": [
"."
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">.</pre>\n"
],
"text/plain": [
"."
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">.</pre>\n"
],
"text/plain": [
"."
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">.</pre>\n"
],
"text/plain": [
"."
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">.</pre>\n"
],
"text/plain": [
"."
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">.</pre>\n"
],
"text/plain": [
"."
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">.</pre>\n"
],
"text/plain": [
"."
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">.</pre>\n"
],
"text/plain": [
"."
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"output = i.get_songs_custom(\"\"\"\"\"\", \"grand orchestral space\", instrumental=True)\n",
"link = output['song_url']"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"audio = i.get_mp3(link, stream=True)\n",
"for chunk in audio:\n",
" if chunk:\n",
" with open(\"intrumental.mp3\", \"ab\") as f:\n",
" f.write(chunk)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "mad",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Binary file added examples/intrumental.mp3
Binary file not shown.
2 changes: 1 addition & 1 deletion suno/suno.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def get_songs_custom(self, prompt: str, genre: str, instrumental : str = False)
self.session.headers["user-agent"] = ua.random
payload = {
"mv": "chirp-v3-0",
"prompt": prompt,
"prompt": "" if instrumental else prompt,
"tags": genre,
"make_instrumental": instrumental,
}
Expand Down

0 comments on commit 47052c2

Please sign in to comment.