beatscore 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2022, fastai
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,5 @@
1
+ include settings.ini
2
+ include LICENSE
3
+ include CONTRIBUTING.md
4
+ include README.md
5
+ recursive-exclude * __pycache__
@@ -0,0 +1,125 @@
1
+ Metadata-Version: 2.4
2
+ Name: beatscore
3
+ Version: 0.0.1
4
+ Summary: Turn text into music. Hackathon using ElevenLabs
5
+ Author-email: FS <funkstop@internetplus.com>
6
+ License: Apache-2.0
7
+ Project-URL: Repository, https://github.com/funkstop/beatscore
8
+ Project-URL: Documentation, https://funkstop.github.io/beatscore/
9
+ Keywords: nbdev
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3 :: Only
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: pandas
16
+ Requires-Dist: numpy
17
+ Requires-Dist: scikit-learn
18
+ Requires-Dist: sentence-transformers
19
+ Requires-Dist: transformers
20
+ Requires-Dist: elevenlabs
21
+ Requires-Dist: feedparser
22
+ Requires-Dist: beautifulsoup4
23
+ Requires-Dist: requests
24
+ Requires-Dist: claudette
25
+ Dynamic: license-file
26
+
27
+ # beatscore
28
+
29
+ A small libary that converts structured text into short music clips by mapping properties of the input (intensity, repetition, pace, tone, coherence) into promptable audio generation using the ElevenLabs Music API
30
+
31
+ The goal is to experiment how differences in source material can be perceptible in sound.
32
+
33
+ ## Example
34
+
35
+ - Opinionated text → more forceful, higher energy
36
+ - Neutral news → more structured, calmer
37
+ - Fragmented text → faster, less predictable
38
+
39
+ ## API
40
+
41
+ ```python
42
+ run_digest(sources, source_type, output_dir)
43
+ ```
44
+ where:
45
+ * sources: a dictionary of articles, feeds, or any text.
46
+ * source_type: one of 'news' or 'speech'. News expects sources to be a dictionary of rss feeds.
47
+ * output_dir: the location for generated files
48
+
49
+
50
+
51
+
52
+ ## News RSS Example:
53
+
54
+ ```python
55
+ from beatscore import run_digest
56
+
57
+ sources = {
58
+ "reuters": "http://feeds.reuters.com/reuters/topNews",
59
+ "bbc": "http://feeds.bbci.co.uk/news/rss.xml",
60
+ "nyt": "https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml",
61
+ "rollingStone": "https://www.rollingstone.com/feed/"
62
+ }
63
+
64
+
65
+ run_digest(sources, "news", output_dir="./output")
66
+
67
+ ```
68
+
69
+
70
+ ## Speech example:
71
+
72
+ ```python
73
+ from beatscore import run_digest
74
+
75
+ sources = {
76
+ "mlk_dream": "https://kr.usembassy.gov/martin-luther-king-jr-dream-speech-1963/", #https://www.americanrhetoric.com/speeches/mlkihaveadream.htm",
77
+ "gettysburg": "https://www.abrahamlincolnonline.org/lincoln/speeches/gettysburg.htm",
78
+ "churchill_beaches": "https://winstonchurchill.org/resources/speeches/1940-the-finest-hour/we-shall-fight-on-the-beaches/",
79
+ }
80
+
81
+
82
+ run_digest(sources, "speech", output_dir="./output")
83
+
84
+ ```
85
+
86
+ ## Setup
87
+
88
+ You'll need three API keys:
89
+ - `ELEVENLABS_API_KEY` — for music generation
90
+ - `HF_TOKEN` — for embeddings and emotion models
91
+ - `ANTHROPIC_API_KEY` — for prompt engineering with Claude
92
+
93
+ Set them as environment variables or pass directly to functions.
94
+
95
+
96
+ ## Installation
97
+
98
+ Install latest from the GitHub [repository][repo]:
99
+
100
+ ```sh
101
+ $ pip install git+https://github.com/funkstop/beatscore.git
102
+ ```
103
+
104
+ or from [pypi][pypi]
105
+
106
+
107
+ ```sh
108
+ $ pip install beatscore
109
+ ```
110
+
111
+
112
+ [repo]: https://github.com/funkstop/beatscore
113
+ [docs]: https://funkstop.github.io/beatscore/
114
+ [pypi]: https://pypi.org/project/beatscore/
115
+
116
+
117
+ ### Documentation
118
+
119
+ Documentation can be found hosted on this GitHub [repository][repo]'s [pages][docs]. Additionally you can find package manager specific guidelines on [pypi][pypi].
120
+
121
+ [repo]: https://github.com/funkstop/beatscore
122
+ [docs]: https://funkstop.github.io/beatscore/
123
+ [pypi]: https://pypi.org/project/beatscore/
124
+
125
+
@@ -0,0 +1,99 @@
1
+ # beatscore
2
+
3
+ A small libary that converts structured text into short music clips by mapping properties of the input (intensity, repetition, pace, tone, coherence) into promptable audio generation using the ElevenLabs Music API
4
+
5
+ The goal is to experiment how differences in source material can be perceptible in sound.
6
+
7
+ ## Example
8
+
9
+ - Opinionated text → more forceful, higher energy
10
+ - Neutral news → more structured, calmer
11
+ - Fragmented text → faster, less predictable
12
+
13
+ ## API
14
+
15
+ ```python
16
+ run_digest(sources, source_type, output_dir)
17
+ ```
18
+ where:
19
+ * sources: a dictionary of articles, feeds, or any text.
20
+ * source_type: one of 'news' or 'speech'. News expects sources to be a dictionary of rss feeds.
21
+ * output_dir: the location for generated files
22
+
23
+
24
+
25
+
26
+ ## News RSS Example:
27
+
28
+ ```python
29
+ from beatscore import run_digest
30
+
31
+ sources = {
32
+ "reuters": "http://feeds.reuters.com/reuters/topNews",
33
+ "bbc": "http://feeds.bbci.co.uk/news/rss.xml",
34
+ "nyt": "https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml",
35
+ "rollingStone": "https://www.rollingstone.com/feed/"
36
+ }
37
+
38
+
39
+ run_digest(sources, "news", output_dir="./output")
40
+
41
+ ```
42
+
43
+
44
+ ## Speech example:
45
+
46
+ ```python
47
+ from beatscore import run_digest
48
+
49
+ sources = {
50
+ "mlk_dream": "https://kr.usembassy.gov/martin-luther-king-jr-dream-speech-1963/", #https://www.americanrhetoric.com/speeches/mlkihaveadream.htm",
51
+ "gettysburg": "https://www.abrahamlincolnonline.org/lincoln/speeches/gettysburg.htm",
52
+ "churchill_beaches": "https://winstonchurchill.org/resources/speeches/1940-the-finest-hour/we-shall-fight-on-the-beaches/",
53
+ }
54
+
55
+
56
+ run_digest(sources, "speech", output_dir="./output")
57
+
58
+ ```
59
+
60
+ ## Setup
61
+
62
+ You'll need three API keys:
63
+ - `ELEVENLABS_API_KEY` — for music generation
64
+ - `HF_TOKEN` — for embeddings and emotion models
65
+ - `ANTHROPIC_API_KEY` — for prompt engineering with Claude
66
+
67
+ Set them as environment variables or pass directly to functions.
68
+
69
+
70
+ ## Installation
71
+
72
+ Install latest from the GitHub [repository][repo]:
73
+
74
+ ```sh
75
+ $ pip install git+https://github.com/funkstop/beatscore.git
76
+ ```
77
+
78
+ or from [pypi][pypi]
79
+
80
+
81
+ ```sh
82
+ $ pip install beatscore
83
+ ```
84
+
85
+
86
+ [repo]: https://github.com/funkstop/beatscore
87
+ [docs]: https://funkstop.github.io/beatscore/
88
+ [pypi]: https://pypi.org/project/beatscore/
89
+
90
+
91
+ ### Documentation
92
+
93
+ Documentation can be found hosted on this GitHub [repository][repo]'s [pages][docs]. Additionally you can find package manager specific guidelines on [pypi][pypi].
94
+
95
+ [repo]: https://github.com/funkstop/beatscore
96
+ [docs]: https://funkstop.github.io/beatscore/
97
+ [pypi]: https://pypi.org/project/beatscore/
98
+
99
+
@@ -0,0 +1 @@
1
+ __version__ = "0.0.1"
@@ -0,0 +1,10 @@
1
+ # Autogenerated by nbdev
2
+
3
+ d = { 'settings': { 'branch': 'main',
4
+ 'doc_baseurl': '/beatscore',
5
+ 'doc_host': 'https://funkstop.github.io',
6
+ 'git_url': 'https://github.com/funkstop/beatscore',
7
+ 'lib_path': 'beatscore'},
8
+ 'syms': { 'beatscore.beatscore': {},
9
+ 'beatscore.core': {'beatscore.core.foo': ('core.html#foo', 'beatscore/core.py')},
10
+ 'beatscore.test': {}}}
@@ -0,0 +1,611 @@
1
+ import os
2
+ import pandas as pd
3
+ import numpy as np
4
+ from sklearn.metrics.pairwise import cosine_similarity
5
+ from claudette import Chat
6
+ from elevenlabs.client import ElevenLabs
7
+
8
+ def validate_keys():
9
+ if ("ELEVENLABS_API_KEY" in os.environ):
10
+ print("ElevenLabs API Key is set")
11
+ else:
12
+ print("No Key. Set ELEVENLABS_API_KEY in environment and restart")
13
+ raise ValueError("No ELEVENLABS_API_KEY")
14
+
15
+ if ("HF_TOKEN" in os.environ):
16
+ print("HuggingFace API Key is set")
17
+ else:
18
+ print("No Key. Set HF_TOKEN in environment and restart")
19
+ raise ValueError("No HF_TOKEN")
20
+
21
+ if ("ANTHROPIC_API_KEY" in os.environ):
22
+ print("Anthropic API Key is set")
23
+ else:
24
+ print("No Key. Set ANTHROPIC_API_KEY in environment and restart")
25
+ raise ValueError("No ANTHROPIC_API_KEY")
26
+
27
+
28
+ RANT_TEXT = """
29
+ This is not a small issue! Anyone pretending otherwise is lying to your face! Every single day, decisions are made behind closed doors with zero accountability. !e are told to simply trust the process even though it has failed us over and over again. This is not incompetence anymore. It is a deliberate pattern! They know exactly what they are doing!
30
+
31
+ Why are ordinary citizens expected to follow every rule to the letter while those in power play by completely different standards? You ask questions and you get dismissed, labeled as extreme. These are not conspiracy theories. They are observable facts that anyone paying attention can see clearly.
32
+
33
+ Who actually benefits from this?! Not you. Not your family. Not your community. The gap between what they promise and what they deliver keeps growing wider, and at some point we all need to stop pretending that things are fine when they clearly are not.
34
+ """
35
+
36
+ NEWS_TEXT = """
37
+ Good evening. Tonight, we begin with developments in Washington. Officials announced a new policy initiative aimed at addressing ongoing economic concerns. The proposal, introduced earlier today, is expected to face debate in the coming weeks.
38
+
39
+ According to sources familiar with the matter, the plan includes a series of measures designed to stabilize markets and provide support to affected industries. Analysts say the impact of these changes will depend largely on how they are implemented and received by both lawmakers and the public.
40
+
41
+ In other news, international leaders continue discussions on climate agreements. Several key meetings are scheduled for later this month. While progress has been reported, significant differences remain on critical issues.
42
+
43
+ We will continue to follow these stories and bring you updates as more information becomes available.
44
+ """
45
+
46
+ CHAOS_TEXT = """
47
+ ok this is wild like actually insane?? just saw 3 different things happen at once and none of it makes sense
48
+
49
+ why is everything breaking lol nothing loads then suddenly it does and then it crashes again
50
+
51
+ also did anyone else notice that thing earlier?? no one is talking about it but it was everywhere for like 5 minutes
52
+
53
+ anyway im tired of this, going offline for a bit, this whole thing is too much
54
+ """
55
+ TEST_SOURCES = {
56
+ "rant": RANT_TEXT,
57
+ "chaos": CHAOS_TEXT,
58
+ "news": NEWS_TEXT}
59
+
60
+ SOURCES = {
61
+ "mlk_dream": "https://kr.usembassy.gov/martin-luther-king-jr-dream-speech-1963/", #https://www.americanrhetoric.com/speeches/mlkihaveadream.htm",
62
+ "gettysburg": "https://www.abrahamlincolnonline.org/lincoln/speeches/gettysburg.htm",
63
+ "churchill_beaches": "https://winstonchurchill.org/resources/speeches/1940-the-finest-hour/we-shall-fight-on-the-beaches/",
64
+ }
65
+ NEWS_SOURCES = {
66
+ "reuters": "http://feeds.reuters.com/reuters/topNews",
67
+ "bbc": "http://feeds.bbci.co.uk/news/rss.xml",
68
+ "nyt": "https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml",
69
+ "rollingStone": "https://www.rollingstone.com/feed/",
70
+ "alJazeera": "https://www.aljazeera.com/xml/rss/all.xml",
71
+ "fox": "https://moxie.foxnews.com/google-publisher/latest.xml",
72
+ "tmz": "https://www.tmz.com/rss.xml",
73
+ "dailymail": "https://dailymail.co.uk/news/index.rss",
74
+ }
75
+ DRY_RUN_LIMIT = 3 # number of hours to process
76
+ VARIANTS = 1 # clips per hour
77
+ CLIP_SECONDS = 30 # desired length (passed into prompt)
78
+ import requests
79
+ from bs4 import BeautifulSoup
80
+
81
+ HEADERS = {
82
+ "User-Agent": (
83
+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) "
84
+ "AppleWebKit/537.36 (KHTML, like Gecko) "
85
+ "Chrome/124.0.0.0 Safari/537.36"
86
+ )
87
+ }
88
+
89
+
90
+
91
+ import feedparser
92
+
93
+ def fetch_feed(url):
94
+ feed = feedparser.parse(url)
95
+ items = []
96
+ for entry in feed.entries:
97
+ items.append({
98
+ "title": entry.title,
99
+ "published": entry.get("published", entry.get("updated", ""))
100
+ })
101
+ return items
102
+ def fetch_speech(url): #this would be used for speeches or text in general.
103
+ response = requests.get(url, headers=HEADERS, timeout=20)
104
+ response.raise_for_status()
105
+
106
+ soup = BeautifulSoup(response.text, "html.parser")
107
+
108
+ paragraphs = []
109
+ main = soup.find("main")
110
+ candidates = main.find_all("p") if main else soup.find_all("p")
111
+
112
+ for p in candidates:
113
+ text = p.get_text(" ", strip=True)
114
+ if len(text) >= 80:
115
+ paragraphs.append(text)
116
+
117
+ return paragraphs
118
+ def text_to_rows(text, source):
119
+ paragraphs = [p.strip() for p in text.split("\n") if len(p.strip()) > 30]
120
+ return [
121
+ {"source": source, "section_id": i, "text": p}
122
+ for i, p in enumerate(paragraphs)
123
+ ]
124
+
125
+
126
+
127
+ from functools import lru_cache
128
+
129
+ @lru_cache()
130
+ def get_model():
131
+ return SentenceTransformer("all-mpnet-base-v2")
132
+
133
+ @lru_cache()
134
+ def get_sentiment_pipe():
135
+ return pipeline("sentiment-analysis", model="distilbert/distilbert-base-uncased-finetuned-sst-2-english")
136
+
137
+ @lru_cache()
138
+ def get_emotion_pipe():
139
+ return pipeline("text-classification", model="j-hartmann/emotion-english-distilroberta-base", top_k=None)
140
+ from sentence_transformers import SentenceTransformer
141
+
142
+ model = get_model()
143
+
144
+ from transformers import pipeline
145
+ import re
146
+
147
+ # sentiment: positive/negative
148
+ sentiment_pipe = get_sentiment_pipe()
149
+
150
+ # emotion: joy / anger / fear / sadness / etc.
151
+ emotion_pipe = get_emotion_pipe()
152
+
153
+ def chunk_text(text, max_words=250):
154
+ words = text.split()
155
+ chunks = []
156
+ for i in range(0, len(words), max_words):
157
+ chunk = " ".join(words[i:i + max_words])
158
+ if chunk.strip():
159
+ chunks.append(chunk)
160
+ return chunks
161
+
162
+ def split_sentences(text):
163
+ parts = re.split(r'[.!?]+', text)
164
+ return [p.strip() for p in parts if p.strip()]
165
+
166
+ def tokenize(text):
167
+ return re.findall(r"\b[\w']+\b", text.lower())
168
+
169
+ def tone_score(text):
170
+ chunks = chunk_text(text, max_words=250)
171
+ preds = emotion_pipe(chunks)
172
+
173
+ vals = []
174
+ for chunk_preds in preds:
175
+ scores = {d["label"].lower(): d["score"] for d in chunk_preds}
176
+
177
+ positive = (
178
+ scores.get("joy", 0.0) +
179
+ scores.get("love", 0.0) +
180
+ scores.get("surprise", 0.0) * 0.25
181
+ )
182
+
183
+ negative = (
184
+ scores.get("anger", 0.0) +
185
+ scores.get("fear", 0.0) +
186
+ scores.get("sadness", 0.0) +
187
+ scores.get("disgust", 0.0)
188
+ )
189
+
190
+ raw = positive - negative
191
+ val = 0.5 + 0.5 * raw
192
+ vals.append(float(np.clip(val, 0, 1)))
193
+
194
+ return float(np.mean(vals))
195
+
196
+ def pace_score(text):
197
+ chunks = chunk_text(text, max_words=250)
198
+ preds = emotion_pipe(chunks)
199
+
200
+ urgency_vals = []
201
+ for chunk_preds in preds:
202
+ scores = {d["label"].lower(): d["score"] for d in chunk_preds}
203
+
204
+ urgency = (
205
+ scores.get("anger", 0.0) +
206
+ scores.get("fear", 0.0) +
207
+ scores.get("surprise", 0.0) +
208
+ scores.get("disgust", 0.0) * 0.5 +
209
+ scores.get("neutral", 0.0) * 0.35 +
210
+ scores.get("joy", 0.0) * 0.5 +
211
+ scores.get("sadness", 0.0) * 0.2
212
+ )
213
+ urgency_vals.append(min(urgency, 1.0))
214
+
215
+ model_score = float(np.mean(urgency_vals)) if urgency_vals else 0.0
216
+
217
+ # structural signals
218
+ sentences = split_sentences(text)
219
+ words = tokenize(text)
220
+
221
+ exclam = text.count("!") + text.count("?")
222
+ short_sentences = sum(1 for s in sentences if len(tokenize(s)) < 8) if sentences else 0
223
+ avg_len = np.mean([len(tokenize(s)) for s in sentences if tokenize(s)]) if sentences else 20
224
+
225
+ structural = (
226
+ (exclam / 10.0) * 0.3 +
227
+ (short_sentences / max(len(sentences), 1)) * 0.4 +
228
+ (1.0 / (avg_len + 1)) * 5.0 * 0.3 # shorter avg = higher pace
229
+ )
230
+ structural = float(np.clip(structural, 0, 1))
231
+
232
+ return float(np.clip(0.4 * model_score + 0.6 * structural, 0, 1))
233
+
234
+ def coherence_score(embs):
235
+ if len(embs) < 2:
236
+ return 0.0
237
+ sims = cosine_similarity(embs)
238
+ return float(np.mean(sims))
239
+
240
+ def repetition_score(text):
241
+ words = tokenize(text)
242
+ if not words:
243
+ return 0.0
244
+ return 1.0 - (len(set(words)) / len(words))
245
+
246
+ def intensity_score(text):
247
+ chunks = chunk_text(text, max_words=250)
248
+ preds = emotion_pipe(chunks)
249
+
250
+ model_vals = []
251
+ for chunk_preds in preds:
252
+ scores = {d["label"].lower(): d["score"] for d in chunk_preds}
253
+ agitation = (
254
+ scores.get("anger", 0.0) +
255
+ scores.get("fear", 0.0) +
256
+ scores.get("disgust", 0.0)
257
+ )
258
+ model_vals.append(min(agitation, 1.0))
259
+
260
+ model_score = float(np.mean(model_vals)) if model_vals else 0.0
261
+
262
+ # structural boost so chaotic / bursty text is not mislabeled as calm
263
+ exclam = text.count("!")
264
+ question = text.count("?")
265
+ short_sentences = sum(
266
+ 1 for s in split_sentences(text)
267
+ if len(tokenize(s)) < 6
268
+ )
269
+
270
+ structural_score = (exclam + question) / 10.0 + short_sentences / 20.0
271
+ structural_score = float(np.clip(structural_score, 0, 1))
272
+
273
+ return float(np.clip(0.5 * model_score + 0.5 * structural_score, 0, 1))
274
+ def getJoinedText(group):
275
+ if (sourceType == "news"):
276
+ returnText = " ".join(group["title"].tolist())
277
+ else:
278
+ returnText = " ".join(group["text"].tolist())
279
+ return returnText
280
+
281
+ def source_metrics(group):
282
+ full_text = getJoinedText(group)
283
+ embs = np.vstack(group["embedding"].values)
284
+
285
+ return {
286
+ "repetition": repetition_score(full_text),
287
+ "pace": pace_score(full_text),
288
+ "intensity": intensity_score(full_text),
289
+ "tone": tone_score(full_text),
290
+ "coherence": coherence_score(embs),
291
+ }
292
+ def avg_similarity(embs):
293
+ embs = np.array(embs)
294
+ norm = embs / np.linalg.norm(embs, axis=1, keepdims=True)
295
+ sim = norm @ norm.T
296
+ return sim.mean()
297
+ from sklearn.cluster import KMeans # import HDBSCAN
298
+
299
+ def cluster_count(embs, k=3):
300
+ hdb = kmeans = KMeans(n_clusters=k, random_state=42, n_init="auto") #HDBSCAN(min_cluster_size=2, min_samples=1)
301
+ labels = kmeans.fit_predict(embs) #hdb.fit(embs)
302
+ return len(set(labels))
303
+
304
+ #return len(set(hdb.labels_)) - (1 if -1 in hdb.labels_ else 0)
305
+ def cluster_spread(embs, k=3):
306
+ kmeans = KMeans(n_clusters=k, random_state=42, n_init="auto")
307
+ labels = kmeans.fit_predict(embs)
308
+
309
+ counts = np.bincount(labels)
310
+ probs = counts / counts.sum()
311
+
312
+ # entropy → how evenly spread across clusters
313
+ return -np.sum(probs * np.log(probs + 1e-9))
314
+ def continuity_score(embs):
315
+ sims = []
316
+ for i in range(len(embs) - 1):
317
+ sim = cosine_similarity([embs[i]], [embs[i + 1]])[0][0]
318
+ sims.append(sim)
319
+ return float(np.mean(sims))
320
+ def build_prompt(params):
321
+ intensity = params["intensity"]
322
+ coherence = params["coherence"]
323
+ pace = params["pace"]
324
+ repetition = params["repetition"]
325
+ tone = params["tone"]
326
+
327
+ # Intensity — 5 tiers
328
+ if intensity > 0.8:
329
+ intensity_desc = "explosive, overwhelming, chaotic energy"
330
+ elif intensity >= 0.5:
331
+ intensity_desc = "urgent, relentless, focused drive"
332
+ elif intensity > 0.4:
333
+ intensity_desc = "building momentum, pushing forward"
334
+ elif intensity > 0.2:
335
+ intensity_desc = "simmering excitement, restrained but present"
336
+ else:
337
+ intensity_desc = "still, barely moving, subdued"
338
+
339
+ # Coherence — 5 tiers
340
+ if coherence > 0.8:
341
+ coherence_desc = "locked-in, unwavering, hypnotic repetition"
342
+ elif coherence > 0.6:
343
+ coherence_desc = "steady and focused with minor detours"
344
+ elif coherence > 0.4:
345
+ coherence_desc = "loosely connected, drifting between ideas"
346
+ elif coherence > 0.2:
347
+ coherence_desc = "fractured, jumping between unrelated fragments"
348
+ else:
349
+ coherence_desc = "total chaos, no thread holding it together"
350
+
351
+ # Pace — 5 tiers
352
+ if pace > 0.8:
353
+ pace_desc = "frantic, breathless, machine-gun rhythm"
354
+ elif pace > 0.6:
355
+ pace_desc = "fast and urgent, rapid-fire delivery"
356
+ elif pace > 0.4:
357
+ pace_desc = "moderate but purposeful movement"
358
+ elif pace > 0.2:
359
+ pace_desc = "slow and deliberate, heavy footsteps"
360
+ else:
361
+ pace_desc = "glacial, drawn out, almost frozen"
362
+
363
+ # Repetition — 5 tiers
364
+ if repetition > 0.8:
365
+ repetition_desc = "obsessive loops on the same idea relentlessly, perfect repetition"
366
+ elif repetition > 0.6:
367
+ repetition_desc = "strong recurring motifs, circling back insistently"
368
+ elif repetition > 0.4:
369
+ repetition_desc = "some repeating patterns with variation"
370
+ elif repetition > 0.2:
371
+ repetition_desc = "mostly fresh ideas, little callback"
372
+ else:
373
+ repetition_desc = "constant change, never repeating"
374
+
375
+ # Tone — 5 tiers
376
+ if tone > 0.8:
377
+ tone_desc = "radiant, joyful, triumphant"
378
+ elif tone > 0.6:
379
+ tone_desc = "warm, hopeful, gently uplifting"
380
+ elif tone > 0.4:
381
+ tone_desc = "neutral, observational, emotionally flat"
382
+ elif tone > 0.2:
383
+ tone_desc = "uneasy, critical, desiring change"
384
+ else:
385
+ tone_desc = "seething anger, dark and confrontational"
386
+
387
+ return f"""
388
+ Create a made for radio song clip that does not have words.
389
+
390
+ Energy: {intensity_desc}
391
+ Structure: {coherence_desc}
392
+ Pace: {pace_desc}
393
+ Motifs: {repetition_desc}
394
+ Emotional tone: {tone_desc}
395
+
396
+ No words. Keep it concise and clearly reflect these rules.
397
+ """
398
+ from functools import lru_cache
399
+
400
+ @lru_cache()
401
+ def get_el_client():
402
+ return ElevenLabs(api_key=os.environ["ELEVENLABS_API_KEY"])
403
+
404
+ def generate_music(prompt, hcFlag):
405
+ client = get_el_client()
406
+
407
+ if (hcFlag):
408
+ prompt="a new funk soul song with heavy bass and a rap break. do not use ANY words"
409
+
410
+ return client.music.compose(
411
+ prompt=prompt,
412
+ music_length_ms=CLIP_SECONDS * 500,
413
+ )
414
+ import json, re
415
+
416
+ def parse_styles(resp):
417
+ text = resp.content[0].text
418
+ match = re.search(r'```json\s*(.*?)\s*```', text, re.DOTALL)
419
+ if match:
420
+ return json.loads(match.group(1))
421
+ return json.loads(text)
422
+
423
+
424
+ def get_full_plan(text, metrics, duration_ms=CLIP_SECONDS * 1000):
425
+
426
+
427
+ chat = Chat("claude-sonnet-4-20250514")
428
+
429
+ prompt = f"""Here is a text excerpt:
430
+ "{text}"
431
+
432
+ Computed metrics:
433
+ - intensity: {metrics['intensity']:.2f}
434
+ - pace: {metrics['pace']:.2f}
435
+ - tone: {metrics['tone']:.2f}
436
+ - coherence: {metrics['coherence']:.2f}
437
+ - repetition: {metrics['repetition']:.2f}
438
+
439
+ Generate an ElevenLabs music composition plan as JSON. Total duration: {duration_ms}ms. Instrumental only.
440
+
441
+ Use the text content to choose appropriate genres and instruments for global styles.
442
+ Use the metrics to shape the section structure — number of sections, durations, and local energy levels.
443
+
444
+ Return ONLY a JSON object with this exact structure:
445
+ {{
446
+ "positive_global_styles": ["2-4 specific genre/instrument terms"],
447
+ "negative_global_styles": ["2-4 terms to exclude"],
448
+ "sections": [
449
+ {{
450
+ "section_name": "name",
451
+ "positive_local_styles": ["2-4 specific instrument/structural terms"],
452
+ "negative_local_styles": ["2-4 terms to exclude"],
453
+ "duration_ms": integer,
454
+ "lines": []
455
+ }}
456
+ ]
457
+ }}
458
+
459
+ Section durations must sum to {duration_ms}. Use 2-4 sections. No mood or emotion words — only genre names, instrument names, and structural music terms. Only use specific popular music genres (e.g. funk, hip-hop, grime, metal, thrash, rock, jazz, R&B, garage, drum and bass, punk, etc) over abstract genres like ambient or experimental. Use only band instruments (electric guitar, bass guitar, drum kit, synth). NEEVER use orchestral instruments (strings, brass, choir, woodwinds). ALWAYS use a full compliment of instruments
460
+ """
461
+
462
+ resp = chat(prompt)
463
+ plan_dict = parse_styles(resp)
464
+
465
+ from elevenlabs.types import MusicPrompt, SongSection
466
+ return MusicPrompt(
467
+ positive_global_styles=plan_dict["positive_global_styles"],
468
+ negative_global_styles=plan_dict["negative_global_styles"],
469
+ sections=[SongSection(**s) for s in plan_dict["sections"]]
470
+ )
471
+ import umap.umap_ as umap
472
+ import matplotlib.pyplot as plt
473
+ import numpy as np
474
+
475
+
476
+ def plot_umap(source):
477
+ # group = df[(df["day"] == day) & (df["source"] == source)]
478
+ group = df[(df["source"] == source)]
479
+
480
+ if len(group) < 3:
481
+ print("Not enough data")
482
+ return
483
+
484
+ embs = np.vstack(group["embedding"].values)
485
+
486
+ reducer = umap.UMAP(n_components=2, random_state=42, init="random")
487
+ coords = reducer.fit_transform(embs)
488
+
489
+ plt.figure(figsize=(6,6))
490
+ plt.scatter(coords[:,0], coords[:,1])
491
+
492
+ # label a few points
493
+ if (sourceType == "news"):
494
+ for i, title in enumerate(group["title"].tolist()[:10]):
495
+ plt.text(coords[i,0], coords[i,1], str(i), fontsize=8)
496
+ else:
497
+ for i, title in enumerate(group["text"].tolist()[:10]):
498
+ plt.text(coords[i,0], coords[i,1], str(i), fontsize=8)
499
+
500
+
501
+ plt.title(f"Date — {source}")
502
+ plt.show()
503
+
504
+ # print mapping so you can inspect
505
+ # if (sourceType == "news"):
506
+ # for i, t in enumerate(group["title"].tolist()):
507
+ # print(i, t)
508
+ # else:
509
+ # for i, t in enumerate(group["text"].tolist()):
510
+ # print(i, t)
511
+ def get_simple_prompt(text, metrics):
512
+ chat = Chat("claude-sonnet-4-20250514")
513
+ prompt = f"""Here is a text excerpt:
514
+ "{text}"
515
+
516
+ Computed metrics:
517
+ - intensity: {metrics['intensity']:.2f}
518
+ - pace: {metrics['pace']:.2f}
519
+ - tone: {metrics['tone']:.2f}
520
+ - coherence: {metrics['coherence']:.2f}
521
+ - repetition: {metrics['repetition']:.2f}
522
+
523
+ Write a single short music prompt (1-2 sentences) describing a song that reflects this text's mood and energy. Use a specific genre (e.g. funk, soul, hip-hop, rock, jazz). Mention specific instruments. Say "no words". Return ONLY the prompt, nothing else."""
524
+
525
+ resp = chat(prompt)
526
+ return resp.content[0].text
527
+ def lookupSource(type, key):
528
+ if (type == "news"):
529
+ return NEWS_SOURCES[key]
530
+ elif (type =="test"):
531
+ return TEST_SOURCES[key]
532
+ else:
533
+ return SOURCES[key]
534
+
535
+ def process_source(source_name, source_url, source_type, output_dir="./outputs"):
536
+ global sourceType
537
+ sourceType = source_type
538
+
539
+ source_data = source_url # instead of lookupSource(...)
540
+ # source_data = lookupSource(sourceType, source_name)
541
+
542
+ if not source_data:
543
+ print(f"No source data for {source_type}")
544
+ return
545
+
546
+ import os
547
+ os.makedirs(output_dir, exist_ok=True)
548
+
549
+ # 1. Collect
550
+ if source_type == "speech":
551
+ paragraphs = fetch_speech(source_data)
552
+ rows = [{"source": source_name, "section_id": i, "text": t} for i, t in enumerate(paragraphs)]
553
+ elif source_type == "news":
554
+ items = fetch_feed(source_data)
555
+ for i in items:
556
+ i["source"] = source_name
557
+ rows = items
558
+ elif source_type == "test":
559
+ rows = text_to_rows(source_data, source_name)
560
+
561
+ if not rows:
562
+ print(f"Skipping {source_name} — no items returned")
563
+ return None
564
+
565
+ df = pd.DataFrame(rows)
566
+
567
+ # 2. Embed
568
+ text_col = "title" if source_type == "news" else "text"
569
+ embeddings = get_model().encode(df[text_col].tolist(), show_progress_bar=True)
570
+ df["embedding"] = list(embeddings)
571
+
572
+ # 3. Score
573
+ metrics = source_metrics(df)
574
+ metrics["source"] = source_name
575
+ print(f"Metrics for {source_name}:", metrics)
576
+
577
+ # 4. Build plan
578
+ full_text = " ".join(df[text_col].tolist())
579
+ plan = get_full_plan(full_text, metrics)
580
+ print(f"Plan for {source_name}:", plan.positive_global_styles)
581
+
582
+ # 5. Generate audio
583
+ client = get_el_client()
584
+ result = client.music.compose_detailed(
585
+ composition_plan=plan,
586
+ respect_sections_durations=True,
587
+ )
588
+
589
+ filepath = f"{output_dir}/{source_name}_song.mp3"
590
+ with open(filepath, "wb") as f:
591
+ f.write(result.audio)
592
+
593
+ print(f"Saved: {filepath}")
594
+ return filepath
595
+ def validate_sources(sources, source_type):
596
+ if not sources:
597
+ raise ValueError("No sources provided")
598
+ if source_type not in ("news", "speech"):
599
+ raise ValueError(f"source_type must be 'news' or 'speech', got '{source_type}'")
600
+ for name, url in sources.items():
601
+ if not isinstance(url, str) or not url.strip():
602
+ raise ValueError(f"Invalid URL for source '{name}'")
603
+ validate_keys()
604
+ def run_digest(sources, source_type, output_dir="./outputs"):
605
+ validate_sources(sources, source_type)
606
+ paths = []
607
+ for name, url in sources.items():
608
+ print(f"{name} and the url is: {url}")
609
+ path = process_source(name, url, source_type, output_dir)
610
+ if path: paths.append(path)
611
+ return paths
@@ -0,0 +1,9 @@
1
+ """Fill in a module description here"""
2
+
3
+ # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_core.ipynb.
4
+
5
+ # %% auto #0
6
+ __all__ = ['foo']
7
+
8
+ # %% ../nbs/00_core.ipynb #7146e116
9
+ def foo(): pass
@@ -0,0 +1,11 @@
1
+ from beatscore import run_digest
2
+
3
+ sources = {
4
+ "reuters": "http://feeds.reuters.com/reuters/topNews",
5
+ "bbc": "http://feeds.bbci.co.uk/news/rss.xml",
6
+ "nyt": "https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml",
7
+ "rollingStone": "https://www.rollingstone.com/feed/"
8
+ }
9
+
10
+
11
+ run_digest(sources, "news", output_dir="./output")
@@ -0,0 +1,125 @@
1
+ Metadata-Version: 2.4
2
+ Name: beatscore
3
+ Version: 0.0.1
4
+ Summary: Turn text into music. Hackathon using ElevenLabs
5
+ Author-email: FS <funkstop@internetplus.com>
6
+ License: Apache-2.0
7
+ Project-URL: Repository, https://github.com/funkstop/beatscore
8
+ Project-URL: Documentation, https://funkstop.github.io/beatscore/
9
+ Keywords: nbdev
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3 :: Only
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: pandas
16
+ Requires-Dist: numpy
17
+ Requires-Dist: scikit-learn
18
+ Requires-Dist: sentence-transformers
19
+ Requires-Dist: transformers
20
+ Requires-Dist: elevenlabs
21
+ Requires-Dist: feedparser
22
+ Requires-Dist: beautifulsoup4
23
+ Requires-Dist: requests
24
+ Requires-Dist: claudette
25
+ Dynamic: license-file
26
+
27
+ # beatscore
28
+
29
+ A small libary that converts structured text into short music clips by mapping properties of the input (intensity, repetition, pace, tone, coherence) into promptable audio generation using the ElevenLabs Music API
30
+
31
+ The goal is to experiment how differences in source material can be perceptible in sound.
32
+
33
+ ## Example
34
+
35
+ - Opinionated text → more forceful, higher energy
36
+ - Neutral news → more structured, calmer
37
+ - Fragmented text → faster, less predictable
38
+
39
+ ## API
40
+
41
+ ```python
42
+ run_digest(sources, source_type, output_dir)
43
+ ```
44
+ where:
45
+ * sources: a dictionary of articles, feeds, or any text.
46
+ * source_type: one of 'news' or 'speech'. News expects sources to be a dictionary of rss feeds.
47
+ * output_dir: the location for generated files
48
+
49
+
50
+
51
+
52
+ ## News RSS Example:
53
+
54
+ ```python
55
+ from beatscore import run_digest
56
+
57
+ sources = {
58
+ "reuters": "http://feeds.reuters.com/reuters/topNews",
59
+ "bbc": "http://feeds.bbci.co.uk/news/rss.xml",
60
+ "nyt": "https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml",
61
+ "rollingStone": "https://www.rollingstone.com/feed/"
62
+ }
63
+
64
+
65
+ run_digest(sources, "news", output_dir="./output")
66
+
67
+ ```
68
+
69
+
70
+ ## Speech example:
71
+
72
+ ```python
73
+ from beatscore import run_digest
74
+
75
+ sources = {
76
+ "mlk_dream": "https://kr.usembassy.gov/martin-luther-king-jr-dream-speech-1963/", #https://www.americanrhetoric.com/speeches/mlkihaveadream.htm",
77
+ "gettysburg": "https://www.abrahamlincolnonline.org/lincoln/speeches/gettysburg.htm",
78
+ "churchill_beaches": "https://winstonchurchill.org/resources/speeches/1940-the-finest-hour/we-shall-fight-on-the-beaches/",
79
+ }
80
+
81
+
82
+ run_digest(sources, "speech", output_dir="./output")
83
+
84
+ ```
85
+
86
+ ## Setup
87
+
88
+ You'll need three API keys:
89
+ - `ELEVENLABS_API_KEY` — for music generation
90
+ - `HF_TOKEN` — for embeddings and emotion models
91
+ - `ANTHROPIC_API_KEY` — for prompt engineering with Claude
92
+
93
+ Set them as environment variables or pass directly to functions.
94
+
95
+
96
+ ## Installation
97
+
98
+ Install latest from the GitHub [repository][repo]:
99
+
100
+ ```sh
101
+ $ pip install git+https://github.com/funkstop/beatscore.git
102
+ ```
103
+
104
+ or from [pypi][pypi]
105
+
106
+
107
+ ```sh
108
+ $ pip install beatscore
109
+ ```
110
+
111
+
112
+ [repo]: https://github.com/funkstop/beatscore
113
+ [docs]: https://funkstop.github.io/beatscore/
114
+ [pypi]: https://pypi.org/project/beatscore/
115
+
116
+
117
+ ### Documentation
118
+
119
+ Documentation can be found hosted on this GitHub [repository][repo]'s [pages][docs]. Additionally you can find package manager specific guidelines on [pypi][pypi].
120
+
121
+ [repo]: https://github.com/funkstop/beatscore
122
+ [docs]: https://funkstop.github.io/beatscore/
123
+ [pypi]: https://pypi.org/project/beatscore/
124
+
125
+
@@ -0,0 +1,15 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ pyproject.toml
5
+ beatscore/__init__.py
6
+ beatscore/_modidx.py
7
+ beatscore/beatscore.py
8
+ beatscore/core.py
9
+ beatscore/test.py
10
+ beatscore.egg-info/PKG-INFO
11
+ beatscore.egg-info/SOURCES.txt
12
+ beatscore.egg-info/dependency_links.txt
13
+ beatscore.egg-info/entry_points.txt
14
+ beatscore.egg-info/requires.txt
15
+ beatscore.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [nbdev]
2
+ beatscore = beatscore._modidx:d
@@ -0,0 +1,10 @@
1
+ pandas
2
+ numpy
3
+ scikit-learn
4
+ sentence-transformers
5
+ transformers
6
+ elevenlabs
7
+ feedparser
8
+ beautifulsoup4
9
+ requests
10
+ claudette
@@ -0,0 +1 @@
1
+ beatscore
@@ -0,0 +1,51 @@
1
+ [build-system]
2
+ requires = ["setuptools>=64"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "beatscore"
7
+ dynamic = ["version"]
8
+ description = "Turn text into music. Hackathon using ElevenLabs"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = {text = "Apache-2.0"}
12
+ authors = [{name = "FS", email = "funkstop@internetplus.com"}]
13
+ keywords = ['nbdev']
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "Programming Language :: Python :: 3 :: Only",
17
+ ]
18
+
19
+ dependencies = [
20
+ "pandas",
21
+ "numpy",
22
+ "scikit-learn",
23
+ "sentence-transformers",
24
+ "transformers",
25
+ "elevenlabs",
26
+ "feedparser",
27
+ "beautifulsoup4",
28
+ "requests",
29
+ "claudette",
30
+ ]
31
+
32
+ [project.urls]
33
+ Repository = "https://github.com/funkstop/beatscore"
34
+ Documentation = "https://funkstop.github.io/beatscore/"
35
+
36
+ [project.entry-points.nbdev]
37
+ beatscore = "beatscore._modidx:d"
38
+
39
+ [tool.setuptools.dynamic]
40
+ version = {attr = "beatscore.__version__"}
41
+
42
+ [tool.setuptools.packages.find]
43
+ include = ["beatscore"]
44
+
45
+ [tool.nbdev]
46
+ nbs_path = "nbs"
47
+ lib_path = "beatscore"
48
+ doc_path = "_docs"
49
+ recursive = "True"
50
+ tst_flags = "notest"
51
+
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+