Re: OOT Module with shape error

2021-05-26 Thread Jeff Long
The "additional checks" would be to find the min of input and output
lengths, and to copy only that number of items. Something like:

nitems = min(len(input_items[0]), len(output_items[0]))
out[:nitems] = in[:nitems]

As your block gets more complex, the checks/limits may get more complex.

On Wed, May 26, 2021 at 7:56 PM Elmore Family  wrote:

> Jeff,
>
> This didn’t work – same error.
>
> Jim
>
> *From:* Jeff Long
> *Sent:* Tuesday, May 25, 2021 5:22 PM
> *To:* GNURadio Discussion List
> *Subject:* Re: OOT Module with shape error
>
> The framework can give you different size input and output buffers. In
> this case, you would:
>
> nitems = len(input_items[0])
> out[:nitems] = input_items[0]
>
> You may have to do more checks, of course, because input could be larger
> than output.
>
> On Tue, May 25, 2021 at 5:03 PM Elmore's  wrote:
>
>> I am attempting to add an OOT module to my flowgraph. I have generated a
>> General block which I want to place between an Audio Source and a Multiply
>> Constant.
>>
>> The Audio Source is set at a 48K sample rate. Input and Output are float.
>>
>> As a test (I have never tried using an OOT module before) I said:
>> out[:] = input_items[0]
>> in an attempt to simply feed the input to the output unmodified.
>>
>> I get a run time error:
>> ValueError: Could not broadcast input array from shape(4800) into
>> shape(256)
>>
>> Obviously I don’t know how to perform the simplest possible operation.
>> What is wrong here?
>>
>> I have tried looking on forums and reading some of the GNU docs but no
>> joy.
>>
>> Thanks for any help.
>>
>> Jim
>>
>>
>>
>>
>> 
>>  Virus-free.
>> www.avg.com
>> 
>>
>


Re: OOT Module with shape error

2021-05-26 Thread Elmore Family
Jeff,

This didn’t work – same error.

Jim

From: Jeff Long
Sent: Tuesday, May 25, 2021 5:22 PM
To: GNURadio Discussion List
Subject: Re: OOT Module with shape error

The framework can give you different size input and output buffers. In this 
case, you would:

nitems = len(input_items[0])
out[:nitems] = input_items[0]

You may have to do more checks, of course, because input could be larger than 
output.

On Tue, May 25, 2021 at 5:03 PM Elmore's  wrote:

  I am attempting to add an OOT module to my flowgraph. I have generated a 
General block which I want to place between an Audio Source and a Multiply 
Constant.

  The Audio Source is set at a 48K sample rate. Input and Output are float.

  As a test (I have never tried using an OOT module before) I said:
  out[:] = input_items[0]
  in an attempt to simply feed the input to the output unmodified.

  I get a run time error:
  ValueError: Could not broadcast input array from shape(4800) into 
shape(256)

  Obviously I don’t know how to perform the simplest possible operation. What 
is wrong here?

  I have tried looking on forums and reading some of the GNU docs but no joy.

  Thanks for any help.

  Jim



   Virus-free. www.avg.com


--
This email has been checked for viruses by AVG.
https://www.avg.com


Re: Gnuradio: SineWave generator python block choppy audio out

2021-05-26 Thread Mitja kocjančič
both yours and Maruc solutions work very well, didn't spot any visual
difference between them, so thank you both

V V sre., 26. maj 2021 ob 18:50 je oseba Achilleas Anastasopoulos <
anas...@umich.edu> napisala:

> Hi all,
>
> I do not think that the proposed algorithm by Marcus is the correct way to
> implement this block,
> because it assumes that the frequency has remained the same throughout the
> life of the block!
> The correct way is to keep a state variable (say, "self.phase") that is
> initialized to 0 and  records the accumulated state (modulo 2 pi) up to the
> last call of work.
> Then in one call of work you should just generate the sin wave as
> suggested:
>
> f_rel = 2 * np.pi * self.frequency / self.sample_rate
> number = len(output_items[0])
> phases = (f_rel * np.arange(0,number)+self.phase ) % (2*np.pi)
> output_items[0][:] = self.amplitude*np.sin(phases)
> self.phase=phases[-1]+ f_rel
>
> best
> Achilleas
>


Re: libosmo-dsp build hangs (required for gr-osmosdr)

2021-05-26 Thread Jeff Long
In ~/.pybombs/config.yml

- config:
makewidth: 4
builddocs: OFF
cmakebuildtype: Release

On Wed, May 26, 2021 at 12:41 PM Johannes Demel 
wrote:

> Hi all,
>
> I'm trying to install gr-osmosdr with GR 3.9. Currently pybombs hangs
> during libosmo-dsp build. Unfortunately it just hangs forever without
> any output, but if I try it manually, I see:
>
> ```
> ! LaTeX Error: File `newunicodechar.sty' not found.
>
> Type X to quit or  to proceed,
> or enter new name. (Default extension: sty)
>
> Enter file name:
> ```
> Thus, I'd like to disable generating docs. All of this happens while
> docs are generated. There's a minimal latex install but I don't want any
> more TeX on that machine.
>
> I can't find the switch to disable docs. How do I do that? Or disable
> doxygen.
>
> Cheers
> Johannes
>
> --
> Johannes Demel M.Sc.
> Research Engineer
>
> University of Bremen
> Department of Communications Engineering
> Faculty 1 - Physics / Electrical Engineering
> NW1, N2400
> Otto-Hahn-Allee NW1
> 28359 Bremen
>
> Phone +49 421 218-62393
> de...@ant.uni-bremen.de
>
> Secretariat
> Tel. +49 421 218-62390
> pre...@ant.uni-bremen.de
>
> www.uni-bremen.de/en
>
> University of Bremen - Established 1971
>
>


Re: Gnuradio: SineWave generator python block choppy audio out

2021-05-26 Thread Mitja kocjančič
although later testing shows that yours doesn't flicker like Markuc does
when changing frequency or sample rate on the fly

V V sre., 26. maj 2021 ob 19:08 je oseba Mitja kocjančič 
napisala:

> both yours and Maruc solutions work very well, didn't spot any visual
> difference between them, so thank you both
>
> V V sre., 26. maj 2021 ob 18:50 je oseba Achilleas Anastasopoulos <
> anas...@umich.edu> napisala:
>
>> Hi all,
>>
>> I do not think that the proposed algorithm by Marcus is the correct way
>> to implement this block,
>> because it assumes that the frequency has remained the same
>> throughout the life of the block!
>> The correct way is to keep a state variable (say, "self.phase") that is
>> initialized to 0 and  records the accumulated state (modulo 2 pi) up to the
>> last call of work.
>> Then in one call of work you should just generate the sin wave as
>> suggested:
>>
>> f_rel = 2 * np.pi * self.frequency / self.sample_rate
>> number = len(output_items[0])
>> phases = (f_rel * np.arange(0,number)+self.phase ) % (2*np.pi)
>> output_items[0][:] = self.amplitude*np.sin(phases)
>> self.phase=phases[-1]+ f_rel
>>
>> best
>> Achilleas
>>
>


Re: Gnuradio: SineWave generator python block choppy audio out

2021-05-26 Thread Achilleas Anastasopoulos
Hi all,

I do not think that the proposed algorithm by Marcus is the correct way to
implement this block,
because it assumes that the frequency has remained the same throughout the
life of the block!
The correct way is to keep a state variable (say, "self.phase") that is
initialized to 0 and  records the accumulated state (modulo 2 pi) up to the
last call of work.
Then in one call of work you should just generate the sin wave as suggested:

f_rel = 2 * np.pi * self.frequency / self.sample_rate
number = len(output_items[0])
phases = (f_rel * np.arange(0,number)+self.phase ) % (2*np.pi)
output_items[0][:] = self.amplitude*np.sin(phases)
self.phase=phases[-1]+ f_rel

best
Achilleas


libosmo-dsp build hangs (required for gr-osmosdr)

2021-05-26 Thread Johannes Demel

Hi all,

I'm trying to install gr-osmosdr with GR 3.9. Currently pybombs hangs 
during libosmo-dsp build. Unfortunately it just hangs forever without 
any output, but if I try it manually, I see:


```
! LaTeX Error: File `newunicodechar.sty' not found.

Type X to quit or  to proceed,
or enter new name. (Default extension: sty)

Enter file name:
```
Thus, I'd like to disable generating docs. All of this happens while 
docs are generated. There's a minimal latex install but I don't want any 
more TeX on that machine.


I can't find the switch to disable docs. How do I do that? Or disable 
doxygen.


Cheers
Johannes

--
Johannes Demel M.Sc.
Research Engineer

University of Bremen
Department of Communications Engineering
Faculty 1 - Physics / Electrical Engineering
NW1, N2400
Otto-Hahn-Allee NW1
28359 Bremen

Phone +49 421 218-62393
de...@ant.uni-bremen.de

Secretariat
Tel. +49 421 218-62390
pre...@ant.uni-bremen.de

www.uni-bremen.de/en

University of Bremen - Established 1971



Re: rational resampler fractional bandwidth error

2021-05-26 Thread Jason Matusiak
That did the trick, thanks Jeff.


Re: rational resampler fractional bandwidth error

2021-05-26 Thread Jeff Long
Try leaving the field blank to get the previous behavior.

On Wed, May 26, 2021 at 10:02 AM Jason Matusiak <
ja...@gardettoengineering.com> wrote:

> It has been a while since I have worked with GNUradio, but I am poking
> around with it again and having some issues.  I am currently using v3.8 on
> an Ubuntu machine.
>
> I was trying to get a custom flowgraph to work and ran up against an error
> for the rational resampler.  I then pulled out the  fm_rds_alternate.grc
> example from gr-rds and found the exact same issue.  Basically, if I use
> the stock flowgraph, when I try to run it, I get the following error:
>
> Traceback (most recent call last):
>   File "/opt/gnuradio/v3.8/src/gr-rds/examples/fm_rds_alternate.py", line
> 784, in 
> main()
>   File "/opt/gnuradio/v3.8/src/gr-rds/examples/fm_rds_alternate.py", line
> 760, in main
> tb = top_block_cls()
>   File "/opt/gnuradio/v3.8/src/gr-rds/examples/fm_rds_alternate.py", line
> 548, in __init__
> fractional_bw=0)
>   File
> "/opt/gnuradio/v3.8/lib/python3/dist-packages/gnuradio/filter/rational_resampler.py",
> line 150, in __init__
> interpolation, decimation, taps, fractional_bw)
>   File
> "/opt/gnuradio/v3.8/lib/python3/dist-packages/gnuradio/filter/rational_resampler.py",
> line 113, in __init__
> taps = design_filter(interpolation, decimation, fractional_bw)
>   File
> "/opt/gnuradio/v3.8/lib/python3/dist-packages/gnuradio/filter/rational_resampler.py",
> line 46, in design_filter
> raise ValueError("Invalid fractional_bandwidth, must be in (0, 0.5)")
> ValueError: Invalid fractional_bandwidth, must be in (0, 0.5)
>
> >>> Done (return code 1)
>
> Did something maybe change with the rational resampler and I need to
> update older flowgraphs?  Using a value of 0.4 allows it to run, but I am
> not sure if that is an acceptable value when it was previously set to zero
> (it would appear).
>
>


rational resampler fractional bandwidth error

2021-05-26 Thread Jason Matusiak
It has been a while since I have worked with GNUradio, but I am poking around 
with it again and having some issues.  I am currently using v3.8 on an Ubuntu 
machine.

I was trying to get a custom flowgraph to work and ran up against an error for 
the rational resampler.  I then pulled out the  fm_rds_alternate.grc example 
from gr-rds and found the exact same issue.  Basically, if I use the stock 
flowgraph, when I try to run it, I get the following error:

Traceback (most recent call last):
  File "/opt/gnuradio/v3.8/src/gr-rds/examples/fm_rds_alternate.py", line 784, 
in 
main()
  File "/opt/gnuradio/v3.8/src/gr-rds/examples/fm_rds_alternate.py", line 760, 
in main
tb = top_block_cls()
  File "/opt/gnuradio/v3.8/src/gr-rds/examples/fm_rds_alternate.py", line 548, 
in __init__
fractional_bw=0)
  File 
"/opt/gnuradio/v3.8/lib/python3/dist-packages/gnuradio/filter/rational_resampler.py",
 line 150, in __init__
interpolation, decimation, taps, fractional_bw)
  File 
"/opt/gnuradio/v3.8/lib/python3/dist-packages/gnuradio/filter/rational_resampler.py",
 line 113, in __init__
taps = design_filter(interpolation, decimation, fractional_bw)
  File 
"/opt/gnuradio/v3.8/lib/python3/dist-packages/gnuradio/filter/rational_resampler.py",
 line 46, in design_filter
raise ValueError("Invalid fractional_bandwidth, must be in (0, 0.5)")
ValueError: Invalid fractional_bandwidth, must be in (0, 0.5)

>>> Done (return code 1)

Did something maybe change with the rational resampler and I need to update 
older flowgraphs?  Using a value of 0.4 allows it to run, but I am not sure if 
that is an acceptable value when it was previously set to zero (it would 
appear).



Re: Gnuradio: SineWave generator python block choppy audio out

2021-05-26 Thread Marcus Müller
err Oh! I shouldn't have answered in a hurry, sorry!
The method self.nitems_written(0) gives you the items your block has already 
produced, so
that at each call to work() the sine continues exactly where it left off.
My apologies for the confusion this caused,
Marcus

On 26.05.21 13:06, Mitja kocjančič wrote:
> OK, I tried it even on GNURadio 3.9 and self.noutputs_written(0) is still not 
> defined
> https://imgur.com/ylW1uGy 
> 
> so is there any other way to set startnrto the right value so my audio won't 
> be choppy
> 
> BTW: side question, is it possible to somehow tell gnuradio to always use 
> notepad++ as its
> editor (config option or something)?
> 
> 
> V V sre., 26. maj 2021 ob 11:59 je oseba Marcus Müller  > napisala:
> 
> Sorry, the function is called self.noutputs_written() of course.
> 
> https://github.com/rftap/gr-rftap  
> shouldn't be
> necessary, usually; I think gr-ieee802-11
> even contains exactly this functionality!
> 
> gr-rds has definitely been ported to 3.8 (it's even the default branch), 
> and 3.9 (the
> maint-3.9 branch).
> 
> Best regards,
> Marcus
> 
> On 26.05.21 10:37, Mitja kocjančič wrote:
> > Thanks you very much
> > the reason I use gnuradio 3.7 is because some OOT modules
> >
> > gr-rftap https://github.com/rftap/gr-rftap 
> 
> >
> > gr-rds (don't know about this one but probably would work on 3.9):
> > https://github.com/bastibl/gr-rds 
> >
> >
> > do not work on gnuradio 3.9 (rftap doesn't even work on 3.8) and I am 
> waiting for
> them to
> > port over
> >
> > am not sure where you got
> > ninputs_written(0) from as its not defined and even looked in gnuradio 
> 3.9 source
> code and
> > couldn't find it mentioned anywhere
> >
> >
> >
> > V V sre., 26. maj 2021 ob 00:18 je oseba Marcus Müller 
>  
> > >> napisala:
> >
> >     Hi Mitja!
> >
> >     Great to have you here :)
> >
> >
> >     Couple of things up front:
> >
> >     1. This is GNU Radio 3.7. Especially if you want to implement 
> things in Python
> blocks, 3.8
> >     or later is a *must*. GNU Radio 3.7 is really just in legacy 
> keepalive mode, not
> actively
> >     developed. Please update to GNU Radio 3.8 or 3.9. You really should 
> not start
> developing
> >     for GNU Radio 3.7 in 2021!
> >     2. WX GUI is dead. We stopped being able to support it a long time 
> ago. Please
> use Qt GUI
> >     instead.
> >
> >     All in all, please update your version of GNU Radio. In case any 
> bugs occur, we
> won't be
> >     able to help you with GNU Radio 3.7. GNU Radio 3.8 can be natively 
> installed on
> almost all
> >     modern Linux distros directly from their package managers, and on 
> Windows, and
> OS X using
> >     conda and other tools, without any complications.
> >
> >     With that out of the way, let's look at your code:
> >
> >             for i in range(0, len(output_items[0])): #8192
> >                 output_items[0][i] = np.sin(2 * np.pi * self.frequency 
> * (i /
> >     self.sample_rate)) * self.amplitude
> >
> >     No surprise the sound is choppy! You reset your i to 0 for every 
> new call to work();
> >     however, GNU Radio doesn't guarantee that work is called with 
> number of items
> equal to a
> >     multiple of your sine period.
> >     So, this is a bug in your design. What you'd want is really 
> something like
> >
> >     def work(self, input_items, output_items):
> >        # get rid of the for loop!
> >        startnr = self.ninputs_written(0)
> >        f_rel = 2 * np.pi * self.frequency / self.sample_rate
> >        number = len(output_items[0])
> >        output_items[0][:] = self.amplitude*np.sin(f_rel * 
> np.arange(startnr,
> startnr+number))
> >        return number
> >
> >     Best regards
> >     Marcus
> >
> 



Re: Gnuradio: SineWave generator python block choppy audio out

2021-05-26 Thread Mitja kocjančič
Thanks you very much
the reason I use gnuradio 3.7 is because some OOT modules

gr-rftap https://github.com/rftap/gr-rftap
gr-rds (don't know about this one but probably would work on 3.9):
https://github.com/bastibl/gr-rds

do not work on gnuradio 3.9 (rftap doesn't even work on 3.8) and I am
waiting for them to port over

am not sure where you got
ninputs_written(0) from as its not defined and even looked in gnuradio 3.9
source code and couldn't find it mentioned anywhere



V V sre., 26. maj 2021 ob 00:18 je oseba Marcus Müller <
mmuel...@gnuradio.org> napisala:

> Hi Mitja!
>
> Great to have you here :)
>
>
> Couple of things up front:
>
> 1. This is GNU Radio 3.7. Especially if you want to implement things in
> Python blocks, 3.8
> or later is a *must*. GNU Radio 3.7 is really just in legacy keepalive
> mode, not actively
> developed. Please update to GNU Radio 3.8 or 3.9. You really should not
> start developing
> for GNU Radio 3.7 in 2021!
> 2. WX GUI is dead. We stopped being able to support it a long time ago.
> Please use Qt GUI
> instead.
>
> All in all, please update your version of GNU Radio. In case any bugs
> occur, we won't be
> able to help you with GNU Radio 3.7. GNU Radio 3.8 can be natively
> installed on almost all
> modern Linux distros directly from their package managers, and on Windows,
> and OS X using
> conda and other tools, without any complications.
>
> With that out of the way, let's look at your code:
>
> for i in range(0, len(output_items[0])): #8192
> output_items[0][i] = np.sin(2 * np.pi * self.frequency * (i /
> self.sample_rate)) * self.amplitude
>
> No surprise the sound is choppy! You reset your i to 0 for every new call
> to work();
> however, GNU Radio doesn't guarantee that work is called with number of
> items equal to a
> multiple of your sine period.
> So, this is a bug in your design. What you'd want is really something like
>
> def work(self, input_items, output_items):
># get rid of the for loop!
>startnr = self.ninputs_written(0)
>f_rel = 2 * np.pi * self.frequency / self.sample_rate
>number = len(output_items[0])
>output_items[0][:] = self.amplitude*np.sin(f_rel * np.arange(startnr,
> startnr+number))
>return number
>
> Best regards
> Marcus
>
>