Reputation: 1
My MP4 Karaokê player has an issue when handling pitch adjustment. If I use the VLC player itself, the pitch adjustment runs properly, but, if I do it through Python VLC, it speeds the MP4 Karaokê instead of change it pitch. `
import vlc
keyboard.on_press_key("up", self.pitch_up)
keyboard.on_press_key("down", self.pitch_down)
self.instance = vlc.Instance()
self.pitch_adjustments = {}
self.current_pitch = 0.0
self.original_pitch = 0.0
self.instance = vlc.Instance("--no-xlib", "--fullscreen", "--video-on-top", "--zoom=2")
# Abre as Músicas no VLC em Tela Cheia e Extendida (preenchida)
self.player.set_fullscreen(True) # Abra o VLC em tela cheia
ttk.Button(button_frame, text="Tom +", command=self.pitch_up, width=6),
ttk.Button(button_frame, text="Tom -", command=self.pitch_down, width=6),
self.pitch_label = ctk.CTkLabel(self.root, text="Tom: 0.0", font=("Arial", 14))
self.pitch_label.grid(row=7, column=0, padx=10, pady=10, columnspan=6)
self.original_pitch = 0.0
def adjust_pitch(self, pitch_change):
new_pitch = self.current_pitch + pitch_change
new_rate = current_rate * (2 ** (new_pitch / 12)) # Calculate the new rate based on the pitch change
self.current_pitch = new_pitch
self.update_pitch_label()
def pitch_up(self, event=None):
self.adjust_pitch(0.1)
def pitch_down(self, event=None):
self.adjust_pitch(-0.1)
def update_pitch_label(self):
self.pitch_label.configure(text=f"Tom: {self.current_pitch:.1f}")
# Reinicie o VLC e a GUI para o estado inicial
def restore_original_pitch(self):
self.adjust_pitch(self.original_pitch)
Upvotes: 0
Views: 231