how am i supposed to take a user input of a path and use that path in my program

111 views Asked by At

my code:

enter def  play():
import pyo
s = pyo.Server()
s.boot()
s.start()
s.setInputDevice(4)
s.setOutputDevice(4)
p = input("path: ")
play_audio1 = pyo.SfPlayer(path=p, speed=[1.25, 1.25])
play_audio1.out()
s.gui(locals(), exit=False)
play()

code here so the problem im facing is, i want to take path as a user input and play the audio file. help me out. for now i have only tried taking it was a user input and storing it in a var and use it but it dosent work.

1

There are 1 answers

2
anil kumar On

Your code works fine for me. I have provided input from user as follows and i was able to get gui for audio.

path: C:/Users/anil/Downloads/M1F1-AlawC-AFsp.aif

If you are still facing issues. Kindly check below things.

p = p.replace('"','').replace("'","")

Note: Kindly try with '.aif' file. It should possibly work for you