I am facing a funny issue: I want to use the sound card for analyzing the
spectral response
of a quartz tuning fork at 32768 Hz. I just happened to discover that my laptop
(Panasonic CF-19)
has a sound card able to sample a signal at 192 kHz. I checked with audacity
(Generate -> Tone at
32768 Hz and a frequency counter gives the right output frequency while an
oscilloscope displays
a clean sine wave).
Now I want to do the same with gnuradio-companion: Signal Source sampled at 192
kHz, output frequency
at 32768 Hz, directly connected to the audio sink manually set to 192 kHz. To
make a long story short:
at low frequency (<20 kHz output) the output is at the right frequency, so the
sampling rate is
properly understood. Above 24 kHz I get a clean sine wave output at f-24 kHz,
so it looks like an
aliasing effect with a sampling frequency of 48 kHz, which is not consistent
with my first observation.
And setting an output frequency of 24.xx kHz (xx=300 or 400 Hz) generates on
the oscilloscope a funny
low frequency beat signal which must be related to the antialiasing filters of
the card.
What I cannot understand is where gnuradio fails to initialize the sound card
the way audacity does.
Reading the source code, I find in gr-audio/lib/alsa/alsa_sink.cc the following
intialization
// sampling rate
unsigned int orig_sampling_rate = d_sampling_rate;
if((error = snd_pcm_hw_params_set_rate_near(d_pcm_handle, d_hw_params,
&d_sampling_rate, 0)) < 0)
bail("failed to set rate near", error);
if(orig_sampling_rate != d_sampling_rate) {
fprintf(stderr, "audio_alsa_sink[%s]: unable to support sampling rate
%d\n",
snd_pcm_name(d_pcm_handle), orig_sampling_rate);
fprintf(stderr, " card requested %d instead.\n", d_sampling_rate);
}
which does not seem to test whether the sampling rate is above or below 48 kHz
(as found in the
pull down menu of the Audio Sink block of gnuradio-companion), and I get no
error message when
running my application.
Any idea what could be going wrong ?
Thanks, JM
--
JM Friedt, FEMTO-ST Time & Frequency/SENSeOR, 32 av. observatoire, 25044
Besancon, France
_______________________________________________
Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio