jks-prv / kiwiclient

66 stars 35 forks source link

kiwiclientd.py sound trouble #84

Open hamav8tor opened 3 years ago

hamav8tor commented 3 years ago

Having some trouble getting kiwiclientd.py to play to any sound devices. No sound output at all. Errors shown below. This is on a Mac Mini with the latest master. I can connect/record with kiwirecorder.py and can successfully hear the expected audio in the wav files, so the KiwiSDR connection is fine.

python3 kiwiclientd.py -s kiwisdr -p 8073 -f 8906 -m usb --snddev="Display Audio" --rigctl-port=6400 speaker.player failed with blocksize must be between 15.0 and 512 speaker.player failed with blocksize must be between 15.0 and 512 speaker.player failed with blocksize must be between 15.0 and 512 speaker.player failed with blocksize must be between 15.0 and 512 speaker.player failed with blocksize must be between 15.0 and 512 speaker.player failed with blocksize must be between 15.0 and 512 speaker.player failed with blocksize must be between 15.0 and 512 speaker.player failed with blocksize must be between 15.0 and 512 speaker.player failed with blocksize must be between 15.0 and 512 speaker.player failed with blocksize must be between 15.0 and 512 speaker.player failed with blocksize must be between 15.0 and 512 speaker.player failed with blocksize must be between 15.0 and 512 speaker.player failed with blocksize must be between 15.0 and 512 speaker.player failed with blocksize must be between 15.0 and 512 speaker.player failed with blocksize must be between 15.0 and 512 Block: 00000001, RSSI: -112.62021-06-12 18:00:33,520 pid 2526 'KiwiSoundRecorder' object has no attribute '_player' Block: 00000002, RSSI: -114.02021-06-12 18:00:33,524 pid 2526 'KiwiSoundRecorder' object has no attribute '_player' Block: 00000003, RSSI: -111.92021-06-12 18:00:33,528 pid 2526 'KiwiSoundRecorder' object has no attribute '_player' Block: 00000004, RSSI: -114.72021-06-12 18:00:33,532 pid 2526 'KiwiSoundRecorder' object has no attribute '_player' Block: 00000005, RSSI: -112.72021-06-12 18:00:33,535 pid 2526 'KiwiSoundRecorder' object has no attribute '_player' Block: 00000006, RSSI: -112.82021-06-12 18:00:33,604 pid 2526 'KiwiSoundRecorder' object has no attribute '_player' Block: 00000007, RSSI: -113.12021-06-12 18:00:33,766 pid 2526 'KiwiSoundRecorder' object has no attribute '_player' Block: 00000008, RSSI: -113.42021-06-12 18:00:33,929 pid 2526 'KiwiSoundRecorder' object has no attribute '_player' Block: 00000009, RSSI: -112.42021-06-12 18:00:34,112 pid 2526 'KiwiSoundRecorder' object has no attribute '_player' Block: 0000000a, RSSI: -114.02021-06-12 18:00:34,275 pid 2526 'KiwiSoundRecorder' object has no attribute '_player' Block: 0000000b, RSSI: -113.32021-06-12 18:00:34,457 pid 2526 'KiwiSoundRecorder' object has no attribute '_player' Block: 0000000c, RSSI: -112.82021-06-12 18:00:34,623 pid 2526 'KiwiSoundRecorder' object has no attribute '_player'

jks-prv commented 3 years ago

I did not write kiwiclientd. Let's see if the author @rikvanriel has any suggestions. What versions of OS X?

rikvanriel commented 3 years ago

On line 69 of kiwiclientd.py we have this bit of code:

for i in range(0,10): try: self._player = speaker.player(samplerate=rate, blocksize=4096) self._player.__enter__() break except Exception as ex: print("speaker.player failed with ", ex) time.sleep(0.1) pass

Do things work if you remove the ", blocksize=4096" bit, so that line looks like this:

self._player = speaker.player(samplerate=rate, blocksize=4096)

If everything works without a blocksize parameter, great. If you get audio skips when not specifying a blocksize at all, can you try it with blocksize=512?

Once we know what works on your system, we can adjust the code to get it to just work automatically on OS X again, too.

jks-prv commented 3 years ago

Okay! Removing the blocksize parameter worked for me here. Older MacBook Pro running OS X 10.15.7 (Catalina, also old). I had to remove --snddev="Display Audio" and use the default sound out device since I don't know the proper device names that the soundcard module expects ("Display Audio" didn't work for me).

hamav8tor commented 3 years ago

Thanks for the help! It works with no blocksize parameter and with a blocksize of 512. I am getting audio skips with both. Not sure how serious it is yet because I am listening to static at the moment, primarily. Once I hear some voice traffic I'll have a better idea of how bad it is. It may not be that bad.

rikvanriel commented 3 years ago

I think we may have to make kiwiclientd multithreaded to not get audio dropouts with a smaller buffer.

I can take a stab at that later this week.

On June 13, 2021 3:02:22 PM EDT, hamav8tor @.***> wrote:

Thanks for the help! It works with no blocksize parameter and with a blocksize of 512. I am getting audio skips with both. Not sure how serious it is yet because I am listening to static at the moment, primarily. Once I hear some voice traffic I'll have a better idea of how bad it is. It may not be that bad.

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/jks-prv/kiwiclient/issues/84#issuecomment-860255733

-- Sent from my Android device with K-9 Mail. Please excuse my brevity.

rikvanriel commented 3 years ago

Filed a pull request with a fix for the immediate issue.

https://github.com/jks-prv/kiwiclient/pull/85

hamav8tor commented 3 years ago

I checked further and not 100% sure if I am getting audio dropouts...hearing what I think are some micro-dropouts but could use another pair of ears to check:

Sample sound file - HF radio via KiwiSDR

jks-prv commented 3 years ago

I don't have my good headphones here (I'm on vacation) but it does sound like some drops and thumping going on. In fact it's reminiscent of the Chrome audio bug (pre-v90) that we had a while back.