1

I wrote a script that should let the Nao walk or play a wav file when pressing a button. But the sound file never gets played and I think I am not using a correct path.

def sing(note):
    try:
        path = findNotePath(note)
        soundProxy = naoqi.ALProxy("ALAudioPlayer", host, port)
        fileid = soundProxy.loadFile(path)
        soundProxy.post.playFile(fileid)
    except Exception as e:
        print(e)
        print("Ton nicht abspielbar")
    print(path)

def findNotePath(note):
    path = "/home/nao/FullOctave/" + note + ".wav"
    return path

This is my output:

[W] 1685708250.183120 30208 qi.path.sdklayout: No Application was created, trying to deduce paths
[I] 1685708250.189637 30208 qimessaging.session: Session listener created on tcp://0.0.0.0:0
[I] 1685708250.794682 30208 qimessaging.transportserver: TransportServer will listen on: tcp://192.168.178.31:53942
[I] 1685708250.794682 30208 qimessaging.transportserver: TransportServer will listen on: tcp://192.168.147.1:53942
[I] 1685708250.794682 30208 qimessaging.transportserver: TransportServer will listen on: tcp://192.168.30.1:53942
[I] 1685708250.794682 30208 qimessaging.transportserver: TransportServer will listen on: tcp://127.0.0.1:53942
Jacky Re
  • 11
  • 2
  • Hello! Did you get any error? Would you share it, please? Did you really upload it to `/foldername/file.wav`? I find that curious. – Victor Paléologue Jun 01 '23 at 15:27
  • It's actually, for example, "FullOctave/A.wav". Maybe I said this a bit confusingly. Sorry. I also suspect, that it might be a different problem and not a path problem. – Jacky Re Jun 02 '23 at 12:20

1 Answers1

0

I found the problem. It worked, when I changed the playFile(fileid) to just play(fileid).

Tyler2P
  • 2,324
  • 26
  • 22
  • 31
Jacky Re
  • 11
  • 2