[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] Re: gr-audio-jack - mono only?

From: Stephane Fillod
Subject: [Discuss-gnuradio] Re: gr-audio-jack - mono only?
Date: Sun, 5 Mar 2006 16:15:56 +0100
User-agent: Mutt/1.5.11

Hi Ramakrishnan,

I hope you won't mind if I Cc:'d this message to the discuss-gnuradio

On Sun, Mar 05, 2006, Ramakrishnan Muthukrishnan wrote:
> Sorry for more emails.. 

No problem on that :-)

> I could create a gr_source jack source. But it was only one channel so I 
> looked
> at the code and found this:
> ...
> ...
>    d_jack_input_port = jack_port_register (d_jack_client, "in", 
>                 JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0);
> ...
> ...
> Can we make this general enough by passing the number of channels while 
> creation,
> like
>   audio_jack.source (sampling_rate, num_channels)

That'd nice. I was just lazy when I wrote the first version of
audio_jack, and I thought the following would do:

        from gnuradio import audio_jack

        # JACK audio as final sink
        audio_sink_i = audio_jack.sink (jack_rate, "gr_sink_I")
        audio_sink_q = audio_jack.sink (jack_rate, "gr_sink_Q")

        # split IQ because JACK audio is only mono
        split_IQ = gr.complex_to_float ()

        # now wire it all together
        self.connect (someblock, split_IQ)
        self.connect ((split_IQ, 0), audio_sink_i)
        self.connect ((split_IQ, 1), audio_sink_q)

It works, but is kind of bad-looking in qjackctl and cumbersome in GR
scripts because of the need to gr.complex_to_float. This could be fixed
in gr-audio-jack with an array of jack descriptors.

Now I'm wondering whether gr-audio-jack has its place, because I realized
gr-audio-alsa can interface with jack through the use of the package
libasound2-plugins (ALSA library additional plugins "jack") as long as 
the file ~/.asoundrc contains something like this:

pcm.myjack {
        type jack
        playback_ports {
                0 alsa_pcm:playback_1
                1 alsa_pcm:playback_1
        capture_ports {
                0 alsa_pcm:capture_1
                1 alsa_pcm:capture_1
                #0 gr_sink_I:out
                #1 gr_sink_Q:out

# Usage: aplay -Dplug:myjack foo.wav

The fact the port names of the jackified alsa application (ie. the GR app)
are not known before runtime is one drawback. The name is derived from
application name, PID, whatnot. Maybe I haven't found yet the option to
specify it through alsa manipulators.

Rem: I have no idea of the quality of the libasound jack plugin, esp. with
respect to the distortion of signal in case of resampling, latency, load, 
overrun/underun handling, ...

The nice thing about the package libasound2-plugins is that we are able 
to interface any legacy digital application (gmfsk, dream, soundmodem, 
aptdec, *psk, linrad, acarsd, etc.) with GNU Radio as long as the legacy
application is using ALSA. Some of those app still need to be converted
from OSS to ALSA though.

Stephane, F8CFE

PS: thanks for the gr-audio-jack package in debian unstable!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]