0
import os
import sys
import time
from naoqi import ALProxy
from naoqi import ALBroker
from naoqi import ALModule
import speech_recognition as sr

record = ALProxy("ALAudioRecorder", "192.168.8.104", 9559)
record.stopMicrophonesRecording()
print('Start recording...')
# tts.say("start recording...")

record.startMicrophonesRecording('/home/nao/recordings/cameras/maha1', 'wav', 16000, (0,0, 1, 0))
time.sleep(5)
record.stopMicrophonesRecording()

audio_player_service = ALProxy("ALSpeechRecognition", "192.168.8.104", 9559)

recognizer = sr.Recognizer()
audio_file_ = sr.AudioFile('/home/nao/recordings/cameras/maha1.wav') #problem is here
print(type(audio_file_))

with audio_file_ as source:
  audio_file = recognizer.record(source, duration = 8.0)
  result = recognizer.recognize_google(audio_data=audio_file, language="ar")

print(result)

this is my code I have to retrieve the audio recording from pepper cloud but it's seems it can't see this path because it's running on my laptop, so how can I retrieve the audio file from pepper cloud

  • 1
    Hi it is not clear what you want to do. You are recording audio to a wav file on the robot. This file is not stored in the cloud but on the roboters storage in the given folder i guess. Or what do you mean by "pepper cloud" ? Do you want to access the recorded audio file on the robot at /home/nao/recordings/cameras/maha1? – TVK Apr 19 '21 at 13:59
  • this might help you: https://stackoverflow.com/questions/54328264/error-when-recording-sound-on-pepper-robot – TVK Apr 20 '21 at 08:16

1 Answers1

0

You may have a look at the Pepper Controller Python library which contains the speech recognition implementation (see robot.py: listen()).

Ales Horak
  • 114
  • 6