0

I'm working on some energy computation about the sounds perceived by the Nao robot.
I'm using naoqi 2-1-4 and the following snippet of code to show the values:

import time
from naoqi import ALProxy
robotIP = "194.119.214.185"
port = 9559

soundDevice = ALProxy("ALAudioDevice", robotIP, port)
soundDevice.enableEnergyComputation()

try:
    header = 'Left\t\t\t\tRight\t\t\t\tFront\t\t\t\tRear'
    fmt = '{Left:.2f}\t\t\t\t{Right:.2f}\t\t\t\t{Front:.2f}\t\t\t\t{Rear:.2f}'

    while True:
        time.sleep(0.5)
        left  = soundDevice.getLeftMicEnergy()
        right = soundDevice.getRightMicEnergy()
        front = soundDevice.getFrontMicEnergy()
        rear  = soundDevice.getRearMicEnergy()

        print header
        print fmt.format(Left=left,Right=right,
                   Front=front,Rear=rear)

except KeyboardInterrupt:
    print "Stopped by user."

I was not able to understand what is the nature of this values.
I've looked into this code from this page (at the bottom. Yeah I know it's c++ code but I could not find more, I assume that is the same concept, except for the language) and found in a comment that the RMS power is calculated.
I can't understand how are these values possible (tried to express them in dB but they made no sense anyway). Does anyone have any idea of what these values stand for? How can I relate them to some "real" measuring units?

By the way here is a list of all methods.

Thanks in advance

πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190
magicleon94
  • 4,887
  • 2
  • 24
  • 53

2 Answers2

0

Looking at the source, it seems to be just the sum of the square of each sample, then divided by the length of the buffer, finally squared.

sqrt(sum(each_sample*each_sample)/len(samples))

Hope it helps you...

Alexandre Mazel
  • 2,462
  • 20
  • 26
-1

As you don't provide us what are the strange values you've got (numbers?letters?) All I can do to help you is this link about another way to compute those values: NAO robot remote audio problems

Community
  • 1
  • 1
Alexandre Mazel
  • 2,462
  • 20
  • 26
  • Yes, so they are numbers; the bigger, the noiser. – Alexandre Mazel Mar 14 '17 at 19:57
  • I asked if someone knew how to relate them to some real measuring units. If they were pressure values, some sort of power, flying carrots or whatever. It is obvious that they are numbers and the bigger they are, the noiser it is, and these are not what I asked for – magicleon94 Mar 15 '17 at 13:46
  • ok, sorry for my misunderstanding, I've red it in with my programmer mind, looking at the source, it seems to be just the sum of the square of each samples divided by the length of the buffer. That is, to me, an error, as it should be mmore interesting to have: the sum of the square of difference of each sample (or squared). What do you think of that? – Alexandre Mazel Mar 16 '17 at 02:18