smart-mashup 0.1.0__py3-none-any.whl

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 @@
1
+ __version__ = "0.1.0"
@@ -0,0 +1,32 @@
1
+ import librosa
2
+ import numpy as np
3
+
4
+
5
+ class MuzikAnalizcisi:
6
+
7
+ def __init__(self):
8
+ pass
9
+
10
+ def analiz_et(self, ses_dosyasi_yolu: str) -> dict:
11
+ y, sr = librosa.load(ses_dosyasi_yolu, sr=None)
12
+
13
+ tempo, _ = librosa.beat.beat_track(y=y, sr=sr)
14
+ if isinstance(tempo, np.ndarray):
15
+ bpm = float(tempo[0])
16
+ else:
17
+ bpm = float(tempo)
18
+
19
+ ton = self._ton_tahmin_et(y, sr)
20
+
21
+ return {
22
+ "bpm": round(bpm, 2),
23
+ "ton": ton,
24
+ "ornekleme_hizi": sr
25
+ }
26
+
27
+ def _ton_tahmin_et(self, y: np.ndarray, sr: int) -> str:
28
+ chroma = librosa.feature.chroma_cqt(y=y, sr=sr)
29
+ chroma_ortalamasi = np.mean(chroma, axis=1)
30
+ notalar = ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"]
31
+ en_guclu_nota_indeksi = int(np.argmax(chroma_ortalamasi))
32
+ return notalar[en_guclu_nota_indeksi]
smart_mashup/mixer.py ADDED
@@ -0,0 +1,29 @@
1
+ import os
2
+ from .separator import VokalAyirici
3
+ from .segmenter import VokalBolucu
4
+ from .analyzer import MuzikAnalizcisi
5
+
6
+
7
+ class AkilliRemixMotoru:
8
+
9
+ def __init__(self, cikis_klasoru: str = "output_remixes"):
10
+ self.cikis_klasoru = cikis_klasoru
11
+ os.makedirs(self.cikis_klasoru, exist_ok=True)
12
+
13
+ self.ayirici = VokalAyirici()
14
+ self.bolucu = VokalBolucu()
15
+ self.analizci = MuzikAnalizcisi()
16
+
17
+ def mashup_olustur(self, sarki_a_yolu: str, sarki_b_yolu: str) -> str:
18
+ vokal_a, altyapi_a = self.ayirici.ayir(sarki_a_yolu)
19
+ vokal_b, altyapi_b = self.ayirici.ayir(sarki_b_yolu)
20
+
21
+ parcalar_a = self.bolucu.vokalleri_bol(vokal_a)
22
+ parcalar_b = self.bolucu.vokalleri_bol(vokal_b)
23
+
24
+ bilgi_a = self.analizci.analiz_et(sarki_a_yolu)
25
+ bilgi_b = self.analizci.analiz_et(sarki_b_yolu)
26
+
27
+ cikis_yolu = os.path.join(self.cikis_klasoru, "akilli_remix_sonuc.wav")
28
+
29
+ return cikis_yolu
@@ -0,0 +1,48 @@
1
+ import librosa
2
+ import numpy as np
3
+
4
+
5
+ class VokalBolucu:
6
+
7
+ def __init__(self, esik_db: int = -40, minimum_sure_sn: float = 0.5):
8
+ self.esik_db = esik_db
9
+ self.minimum_sure_sn = minimum_sure_sn
10
+
11
+ def vokalleri_bol(self, vokal_dosya_yolu: str) -> list[dict]:
12
+ y, sr = librosa.load(vokal_dosya_yolu, sr=None)
13
+
14
+ araliklar = librosa.effects.split(y, top_db=abs(self.esik_db))
15
+ vokal_parcalari = []
16
+ min_ornek_sayisi = int(self.minimum_sure_sn * sr)
17
+
18
+ for baslangic, bitis in araliklar:
19
+ if (bitis - baslangic) >= min_ornek_sayisi:
20
+ baslangic_sn = baslangic / sr
21
+ bitis_sn = bitis / sr
22
+ parca_verisi = y[baslangic:bitis]
23
+
24
+ enerji = float(np.mean(np.abs(parca_verisi)))
25
+ maks_frekans = self._tize_cikis_analizi(parca_verisi, sr)
26
+
27
+ vokal_parcalari.append({
28
+ "baslangic_sn": round(baslangic_sn, 2),
29
+ "bitis_sn": round(bitis_sn, 2),
30
+ "sure_sn": round(bitis_sn - baslangic_sn, 2),
31
+ "enerji": enerji,
32
+ "maks_frekans": maks_frekans,
33
+ "veri": parca_verisi,
34
+ })
35
+
36
+ return vokal_parcalari
37
+
38
+ def _tize_cikis_analizi(self, parca_verisi: np.ndarray, sr: int) -> float:
39
+ try:
40
+ f0, _, _ = librosa.pyin(
41
+ parca_verisi, fmin=librosa.note_to_hz('C2'), fmax=librosa.note_to_hz('C7')
42
+ )
43
+ temiz_f0 = f0[~np.isnan(f0)]
44
+ if len(temiz_f0) > 0:
45
+ return float(np.max(temiz_f0))
46
+ except Exception:
47
+ pass
48
+ return 0.0
@@ -0,0 +1,39 @@
1
+ import os
2
+ import subprocess
3
+
4
+
5
+ class VokalAyirici:
6
+
7
+ def __init__(self, model_adi: str = "htdemucs"):
8
+ self.model_adi = model_adi
9
+
10
+ def ayir(self, ses_dosyasi_yolu: str, cikis_klasoru: str = "islenen_sesler") -> tuple[str, str]:
11
+ if not os.path.exists(ses_dosyasi_yolu):
12
+ raise FileNotFoundError(f"Ses dosyası bulunamadı: {ses_dosyasi_yolu}")
13
+
14
+ os.makedirs(cikis_klasoru, exist_ok=True)
15
+
16
+ komut = [
17
+ "demucs",
18
+ "-n",
19
+ self.model_adi,
20
+ "-o",
21
+ cikis_klasoru,
22
+ ses_dosyasi_yolu,
23
+ ]
24
+
25
+ try:
26
+ subprocess.run(komut, check=True)
27
+ except subprocess.CalledProcessError as e:
28
+ raise RuntimeError(f"Ses ayrıştırma sırasında hata oluştu: {e}")
29
+
30
+ dosya_adi = os.path.splitext(os.path.basename(ses_dosyasi_yolu))[0]
31
+ cikti_dizini = os.path.join(cikis_klasoru, self.model_adi, dosya_adi)
32
+
33
+ vokal_yolu = os.path.join(cikti_dizini, "vocals.wav")
34
+ altyapi_yolu = os.path.join(cikti_dizini, "no_vocals.wav")
35
+
36
+ if os.path.exists(vokal_yolu) and os.path.exists(altyapi_yolu):
37
+ return vokal_yolu, altyapi_yolu
38
+ else:
39
+ raise FileNotFoundError("Ayrıştırılan vokal veya altyapı dosyası disk üzerinde bulunamadı.")
@@ -0,0 +1,41 @@
1
+ Metadata-Version: 2.4
2
+ Name: smart-mashup
3
+ Version: 0.1.0
4
+ Summary: Yapay zeka destekli akıllı vokal kesme ve remix kütüphanesi
5
+ Author: Muhammed Bedirhan Keskin
6
+ Project-URL: Homepage, https://github.com/kullanici-adin/smart-mashup
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.9
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: numpy>=1.22.0
14
+ Requires-Dist: librosa>=0.10.0
15
+ Requires-Dist: soundfile>=0.11.0
16
+ Requires-Dist: demucs>=4.0.0
17
+ Dynamic: license-file
18
+
19
+ # Smart Mashup
20
+
21
+ Smart Mashup, yapay zeka destekli ses ayrıştırma ve müzik analizi araçlarını bir araya getiren açık kaynaklı bir Python kütüphanesidir. Şarkıların vokallerini ve altyapılarını birbirinden ayırır, cümle yapılarını ve tize çıkış noktalarını analiz eder, tempo (BPM) ve ton (Key) uyumlarını hesaplayarak akıllı remix/mashup süreçleri oluşturur.
22
+
23
+ ## Özellikler
24
+
25
+ - Meta Demucs entegrasyonu ile kusursuz vokal ve enstrüman ayrıştırma
26
+ - Sessizlik aralıkları ve temel frekans (pitch) analizi ile akıllı vokal cümleleme
27
+ - Librosa tabanlı otomatik BPM ve müzikal ton (Key) tespiti
28
+ - Modüler ve kolay genişletilebilir Python Mimarisi
29
+
30
+ ## Kurulum
31
+
32
+ Projeyi yerel ortamınıza kurmak için terminal üzerinden şu komutu çalıştırabilirsiniz:
33
+
34
+ ```bash
35
+ pip install smart-mashup
36
+
37
+ Lisans
38
+ ​Bu proje MIT lisansı ile lisanslanmıştır. Detaylar için LICENSE dosyasına göz atabilirsiniz.
39
+
40
+ Yazar
41
+ ​Muhammed Bedirhan Keskin
@@ -0,0 +1,10 @@
1
+ smart_mashup/__init__.py,sha256=kUR5RAFc7HCeiqdlX36dZOHkUI5wI6V_43RpEcD8b-0,22
2
+ smart_mashup/analyzer.py,sha256=2JXEJG8D0MUimt334ZIiOHtNcT0KyMJ8q1RFwHgc-JY,914
3
+ smart_mashup/mixer.py,sha256=_xQ3dGKxQjpHpFWowCm8J5Zefy56Dn93dCOwDi9vk64,965
4
+ smart_mashup/segmenter.py,sha256=Zun5hKArRI1k4tdkqBpwRAV4qsu3NZdjwg23wuijwHs,1681
5
+ smart_mashup/separator.py,sha256=sCWLCbnSnan8KxD3Jk7g8blkBdwALSx-llt1gA2xo50,1321
6
+ smart_mashup-0.1.0.dist-info/licenses/LICENSE,sha256=zCciybiEraWXHUim20QwESG6YquP7qyeoBTQDTszozI,1114
7
+ smart_mashup-0.1.0.dist-info/METADATA,sha256=xCS3lpU0MCFt-8YI4nIrHA6R-3unmhkWh39rx9M2p_E,1587
8
+ smart_mashup-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
9
+ smart_mashup-0.1.0.dist-info/top_level.txt,sha256=WyraGFZUW_6oenCvs4yoJXjGWQkVczmR2jjflVVlk_Y,13
10
+ smart_mashup-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Muhammed Bedirhan Keskin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TITLE, INCORRECT FITNESS,
20
+ WHETHER/OR ELSE INITIALLY ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1 @@
1
+ smart_mashup