Re: Audio source - device or resource busy error - PROBLEM SOLVED

2024-04-26 Thread Elmore Family

Marcus,

I have discovered a solution to this issue but I don't understand why.

The 'main()' of FT8_Receive contains lines related to sig_handler which were 
included in the original file created by GNU Radio as shown below:


def main(top_block_cls=FT8_Receive, options=None):
   tb = top_block_cls()

   now = float(datetime.now().strftime('%S.%f'))
   print ("RX main = ", now)
   def sig_handler(sig=None, frame=None):
   tb.stop()
   tb.wait()
   sys.exit(0)

   signal.signal(signal.SIGINT, sig_handler)
   signal.signal(signal.SIGTERM, sig_handler)

   check_time(cycle)
   print("\nReceiving...")
   #Receiving = time.time()
   #now = float(datetime.now().strftime('%S.%f'))
   #print ("After Receiving = ", now)
   tb.start()
   #start = time.time()
   #print ("start = ",start)
   tb.wait()

In desperation I removed those lines to see what the effect would be. I am 
no longer getting the resource busy error and the code is running as I 
intended.


Why are those lines included and why did their removal fix the problem?

Jim

-Original Message- 
From: Elmore Family

Sent: Monday, April 15, 2024 11:01 AM
To: GNURadio Discussion List ; Marcus Müller
Subject: Re: Audio source - device or resource busy error



Marcus,

The following is the config.conf file as modified per your request:

[audio_alsa]
audio_module = portaudio
default_input_device = portaudio
default_output_device = pulse
nperiods = 32
period_time = 0.010
verbose = false

Did I do this correctly?

I wasn't sure what to use for the Device Name so I tried portaudio - didn't
recognize it. Used default - it ran but produced exactly the same error as
pulse after 6 iterations.

Note for reference:
Prior to calling the FT8_Receive.main() as I do now I was using either
os.system or subprocess calls to call FT8_Receive. These did not result in
any audio errors but the time to start of execution (1.2 secs) is excessive
rendering the application unusable due to critical timing constraints.

Jim

-Original Message- 
From: Marcus Müller

Sent: Monday, April 15, 2024 4:55 AM
To: Elmore Family ; GNURadio Discussion List
Subject: Re: Audio source - device or resource busy error

Hi Jim,
so, that's an interesting problem with your sound system. I don't see why it
*should* fail
at six created sources (my suspicion is that the non-deterministic
destruction of objects
that is inherent to Python means there's six parallel endpoints active, from
a perspective
of ALSA and pulseaudio).
Sadly, we don't have a test that covers this (yet?).
Maybe this is a problem specific to the way the ALSA source works.

Would be able to test the portaudio sink? For that, we'll have to force GNU
Radio to use
it (because it uses ALSA by default). You can do that by adding

[audio]
audio_module = portaudio

to your GNU Radio configuration, so to a file ending in .conf (e.g.,
audio.conf) in the
directory that `gnuradio-config-info --userprefsdir` shows.

Best regards,
Marcus


On 15.04.24 02:18, Elmore Family wrote:

Marcus,

I first tried:
For ALSA users with audio trouble, follow this procedure ( which I 
followed):


The result was the same.

Then I selected pulse as the device name. it worked for 6 iterations of 
the loop and then gave the following error:


mmap() failed: Cannot allocate memory
mmap() failed: Cannot allocate memory
gr::log :ERROR: audio_alsa_source6 - [pulse]: Input/output error
Traceback (most recent call last):
  File "/home/pi/gr-ft8_rxtx/python/ft8_rxtx.py", line 337, in 
main()
  File "/home/pi/gr-ft8_rxtx/python/ft8_rxtx.py", line 320, in main
FT8_Receive.main()
  File "/home/pi/gr-ft8_rxtx/python/FT8_Receive.py", line 205, in main
tb = top_block_cls()
  File "/home/pi/gr-ft8_rxtx/python/FT8_Receive.py", line 85, in __init__
self.audio_source_0 = audio.source(samp_rate, 'pulse', True)
RuntimeError: audio_alsa_source

Jim

-Original Message- From: Marcus Müller
Sent: Sunday, April 14, 2024 3:45 PM
To: discuss-gnuradio@gnu.org
Subject: Re: Audio source - device or resource busy error

Hi Jim,

try not using the direct hardware device, but the device provided by your 
sound system;
see the "for users wiht audio trouble" section on the Audio Source 
documentation page.


Best regards,
Marcus

On 14.04.24 18:02, Elmore Family wrote:
I am getting the subject error when running a Python script called 
repeatedly from another script.
The snippet_ft8_rxtx.py shows the call, FT8_Receive.main(), in the while 
loop.

FT8_Receive.py shows the called script.
FT8_Receive.pdf is the flowgraph used to generate the called script which 
as you can see has been modified in main() and with check_time added.
The first call to the script is OK but the second call results in the 
error shown in audio_error.txt.
Why is the audio source busy when the flowgraph is stopped (or is it not 
stopped?) and how do I fix the issue?

Jim

<http://ww

Re: Audio source - device or resource busy error

2024-04-15 Thread Elmore Family

Marcus,

The following is the config.conf file as modified per your request:

[audio_alsa]
audio_module = portaudio
default_input_device = portaudio
default_output_device = pulse
nperiods = 32
period_time = 0.010
verbose = false

Did I do this correctly?

I wasn't sure what to use for the Device Name so I tried portaudio - didn't 
recognize it. Used default - it ran but produced exactly the same error as 
pulse after 6 iterations.


Note for reference:
Prior to calling the FT8_Receive.main() as I do now I was using either 
os.system or subprocess calls to call FT8_Receive. These did not result in 
any audio errors but the time to start of execution (1.2 secs) is excessive 
rendering the application unusable due to critical timing constraints.


Jim

-Original Message- 
From: Marcus Müller

Sent: Monday, April 15, 2024 4:55 AM
To: Elmore Family ; GNURadio Discussion List
Subject: Re: Audio source - device or resource busy error

Hi Jim,
so, that's an interesting problem with your sound system. I don't see why it 
*should* fail
at six created sources (my suspicion is that the non-deterministic 
destruction of objects
that is inherent to Python means there's six parallel endpoints active, from 
a perspective

of ALSA and pulseaudio).
Sadly, we don't have a test that covers this (yet?).
Maybe this is a problem specific to the way the ALSA source works.

Would be able to test the portaudio sink? For that, we'll have to force GNU 
Radio to use

it (because it uses ALSA by default). You can do that by adding

[audio]
audio_module = portaudio

to your GNU Radio configuration, so to a file ending in .conf (e.g., 
audio.conf) in the

directory that `gnuradio-config-info --userprefsdir` shows.

Best regards,
Marcus


On 15.04.24 02:18, Elmore Family wrote:

Marcus,

I first tried:
For ALSA users with audio trouble, follow this procedure ( which I 
followed):


The result was the same.

Then I selected pulse as the device name. it worked for 6 iterations of 
the loop and then gave the following error:


mmap() failed: Cannot allocate memory
mmap() failed: Cannot allocate memory
gr::log :ERROR: audio_alsa_source6 - [pulse]: Input/output error
Traceback (most recent call last):
  File "/home/pi/gr-ft8_rxtx/python/ft8_rxtx.py", line 337, in 
main()
  File "/home/pi/gr-ft8_rxtx/python/ft8_rxtx.py", line 320, in main
FT8_Receive.main()
  File "/home/pi/gr-ft8_rxtx/python/FT8_Receive.py", line 205, in main
tb = top_block_cls()
  File "/home/pi/gr-ft8_rxtx/python/FT8_Receive.py", line 85, in __init__
self.audio_source_0 = audio.source(samp_rate, 'pulse', True)
RuntimeError: audio_alsa_source

Jim

-Original Message- From: Marcus Müller
Sent: Sunday, April 14, 2024 3:45 PM
To: discuss-gnuradio@gnu.org
Subject: Re: Audio source - device or resource busy error

Hi Jim,

try not using the direct hardware device, but the device provided by your 
sound system;
see the "for users wiht audio trouble" section on the Audio Source 
documentation page.


Best regards,
Marcus

On 14.04.24 18:02, Elmore Family wrote:
I am getting the subject error when running a Python script called 
repeatedly from another script.
The snippet_ft8_rxtx.py shows the call, FT8_Receive.main(), in the while 
loop.

FT8_Receive.py shows the called script.
FT8_Receive.pdf is the flowgraph used to generate the called script which 
as you can see has been modified in main() and with check_time added.
The first call to the script is OK but the second call results in the 
error shown in audio_error.txt.
Why is the audio source busy when the flowgraph is stopped (or is it not 
stopped?) and how do I fix the issue?

Jim

<http://www.avg.com/email-signature?utm_medium=email_source=link_campaign=sig-email_content=emailclient> 
Virus-free.www.avg.com 
<http://www.avg.com/email-signature?utm_medium=email_source=link_campaign=sig-email_content=emailclient>


<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>





--
This email has been checked for viruses by AVG antivirus software.
www.avg.com 





Re: Audio source - device or resource busy error

2024-04-15 Thread Marcus Müller

Hi Jim,
so, that's an interesting problem with your sound system. I don't see why it *should* fail 
at six created sources (my suspicion is that the non-deterministic destruction of objects 
that is inherent to Python means there's six parallel endpoints active, from a perspective 
of ALSA and pulseaudio).

Sadly, we don't have a test that covers this (yet?).
Maybe this is a problem specific to the way the ALSA source works.

Would be able to test the portaudio sink? For that, we'll have to force GNU Radio to use 
it (because it uses ALSA by default). You can do that by adding


[audio]
audio_module = portaudio

to your GNU Radio configuration, so to a file ending in .conf (e.g., audio.conf) in the 
directory that `gnuradio-config-info --userprefsdir` shows.


Best regards,
Marcus


On 15.04.24 02:18, Elmore Family wrote:

Marcus,

I first tried:
For ALSA users with audio trouble, follow this procedure ( which I followed):

The result was the same.

Then I selected pulse as the device name. it worked for 6 iterations of the loop and then 
gave the following error:


mmap() failed: Cannot allocate memory
mmap() failed: Cannot allocate memory
gr::log :ERROR: audio_alsa_source6 - [pulse]: Input/output error
Traceback (most recent call last):
  File "/home/pi/gr-ft8_rxtx/python/ft8_rxtx.py", line 337, in 
    main()
  File "/home/pi/gr-ft8_rxtx/python/ft8_rxtx.py", line 320, in main
    FT8_Receive.main()
  File "/home/pi/gr-ft8_rxtx/python/FT8_Receive.py", line 205, in main
    tb = top_block_cls()
  File "/home/pi/gr-ft8_rxtx/python/FT8_Receive.py", line 85, in __init__
    self.audio_source_0 = audio.source(samp_rate, 'pulse', True)
RuntimeError: audio_alsa_source

Jim

-Original Message- From: Marcus Müller
Sent: Sunday, April 14, 2024 3:45 PM
To: discuss-gnuradio@gnu.org
Subject: Re: Audio source - device or resource busy error

Hi Jim,

try not using the direct hardware device, but the device provided by your sound 
system;
see the "for users wiht audio trouble" section on the Audio Source 
documentation page.

Best regards,
Marcus

On 14.04.24 18:02, Elmore Family wrote:
I am getting the subject error when running a Python script called repeatedly from 
another script.

The snippet_ft8_rxtx.py shows the call, FT8_Receive.main(), in the while loop.
FT8_Receive.py shows the called script.
FT8_Receive.pdf is the flowgraph used to generate the called script which as you can see 
has been modified in main() and with check_time added.
The first call to the script is OK but the second call results in the error shown in 
audio_error.txt.
Why is the audio source busy when the flowgraph is stopped (or is it not stopped?) and 
how do I fix the issue?

Jim

<http://www.avg.com/email-signature?utm_medium=email_source=link_campaign=sig-email_content=emailclient>
 Virus-free.www.avg.com 
<http://www.avg.com/email-signature?utm_medium=email_source=link_campaign=sig-email_content=emailclient>

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>







Re: Audio source - device or resource busy error

2024-04-14 Thread Elmore Family

Marcus,

I first tried:
For ALSA users with audio trouble, follow this procedure ( which I 
followed):


The result was the same.

Then I selected pulse as the device name. it worked for 6 iterations of the 
loop and then gave the following error:


mmap() failed: Cannot allocate memory
mmap() failed: Cannot allocate memory
gr::log :ERROR: audio_alsa_source6 - [pulse]: Input/output error
Traceback (most recent call last):
 File "/home/pi/gr-ft8_rxtx/python/ft8_rxtx.py", line 337, in 
   main()
 File "/home/pi/gr-ft8_rxtx/python/ft8_rxtx.py", line 320, in main
   FT8_Receive.main()
 File "/home/pi/gr-ft8_rxtx/python/FT8_Receive.py", line 205, in main
   tb = top_block_cls()
 File "/home/pi/gr-ft8_rxtx/python/FT8_Receive.py", line 85, in __init__
   self.audio_source_0 = audio.source(samp_rate, 'pulse', True)
RuntimeError: audio_alsa_source

Jim

-Original Message- 
From: Marcus Müller

Sent: Sunday, April 14, 2024 3:45 PM
To: discuss-gnuradio@gnu.org
Subject: Re: Audio source - device or resource busy error

Hi Jim,

try not using the direct hardware device, but the device provided by your 
sound system;
see the "for users wiht audio trouble" section on the Audio Source 
documentation page.


Best regards,
Marcus

On 14.04.24 18:02, Elmore Family wrote:
I am getting the subject error when running a Python script called 
repeatedly from another script.
The snippet_ft8_rxtx.py shows the call, FT8_Receive.main(), in the while 
loop.

FT8_Receive.py shows the called script.
FT8_Receive.pdf is the flowgraph used to generate the called script which 
as you can see has been modified in main() and with check_time added.
The first call to the script is OK but the second call results in the 
error shown in audio_error.txt.
Why is the audio source busy when the flowgraph is stopped (or is it not 
stopped?) and how do I fix the issue?

Jim

<http://www.avg.com/email-signature?utm_medium=email_source=link_campaign=sig-email_content=emailclient> 
Virus-free.www.avg.com 
<http://www.avg.com/email-signature?utm_medium=email_source=link_campaign=sig-email_content=emailclient>


<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>



--
This email has been checked for viruses by AVG antivirus software.
www.avg.com 





Re: Audio source - device or resource busy error

2024-04-14 Thread Marcus Müller

Hi Jim,

try not using the direct hardware device, but the device provided by your sound system; 
see the "for users wiht audio trouble" section on the Audio Source documentation page.


Best regards,
Marcus

On 14.04.24 18:02, Elmore Family wrote:
I am getting the subject error when running a Python script called repeatedly from another 
script.

The snippet_ft8_rxtx.py shows the call, FT8_Receive.main(), in the while loop.
FT8_Receive.py shows the called script.
FT8_Receive.pdf is the flowgraph used to generate the called script which as you can see 
has been modified in main() and with check_time added.
The first call to the script is OK but the second call results in the error shown in 
audio_error.txt.
Why is the audio source busy when the flowgraph is stopped (or is it not stopped?) and how 
do I fix the issue?

Jim


  Virus-free.www.avg.com 


<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>




Audio source - device or resource busy error

2024-04-14 Thread Elmore Family
I am getting the subject error when running a Python script called repeatedly 
from another script.

The snippet_ft8_rxtx.py shows the call, FT8_Receive.main(), in the while loop.
FT8_Receive.py shows the called script.
FT8_Receive.pdf is the flowgraph used to generate the called script which as 
you can see has been modified in main() and with check_time added.

The first call to the script is OK but the second call results in the error 
shown in audio_error.txt.

Why is the audio source busy when the flowgraph is stopped (or is it not 
stopped?) and how do I fix the issue?

Jim

--
This email has been checked for viruses by AVG antivirus software.
www.avg.com

FT8_Receive.pdf
Description: Adobe PDF document
gr::log :ERROR: audio_alsa_source1 - [hw:1,0]: Device or resource busy
Traceback (most recent call last):
  File "/home/pi/gr-ft8_rxtx/python/ft8_rxtx.py", line 336, in 
main()
  File "/home/pi/gr-ft8_rxtx/python/ft8_rxtx.py", line 319, in main
FT8_Receive.main()
  File "/home/pi/gr-ft8_rxtx/python/FT8_Receive.py", line 205, in main
tb = top_block_cls()
  File "/home/pi/gr-ft8_rxtx/python/FT8_Receive.py", line 85, in __init__
self.audio_source_0 = audio.source(samp_rate, 'hw:1,0', True)
RuntimeError: audio_alsa_source


FT8_Receive.py
Description: Binary data


snippet_ft8_rxtx.py
Description: Binary data