JvanKatwijk / dab-cmdline

DAB decoding library with example of its use
GNU General Public License v2.0
57 stars 29 forks source link

Audio-device for cmdline.py #82

Open gvanem opened 2 years ago

gvanem commented 2 years ago

I think I've built DAB-cmdline OK with Python support. But running it, it fails to find a audio-device. What should be the default on Windows? It would be nice if a py -3 cmdline.py -h should list the valid ones.

Now, this is what I get on running py -3 python-example\cmdline.py -c 12D -a portaudio (I've slightly added some more traces to code):

going for rtlsdr 229072000, gain: 50, autogain: 0
OK, functions seem to be loaded
Found Rafael Micro R820T tuner
[R82XX] PLL not locked!
samplerate set to 2048000
Supported gain values (29): 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4
 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6
effective gain: gain 49.6
device installed
device restarted
possible DAB signal detected
 fib  0
ensemblename Riks            . id 61953
name of ensemble is  Riks               61953
programname NRJ NORGE        (61970)
program  NRJ NORGE          61970  is part of the ensemble
programname P0DPLAY          (62490)
program  P0DPLAY            62490  is part of the ensemble
programname RADIO NORGE      (61978)
program  RADIO NORGE        61978  is part of the ensemble
programname TOPP40           (61722)
program  TOPP40             61722  is part of the ensemble
programname EPG (data) (-487415295)
program  EPG (data)   -487415295  is part of the ensemble
programname EPG (data) (-487415295)
program  EPG (data)   -487415295  is part of the ensemble
programname RADIO ROCK       (61503)
program  RADIO ROCK         61503  is part of the ensemble
programname P9 Retro         (61977)
program  P9 Retro           61977  is part of the ensemble
programname KISS N'DANCE     (65377)
program  KISS N'DANCE       65377  is part of the ensemble
programname P24-7 KOS (65306)
program  P24-7 KOS   65306  is part of the ensemble
programname P24-7 MIX (61793)
program  P24-7 MIX   61793  is part of the ensemble
 fib  77
programname BIG HIPHOP & RNB (62234)
program  BIG HIPHOP & RNB   62234  is part of the ensemble
programname V-Traffic        (data) (-487415551)
program  V-Traffic        (data)   -487415551  is part of the ensemble
programname P4 LydenAvNorge  (61972)
program  P4 LydenAvNorge    61972  is part of the ensemble
programname P5 Hits          (61973)
program  P5 Hits            61973  is part of the ensemble
programname EPG P4           (data) (-487451647)
program  EPG P4           (data)   -487451647  is part of the ensemble
programname P6 Rock          (61974)
program  P6 Rock            61974  is part of the ensemble
programname P7 Klem          (61975)
program  P7 Klem            61975  is part of the ensemble
programname V-Traffic        (data) (-487415551)
program  V-Traffic        (data)   -487415551  is part of the ensemble
programname P10 Country      (61971)
program  P10 Country        61971  is part of the ensemble
programname VINYL            (61466)
program  VINYL              61466  is part of the ensemble
programname P8 Pop 80s & 90s (61976)
program  P8 Pop 80s & 90s   61976  is part of the ensemble
 fib  89
programname NORSK POP        (62271)
program  NORSK POP          62271  is part of the ensemble
 fib  98
538: should be started
unable to select program: '538'Traceback (most recent call last):
  File "F:\gv\dx-radio\DAB\DAB-cmdline\python-example\cmdline.py", line 245, in <module>
    callback=sound_callback):
  File "F:\ProgramFiler\Python36\lib\site-packages\sounddevice.py", line 1489, in __init__
    **_remove_self(locals()))
  File "F:\ProgramFiler\Python36\lib\site-packages\sounddevice.py", line 812, in __init__
    extra_settings, samplerate)
  File "F:\ProgramFiler\Python36\lib\site-packages\sounddevice.py", line 2650, in _get_stream_parameters
    device = _get_device_id(device, kind, raise_on_error=True)
  File "F:\ProgramFiler\Python36\lib\site-packages\sounddevice.py", line 2791, in _get_device_id
    'No ' + kind + ' device matching ' + repr(id_or_query_string))
ValueError: No output device matching 'portaudio'

And running sounddevice.py, hints that device 5 is suitable:

   0 Microsoft Sound Mapper - Input, MME (2 in, 0 out)
>  1 Stereo miks (Realtek High Defin, MME (2 in, 0 out)
   2 Line 1 (Virtual Audio Cable), MME (2 in, 0 out)
   3 Virtual Cable (VB-Audio Virtual, MME (2 in, 0 out)
   4 Microsoft Sound Mapper - Output, MME (0 in, 2 out)
<  5 Høyttalere (Realtek High Defini, MME (0 in, 2 out)
 ..

But using -a 5 in cmdline.py gives another error:

sounddevice.PortAudioError: Error opening OutputStream: Invalid number of channels [PaErrorCode -9998]
JvanKatwijk commented 2 years ago

I am not very familar with Windows, but it seems to me that entry 4 is the one (I am no fan of Python either)

best jan'

Op di 4 jan. 2022 om 11:59 schreef Gisle Vanem @.***>:

I think I've built DAB-cmdline OK with Python support. But running it, it fails to find a audio-device. What should be the default on Windows? It would be nice if a py -3 cmdline.py -h should list the valid ones.

Now, this is what I get on running py -3 python-example\cmdline.py -c 12D -a portaudio (I've slightly added some more traces to code):

going for rtlsdr 229072000, gain: 50, autogain: 0

OK, functions seem to be loaded

Found Rafael Micro R820T tuner

[R82XX] PLL not locked!

samplerate set to 2048000

Supported gain values (29): 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4

37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6

effective gain: gain 49.6

device installed

device restarted

possible DAB signal detected

fib 0

ensemblename Riks . id 61953

name of ensemble is Riks 61953

programname NRJ NORGE (61970)

program NRJ NORGE 61970 is part of the ensemble

programname P0DPLAY (62490)

program P0DPLAY 62490 is part of the ensemble

programname RADIO NORGE (61978)

program RADIO NORGE 61978 is part of the ensemble

programname TOPP40 (61722)

program TOPP40 61722 is part of the ensemble

programname EPG (data) (-487415295)

program EPG (data) -487415295 is part of the ensemble

programname EPG (data) (-487415295)

program EPG (data) -487415295 is part of the ensemble

programname RADIO ROCK (61503)

program RADIO ROCK 61503 is part of the ensemble

programname P9 Retro (61977)

program P9 Retro 61977 is part of the ensemble

programname KISS N'DANCE (65377)

program KISS N'DANCE 65377 is part of the ensemble

programname P24-7 KOS (65306)

program P24-7 KOS 65306 is part of the ensemble

programname P24-7 MIX (61793)

program P24-7 MIX 61793 is part of the ensemble

fib 77

programname BIG HIPHOP & RNB (62234)

program BIG HIPHOP & RNB 62234 is part of the ensemble

programname V-Traffic (data) (-487415551)

program V-Traffic (data) -487415551 is part of the ensemble

programname P4 LydenAvNorge (61972)

program P4 LydenAvNorge 61972 is part of the ensemble

programname P5 Hits (61973)

program P5 Hits 61973 is part of the ensemble

programname EPG P4 (data) (-487451647)

program EPG P4 (data) -487451647 is part of the ensemble

programname P6 Rock (61974)

program P6 Rock 61974 is part of the ensemble

programname P7 Klem (61975)

program P7 Klem 61975 is part of the ensemble

programname V-Traffic (data) (-487415551)

program V-Traffic (data) -487415551 is part of the ensemble

programname P10 Country (61971)

program P10 Country 61971 is part of the ensemble

programname VINYL (61466)

program VINYL 61466 is part of the ensemble

programname P8 Pop 80s & 90s (61976)

program P8 Pop 80s & 90s 61976 is part of the ensemble

fib 89

programname NORSK POP (62271)

program NORSK POP 62271 is part of the ensemble

fib 98

538: should be started

unable to select program: '538'Traceback (most recent call last):

File "F:\gv\dx-radio\DAB\DAB-cmdline\python-example\cmdline.py", line 245, in

callback=sound_callback):

File "F:\ProgramFiler\Python36\lib\site-packages\sounddevice.py", line 1489, in init

**_remove_self(locals()))

File "F:\ProgramFiler\Python36\lib\site-packages\sounddevice.py", line 812, in init

extra_settings, samplerate)

File "F:\ProgramFiler\Python36\lib\site-packages\sounddevice.py", line 2650, in _get_stream_parameters

device = _get_device_id(device, kind, raise_on_error=True)

File "F:\ProgramFiler\Python36\lib\site-packages\sounddevice.py", line 2791, in _get_device_id

'No ' + kind + ' device matching ' + repr(id_or_query_string))

ValueError: No output device matching 'portaudio'

And running sounddevice.py, hints that device 5 is suitable:

0 Microsoft Sound Mapper - Input, MME (2 in, 0 out)

1 Stereo miks (Realtek High Defin, MME (2 in, 0 out)

2 Line 1 (Virtual Audio Cable), MME (2 in, 0 out)

3 Virtual Cable (VB-Audio Virtual, MME (2 in, 0 out)

4 Microsoft Sound Mapper - Output, MME (0 in, 2 out)

< 5 Høyttalere (Realtek High Defini, MME (0 in, 2 out)

..

But using -a 5 in cmdline.py gives another error:

sounddevice.PortAudioError: Error opening OutputStream: Invalid number of channels [PaErrorCode -9998]

— Reply to this email directly, view it on GitHub https://github.com/JvanKatwijk/dab-cmdline/issues/82, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCPHQB23E4DA23J3BQUM73UULHKNANCNFSM5LHFKY5Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Jan van Katwijk

gvanem commented 2 years ago

but it seems to me that entry 4 is the one

No, with py -3 python-example\cmdline.py -c 12D -a 4, I just get another PortAudio error-code:

...
programname P8 Pop 80s & 90s (61976)
program  P8 Pop 80s & 90s   61976  is part of the ensemble
 fib  99
538: should be started
unable to select program: '538'
Traceback (most recent call last):
  File "F:\gv\dx-radio\DAB\DAB-cmdline\python-example\cmdline.py", line 251, in <module>
    callback=sound_callback):
  File "F:\ProgramFiler\Python36\lib\site-packages\sounddevice.py", line 1489, in __init__
    **_remove_self(locals()))
  File "F:\ProgramFiler\Python36\lib\site-packages\sounddevice.py", line 895, in __init__
    'Error opening {}'.format(self.__class__.__name__))
  File "F:\ProgramFiler\Python36\lib\site-packages\sounddevice.py", line 2738, in _check
    raise PortAudioError(errormsg, err)
sounddevice.PortAudioError: Error opening OutputStream: Invalid device [PaErrorCode -9996]

[PaErrorCode -9996] == paInvalidDevice. This is not a very useful program with these codes like this. Care to call Pa_GetErrorText() somehow?

And it seems to be the error-text unable to select program: '538' is the cause of the Python error. A problem with flushing stdout / stderr?