SebastianSchramm commited on
Commit
3df626d
·
unverified ·
1 Parent(s): bd98776

add convert2mp3 script

Browse files
Files changed (3) hide show
  1. convert_audio2mp3.py +14 -0
  2. poetry.lock +12 -1
  3. pyproject.toml +3 -0
convert_audio2mp3.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from pydub import AudioSegment
3
+
4
+ def convert_wav_to_mp3(wav_path, mp3_path):
5
+ audio = AudioSegment.from_wav(wav_path)
6
+ audio.export(mp3_path, format="mp3")
7
+
8
+
9
+ for file in os.listdir("preloaded_audio"):
10
+ if file.endswith(".wav"):
11
+ wav_file = os.path.join("preloaded_audio", file)
12
+ mp3_file = os.path.join("preloaded_audio", file.replace(".wav", ".mp3"))
13
+ convert_wav_to_mp3(wav_file, mp3_file)
14
+ print(f"Converted {wav_file} to {mp3_file}")
poetry.lock CHANGED
@@ -1852,6 +1852,17 @@ files = [
1852
  [package.dependencies]
1853
  typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0"
1854
 
 
 
 
 
 
 
 
 
 
 
 
1855
  [[package]]
1856
  name = "pygments"
1857
  version = "2.19.2"
@@ -3444,4 +3455,4 @@ files = [
3444
  [metadata]
3445
  lock-version = "2.0"
3446
  python-versions = ">=3.11,<3.12"
3447
- content-hash = "48fefb60cba75a1395f7d6997d3be54570ec2edf95e913d7d2b6b4ffc7da9a6c"
 
1852
  [package.dependencies]
1853
  typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0"
1854
 
1855
+ [[package]]
1856
+ name = "pydub"
1857
+ version = "0.25.1"
1858
+ description = "Manipulate audio with an simple and easy high level interface"
1859
+ optional = false
1860
+ python-versions = "*"
1861
+ files = [
1862
+ {file = "pydub-0.25.1-py2.py3-none-any.whl", hash = "sha256:65617e33033874b59d87db603aa1ed450633288aefead953b30bded59cb599a6"},
1863
+ {file = "pydub-0.25.1.tar.gz", hash = "sha256:980a33ce9949cab2a569606b65674d748ecbca4f0796887fd6f46173a7b0d30f"},
1864
+ ]
1865
+
1866
  [[package]]
1867
  name = "pygments"
1868
  version = "2.19.2"
 
3455
  [metadata]
3456
  lock-version = "2.0"
3457
  python-versions = ">=3.11,<3.12"
3458
+ content-hash = "8a06ede1052ba182deb2fe7e87466bb56ba6824ae56d6d0088c82a3d559ae5cb"
pyproject.toml CHANGED
@@ -13,6 +13,9 @@ kokoro = "^0.9.4"
13
  soundfile = "^0.13.1"
14
 
15
 
 
 
 
16
  [build-system]
17
  requires = ["poetry-core"]
18
  build-backend = "poetry.core.masonry.api"
 
13
  soundfile = "^0.13.1"
14
 
15
 
16
+ [tool.poetry.group.dev.dependencies]
17
+ pydub = "^0.25.1"
18
+
19
  [build-system]
20
  requires = ["poetry-core"]
21
  build-backend = "poetry.core.masonry.api"