2

I have designed a method when product not found in using barcode scanning I put this code in that product not found.

@api.multi
def _product_sound(self)

   PyAudio = pyaudio.PyAudio
   bitrate = 8000
   frq = 500
   LENGTH = 2

   if frq > bitrate:
     bitrate = frq+100

   numberofframe = int(bitrate * LENGTH)
   restframe = numberofframe % bitrate
   wave = ''

   for x in range(numberofframe):
      wave = wave+chr(int(math.sin(x/((bitrate/frq)/math.pi))*124+128))

   for x in range(restframe):
     wave = wave+chr(128)

    p = PyAudio()
    stream = p.open(format = p.get_format_from_width(1),  channels = 1,rate = bitrate,output = True)


    stream.write(wave)
    stream.stop_stream()
    stream.close()
    p.terminate()

When I try this code in single system its work perfectly. but when I try to using in the different device that time sound not be generated.

So how to play sound in odoo with different system or current system ?

Harshit Trivedi
  • 764
  • 9
  • 33
  • This is some advanced thing in odoo. Anyway I dono the answer, but I am eager to know about this. – Navi May 22 '18 at 09:29
  • that's weird beause it seems that you want to execute python code at client side, that's what you want ? – snoob dogg May 24 '18 at 13:19

0 Answers0