kevinwang676 commited on
Commit
7f6a2f3
·
1 Parent(s): ea96abc

Create id3tagging.py

Browse files
Files changed (1) hide show
  1. id3tagging.py +14 -0
id3tagging.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from mutagen.wave import WAVE
2
+ from mutagen.id3._frames import *
3
+
4
+ def add_id3_tag(filename, text, speakername, seed):
5
+ audio = WAVE(filename)
6
+ if speakername == None:
7
+ speakername = "Unconditional"
8
+
9
+ # write id3 tag with text truncated to 60 chars, as a precaution...
10
+ audio["TIT2"] = TIT2(encoding=3, text=text[:60])
11
+ audio["TPE1"] = TPE1(encoding=3, text=f"Voice {speakername} using Seed={seed}")
12
+ audio["TPUB"] = TPUB(encoding=3, text="Bark by Suno AI")
13
+ audio["COMMENT"] = COMM(encoding=3, text="Generated with Bark GUI - Text-Prompted Generative Audio Model. Visit https://github.com/C0untFloyd/bark-gui")
14
+ audio.save()