How to work with a limited sample

Hi everyone.
I just started using GRC for a college assignment, but I’m having a hard
time to find what I need to know in order to do what I want.
I want to make a flowgraph that works with a limited sample, like a WAV
file. So I’d like to know how to stop the flowgraph after the processing
is done, or something similar.
Thanks in advance.

Hi Gui,

that’s how most sample sources work anyway.
So just find the source that suits your needs best (in your case: Wav
file source), connect it to your signal processing blocks and run the
flowgraph. It will stop when the source signals that it’s done, which
will happen when the file end is reached.

Happy Hacking!
Marcus

On Friday, October 4, 2013, Marcus M. wrote:

processing is done, or something similar.


Discuss-gnuradio mailing list
[email protected] <javascript:;>
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

That’s correct that file playback type sinks will end the flowgraph
after
reading every item. As a more general alternative if you have a live
source
and just want to use X samples you can use the head block.

Thanks for the replies. I played a bit and was able to generate a WAV
file and listen to it. However, there are some things I still want to
know.
I can play the generated file in VLC, but I can’t play it in Audacity or
see it’s waveform. I’d like to see the waveform to see stuff like noise.
I tried to see it in GRC’s WX GUI Scope Sink, but I don’t know how to
make it show the standing waveform (without updating constantly).
I though of using the Head block, but how can I know, in runtime, the
amount of items that will be passed?

Hi Gui,
On 10/05/2013 07:59 PM, Gui Ritter wrote:

I can play the generated file in VLC, but I can’t play it in Audacity or see
it’s waveform.
That’s odd. The Wav File Sink produces valid Wav files, and on my PC
audacity reads them just fine:
Flowgraph: Signal Source->head->wav file sink,
Parameters: samp_rate = 44100, format float all the way down, head
number of samples = samp_rate * 5 (==5 seconds)
I’d like to see the waveform to see stuff like noise. I tried to see it in GRC’s
WX GUI Scope Sink, but I don’t know how to make it show the standing waveform
(without updating constantly).
So let’s presume you have recorded samples from a raw data file, or a
wav file, or a signal source, or whatever. You can “replay” them as slow
as you want.
You could use the scope sink, with a throttle block before, with that
you could slow down your flowgraph quite a bit. However, throttle does
not work as most people expect it too, and does not enforce a constant
sampling rate throughout the flowgraph but limits the number of bursts
of samples per second so that the average is limited.
In your case, I’d suggest using the very handy
gr_plot_{float,iq,int,fft…} tools; you just write your samples to disk
using a file sink (NOT wav file sink), and run the tool on the filename.

I though of using the Head block, but how can I know, in runtime, the amount of
items that will be passed?
I don’t understand the question. You specify the number of samples
before running the flowgraph. That’s exactly how many samples will be
passed.

Hope that helped a little,
Marcus

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs