Python komutu ile volume arttırma

merhaba ben yaptığım sesli asistana volume arttırıp azaltabilmesi için komut arıyorumda yardımcı olurmusunuz. (bilgisayarın volume ü sesli asistanın değil.)

kullandığım kodlar:

from playsound import playsound
from gtts import gTTS
import speech_recognition as sr
import os
import time
from datetime import date, datetime
import random
from random import choice
from pydub import AudioSegment
import webbrowser
import pyttsx3

r = sr.Recognizer()

engine = pyttsx3.init()

voices = engine.getProperty('voices')
engine.setProperty('voices', voices[1].id)
engine.setProperty("rate",170)

def record(ask=False):
    with sr.Microphone() as source:
        if ask:
            print(ask)
        audio = r.listen(source)
        voice = ""
        try:    
            voice = r.recognize_google(audio, language="tr-TR")
        except sr.UnknownValueError:
            print("Jarvis : Anlamadım efendim. Lütfen tekrar edin")
        except sr.RequestError:
            print("Asistan: Sistem çalışmıyor")
        return voice


def response(voice):
        if "hello" in voice:
            engine.say("hello sir how can ı help you ?")
            engine.runAndWait()
            
        if "thank you" in voice:
            engine.say("you are welcome sir.")
            engine.runAndWait()

        if "open the google" in voice:
            engine.say("opening the google")
            engine.runAndWait()
            os.startfile(r'C:\Program Files\Google\Chrome\Application\chrome.exe')

        if "open the paint" in voice:
            engine.say("opening the paint")
            engine.runAndWait()
            os.startfile(r'C:\Program Files\paint.net\PaintDotNet.exe')
            
        if "goodbye" in voice:
            engine.say("goodbye sir")
            engine.runAndWait()
            quit()

        if "what time is it ?" in voice:
            selection = ["the time is : ", ""]
            clock = datetime.now().strftime("%H:%M")
            selection = random.choice(selection)
            speak(selection + clock)


def speak(string):
    tts = gTTS(text=string, lang="tr", slow=False)
    file = "cevap.mp3"
    tts.save(file)
    playsound(file)
    os.remove(file)


def test(wake):
    if "jarvis" or "cervus" or "servis" in wake:
        playsound("jarvis active.mp3")
        wake = record()
        if wake != '':
            voice = wake.lower()
            print(wake.capitalize())
            response(voice)


playsound("Jarvis.mp3")

while True:
    wake = record()
    if wake != '':
        wake = wake.lower()
        print(wake.capitalize())
        test(wake)

alsamixer'in komut satiri arayuzu olan amixer'i kullanabilirsin:

amixer -D pulse sset Master 5%+
amixer -D pulse sset Master 5%-
1 Beğeni

Komut kısmını bilmem ama şu konuyu incelemek isteyebilirsin. Windows 10 kullandığım zamanlar denemiştim bu kodu çalışmıştı.

1 Beğeni