Robert904 / mumblerecbot

Mumble audio recorder, based on pymumble module
GNU General Public License v3.0
23 stars 10 forks source link

basic player doesn't work with custom wav files #5

Closed saerdnaer closed 9 years ago

saerdnaer commented 9 years ago

When I try to use the basicplayer.py with a own wave file, I always get the following exception:

Exception in thread Thread-1:
Traceback (most recent call last):
 File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
   self.run()
 File "/home/andi/mumble-audio-bots/pymumble/mumble.py", line 108, in run
   self.loop()
 File "/home/andi/mumble-audio-bots/pymumble/mumble.py", line 170, in loop
   self.sound_output.send_audio()  # send outgoing audio if available
 File "/home/andi/mumble-audio-bots/pymumble/soundoutput.py", line 86, in send_audio
   frameheader = struct.pack('!B', frameheader)
error: ubyte format requires 0 <= number <= 255

The audio file itself should be okay:

ffprobe OSMDE.wav
avprobe version 0.8.16-6:0.8.16-1, Copyright (c) 2007-2014 the Libav developers
 built on Sep 16 2014 23:10:48 with gcc 4.7.2
[wav @ 0x14deb20] max_analyze_duration reached
Input #0, wav, from 'OSMDE.wav':
 Duration: 00:03:01.26, bitrate: 768 kb/s
   Stream #0.0: Audio: pcm_s16le, 48000 Hz, 1 channels, s16, 768 kb/s

The corresponding code producing the exception (I added some print statements)

               # create the audio frame header
        [...]
                   frameheader = len(encoded)
                   print frameheader
                   if audio_encoded < self.audio_per_packet and len(self.pcm) > 0:  # if not last frame for the packet, set the terminator bit
                       frameheader += ( 1 << 7 )
                   print frameheader
                   frameheader = struct.pack('!B', frameheader)
                   print frameheader

               payload += frameheader + encoded  # add the frame to the packet

Output is

960
1088
Exception […]
error: ubyte format requires 0 <= number <= 255

Can you explain to me why its 1088 when it should be below 255? What do I need to do to fix this?

Robert904 commented 9 years ago

It seems you are still using CELT as codec. What version of mumble server and clients are you using ? I'm afraid the code was more extensively tested for OPUS codec (used when server and all clients >= 1.2.4), but I can try to find out what happen...

saerdnaer commented 9 years ago

Thanks for that hint. I switched to newer server version and set opusthreshold=0. Now it works.