Forum: GNU Radio Re: Re: gr.wavfile_source

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Dimitris S. (Guest)
on 2008-12-18 12:28
(Received via mailing list)
Martin (or anyone else), I have an additional question about
gr_wavfile_source:

after opening the file (with self.src = gr.wavfile_source
(options.filename, True)), is it possible to get some of the
parameters and use them in the code?

I'm particularly interested in d_sample_rate(1), d_nchans(1),
d_bytes_per_sample(2)

I tried self.src.d_nchans, but it tells me: AttributeError:
'gr_wavfile_source_sptr' object has no attribute 'd_nchans'

Thank you for your help

Dimitris S.
"If you think you're too small to make a difference, try sleeping with
a mosquito!" - Amnesty International
Martin B. (Guest)
on 2008-12-18 16:11
(Received via mailing list)
On Thu, Dec 18, 2008 at 11:25:04AM +0100, Dimitris S. wrote:
> 'gr_wavfile_source_sptr' object has no attribute 'd_nchans'
No, but if you check gnuradio-core/src/lib/io/gr_wavfile_source.i,
you'll see that the following methods get exported via SWIG:

  unsigned int sample_rate();
  int bits_per_sample();
  int channels();

which return exactly what you'd expect (I hope :).
Note this is bits - and not bytes - per sample you get.

Cheers,
mb
This topic is locked and can not be replied to.