Help with jack-volume please

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Help with jack-volume please

drew Roberts
I am deep down a rabbit hole trying to help someone with something that I think should be simple.

I may be about to solve it in a convoluted way.

I need to be able to use jack-volume:

https://github.com/voidseg/jack-volume

to mute or unmute or raise or lower the volume on command (eventually from a script, probably python.)

Has anyone ever used jack-volume before? Can anyone explain how it should work? Test to see if they can get it to work?

Iiuc, it uses OSC to communicate from the (python) client to the jack-volume (server).

I have never really used OSC either. Does the protocol contain acks that I can look for with wireshark?

What else should I ask?

all the best,

drew

--
Enjoy the Paradise Island Cam playing

_______________________________________________
Linux-audio-user mailing list
[hidden email]
https://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|

Re: Help with jack-volume please

Fons Adriaensen-3
On Tue, Feb 16, 2021 at 02:48:00PM -0500, drew Roberts wrote:
 
> I need to be able to use jack-volume:

As an alternative you could look at zita-jacktools:


class JackGainctl(JackClient):

    """
    Multichannel dezippered audio gain control.

    The 'gain' and 'mute' settings are independent. A gain
    less than -120 dB is equivalent to 'off' (-inf dB).
    The initial gain is 'off', not muted.

    Gain changes are dezippered as follows:
    'off' -> 'on'  : 10 ms fade in.
    'on'  -> 'off' : 10 ms fade out.
    otherwise      : gain changes by max 6 dB for each 10 ms.
    """

or

class JackMatrix(JackClient):

    """
    Audio matrix with gain and delay controls for each input,
    output, and input-output pair.

    Gains are linear and can be negative to invert a signal.
    Use db2lin() to set gains in dB. Delays are in seconds.
    Absolute gain values lower than 1e-15 are set to zero.
    Gain and delay changes are crossfaded over one Jack period.
    """


With a few lines of Python you interface these to whatever
you need.


Ciao,

--
FA


_______________________________________________
Linux-audio-user mailing list
[hidden email]
https://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|

Re: Help with jack-volume please

drew Roberts
Fons,

thanks for the suggestion, trying to explore it now:

resampler.cc:29:12: fatal error: pmmintrin.h: No such file or directory
 #  include <pmmintrin.h>

I have been testing on a pi4. Is there any hope of this stuff working there or do I need to move to an intel box? I don't know where the person I hope to help with this intends to deploy but it is more likely on the intel  / x86 side of things.

all the best,

drew

On Wed, Feb 17, 2021 at 4:12 AM Fons Adriaensen <[hidden email]> wrote:
On Tue, Feb 16, 2021 at 02:48:00PM -0500, drew Roberts wrote:

> I need to be able to use jack-volume:

As an alternative you could look at zita-jacktools:


class JackGainctl(JackClient):

    """
    Multichannel dezippered audio gain control.

    The 'gain' and 'mute' settings are independent. A gain
    less than -120 dB is equivalent to 'off' (-inf dB).
    The initial gain is 'off', not muted.

    Gain changes are dezippered as follows:
    'off' -> 'on'  : 10 ms fade in.
    'on'  -> 'off' : 10 ms fade out.
    otherwise      : gain changes by max 6 dB for each 10 ms.
    """

or

class JackMatrix(JackClient):

    """
    Audio matrix with gain and delay controls for each input,
    output, and input-output pair.

    Gains are linear and can be negative to invert a signal.
    Use db2lin() to set gains in dB. Delays are in seconds.
    Absolute gain values lower than 1e-15 are set to zero.
    Gain and delay changes are crossfaded over one Jack period.
    """


With a few lines of Python you interface these to whatever
you need.


Ciao,

--
FA


_______________________________________________
Linux-audio-user mailing list
[hidden email]
https://lists.linuxaudio.org/listinfo/linux-audio-user


--
Enjoy the Paradise Island Cam playing

_______________________________________________
Linux-audio-user mailing list
[hidden email]
https://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|

Re: Help with jack-volume please

Jeremy Jongepier
Hello Drew,

> thanks for the suggestion, trying to explore it now:
>
> resampler.cc:29:12: fatal error: pmmintrin.h: No such file or directory
>  #  include <pmmintrin.h>
>
> I have been testing on a pi4. Is there any hope of this stuff working there
> or do I need to move to an intel box? I don't know where the person I hope
> to help with this intends to deploy but it is more likely on the intel  /
> x86 side of things.

Could you provide some more context? What is the use case, what are you
trying to achieve by being able to control the volume through JACK?

Best,

Jeremy


_______________________________________________
Linux-audio-user mailing list
[hidden email]
https://lists.linuxaudio.org/listinfo/linux-audio-user

signature.asc (201 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Help with jack-volume please

drew Roberts
Hey Jeremy,

On Wed, Feb 17, 2021 at 7:40 AM Jeremy Jongepier <[hidden email]> wrote:
Hello Drew,

> thanks for the suggestion, trying to explore it now:
>
> resampler.cc:29:12: fatal error: pmmintrin.h: No such file or directory
>  #  include <pmmintrin.h>
>
> I have been testing on a pi4. Is there any hope of this stuff working there
> or do I need to move to an intel box? I don't know where the person I hope
> to help with this intends to deploy but it is more likely on the intel  /
> x86 side of things.

Could you provide some more context? What is the use case, what are you
trying to achieve by being able to control the volume through JACK?

I am not 100% sure I understand it all correctly, but here is what I am working on in my effort to help:

"I have program Audio that will be coming in as AES to the input of the Audio Science card (ASI6644)"

This comes into the machine with the ASI card and gets sent back out to a speaker as analog audio. It is intended to play without stopping.

At 10 minutes past every hour, it should be faded down and specific files played out to the same speaker.

The person with the issue is trying to do it with rivendell.  I am ok with rivendell and don't have the gear to properly test completely in any case. I have not seen anyone give an answer in the rivendell channels (mailing lists, irc, facebook, etc.)

I initially thought of liquidsoap. I get so far and then my skills fail me. It seems it should be easy but it is stumping me. I have one more thought to perhaps annotate things somehow or whatever.

So, I now have a jack graph.

I am running liquidsoap with jack input being sent to one jack output (normal) and the files playing at 10 after going to another jack output (alert). 

I am running a newly compiled silentjack twice. I am sending alert from liquidsoap into both.

silentjack /home/pi/silence.sh
silentjack -n noisejack -r /home/pi/noise.sh

I was putting jack-volume between the sound card in and liquidsoap.
Then then noise is detected by silentjack -r I was trying to mute jack-volume and when silence was detected by silentjack, unmute jack-volume.

I am going to try and drop something in place of jack-volume according to Fons' suggestion and see if I can get that to work.

Overall, this seems convoluted and almost rube-goldberg like and I feel there must be a much better way I am somehow missing.

I am open to suggestions / clues.

Best,

Jeremy

all the best,

drew 

--
Enjoy the Paradise Island Cam playing

_______________________________________________
Linux-audio-user mailing list
[hidden email]
https://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|

Re: Help with jack-volume please

Len Ovens
On Wed, 17 Feb 2021, drew Roberts wrote:

> I am not 100% sure I understand it all correctly, but here is what I am
> working on in my effort to help:
>
> "I have program Audio that will be coming in as AES to the input of the
> Audio Science card (ASI6644)"

AES3 I presume. So stereo program.

> This comes into the machine with the ASI card and gets sent back out to a
> speaker as analog audio. It is intended to play without stopping.

OK

> At 10 minutes past every hour, it should be faded down and specific files
> played out to the same speaker.

The ASI6644 Has Linux alsa drivers, why not use amixer to change the level
of the program audio going into the card (and out if needed).

> I initially thought of liquidsoap. I get so far and then my skills fail me.
> It seems it should be easy but it is stumping me. I have one more thought to
> perhaps annotate things somehow or whatever.

Unless you actually need a streaming capability to extend across a network
(you say aes3 in and audio out so no)

> So, I now have a jack graph.

Basically you are using jackd to mix the two signals then which is ok. I
am not sure what other options are available and jack is probably easiest
to do. I am not that familiar with the ASI6644 (or any audio science card)
as they are out of my price range :) but I think it may be possible to mix
two sets of playback channels in the card itself as it seems to have a
matrix mixer on the card. This would eliminate the use of jack all
together. I do not know if the ALSA driver has all the control showing in
ALSA or if a more direct control is needed. The card does have an API to
allow custom control applications to be set up.

You also mentioned something about a R-pi... My first question for that
would be, does the R-pi have a PCIe slot? I know that some SOC cards do
but my old R-pi 2 most certainly does not :)  However, if you are testing
on a R-pi then I would assume you have a USB device... many of these do
not have mixer controls available to ALSA, using real knobs instead. The
very cheap USB dongles with mic in and headphone out do have ALSA mixer
controls and might be better for testing.


--
Len Ovens
www.ovenwerks.net
_______________________________________________
Linux-audio-user mailing list
[hidden email]
https://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|

Re: Help with jack-volume please

drew Roberts
Len,

Thanks for the feedback.

On Wed, Feb 17, 2021 at 10:30 AM Len Ovens <[hidden email]> wrote:
On Wed, 17 Feb 2021, drew Roberts wrote:

> I am not 100% sure I understand it all correctly, but here is what I am
> working on in my effort to help:
>
> "I have program Audio that will be coming in as AES to the input of the
> Audio Science card (ASI6644)"

AES3 I presume. So stereo program.

I guess. I have never played in that field.
 

> This comes into the machine with the ASI card and gets sent back out to a
> speaker as analog audio. It is intended to play without stopping.

OK

> At 10 minutes past every hour, it should be faded down and specific files
> played out to the same speaker.

The ASI6644 Has Linux alsa drivers, why not use amixer to change the level
of the program audio going into the card (and out if needed).

Ignorant question: How would you script that? How do you detect when the file playback ends and turn the regular volume back up? 

> I initially thought of liquidsoap. I get so far and then my skills fail me.
> It seems it should be easy but it is stumping me. I have one more thought to
> perhaps annotate things somehow or whatever.

Unless you actually need a streaming capability to extend across a network
(you say aes3 in and audio out so no)

I see no mention of the need to stream. Or perhaps he knows how to do that part "outside" of this. 

> So, I now have a jack graph.

Basically you are using jackd to mix the two signals then which is ok. I
am not sure what other options are available and jack is probably easiest
to do. I am not that familiar with the ASI6644 (or any audio science card)
as they are out of my price range :) but I think it may be possible to mix
two sets of playback channels in the card itself as it seems to have a
matrix mixer on the card. This would eliminate the use of jack all
together. I do not know if the ALSA driver has all the control showing in
ALSA or if a more direct control is needed. The card does have an API to
allow custom control applications to be set up.

You also mentioned something about a R-pi... My first question for that
would be, does the R-pi have a PCIe slot?

He has the nice card, I have the R-pi... ~;-)
 
I know that some SOC cards do
but my old R-pi 2 most certainly does not :)  However, if you are testing
on a R-pi then I would assume you have a USB device...

I do have an inexpensive ub, no capture controls, 1 playback (PCM).
 
many of these do
not have mixer controls available to ALSA, using real knobs instead. The
very cheap USB dongles with mic in and headphone out do have ALSA mixer
controls and might be better for testing.

I still have the feeling that someone who knows what they are doing in liquidsoap could to it all there very easily. 

I have asked something in #savonet on irc. No response yet.

I am learning a lot in this process that may be useful later so I am happy enough to experiment...


--
Len Ovens
www.ovenwerks.net

all the best,

drew

--
Enjoy the Paradise Island Cam playing

_______________________________________________
Linux-audio-user mailing list
[hidden email]
https://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|

Re: Help with jack-volume please

Fons Adriaensen-3
In reply to this post by drew Roberts
On Wed, Feb 17, 2021 at 09:52:42AM -0500, drew Roberts wrote:
 
> At 10 minutes past every hour, it should be faded down and specific files
> played out to the same speaker.

JackPlayer (from zita-jacktools) should be able to handle that as well.

Ciao,
 
--
FA

_______________________________________________
Linux-audio-user mailing list
[hidden email]
https://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|

Re: Help with jack-volume please

Jannis Achstetter
In reply to this post by drew Roberts
I haven't read all the thread in detail, I just got an idea about it I
would like to share :)

Am 17.02.21 um 15:52 schrieb drew Roberts:

> I am not 100% sure I understand it all correctly, but here is what I am
> working on in my effort to help:
>
> "I have program Audio that will be coming in as AES to the input of the
> Audio Science card (ASI6644)"
>
> This comes into the machine with the ASI card and gets sent back out to
> a speaker as analog audio. It is intended to play without stopping.
>
> At 10 minutes past every hour, it should be faded down and specific
> files played out to the same speaker.

This sounds like a use-case similar to a compressor with
side-chain-input to me.
The audio coming in via AES goes to the regular input of the compressor,
its output goes to the speakers.
Your "audio files" go in the compressor's side-chain and to the speakers.
As soon as audio goes in the compressor's side-chain, it will
automatically turn down the volume of the signal to be compressed. If
one sets the ratio to infinite and the threshold pretty low, I would say
it's possible to completely mute the signal coming in via AES.

Only drawback: you cannot do it sequentially like:
- Fade down volume
- Wait a second
- Play files

since the fading-down of the volume will be an effect of the files being
played.

Might help, might not :)

Best regards,
        Jannis
_______________________________________________
Linux-audio-user mailing list
[hidden email]
https://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|

Re: Help with jack-volume please

Jannis Achstetter
Am 17.02.21 um 18:39 schrieb Jannis Achstetter:
>
> Only drawback: you cannot do it sequentially like:
> - Fade down volume
> - Wait a second
> - Play files
>
> since the fading-down of the volume will be an effect of the files being
> played.


Thinking about it, it's possible:
Make the audio files go to the compressor's side chain input directly
and to a delay. That delay's output goes to the speakers.
This way, the audio from AES will fade out before the files' sound gets
to the speakers.

Making the audio files fade in some time after the audio files have
ended can be achieved by a reverb with long tail before the
sideband-input of the compressor.

This way, you could solve your requirements with one
sideband-compressor, one delay, one reverb, a command-line-player for
your audio files (mplayer, mpv, ...) and a cron-job that triggers it.

Best regards,
        Jannis
_______________________________________________
Linux-audio-user mailing list
[hidden email]
https://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|

Re: Help with jack-volume please

drew Roberts
Jannis,

I am experimenting a bit with the guts of this.

If I have rewired my jack graph correctly, I have liquidsoap taking in the soundcard audio and sending it out as normal, at specified times, the same liquidsoap instance plays the files and sends it to the jack graph as alert.

I have normal audio going into the main inputs of the compressor, I have alert audio going into the sidechain inputs of the compressor. I have the compressor outputs and the alert audio going out to the soundcard.

It seems to be working as well as what I was doing before and seems much more simple...

More experimenting to come.

Thanks for the help everyone.

all the best,

drew

On Wed, Feb 17, 2021 at 12:53 PM Jannis Achstetter <[hidden email]> wrote:
Am 17.02.21 um 18:39 schrieb Jannis Achstetter:
>
> Only drawback: you cannot do it sequentially like:
> - Fade down volume
> - Wait a second
> - Play files
>
> since the fading-down of the volume will be an effect of the files being
> played.


Thinking about it, it's possible:
Make the audio files go to the compressor's side chain input directly
and to a delay. That delay's output goes to the speakers.
This way, the audio from AES will fade out before the files' sound gets
to the speakers.

Making the audio files fade in some time after the audio files have
ended can be achieved by a reverb with long tail before the
sideband-input of the compressor.

This way, you could solve your requirements with one
sideband-compressor, one delay, one reverb, a command-line-player for
your audio files (mplayer, mpv, ...) and a cron-job that triggers it.

Best regards,
        Jannis
_______________________________________________
Linux-audio-user mailing list
[hidden email]
https://lists.linuxaudio.org/listinfo/linux-audio-user


--
Enjoy the Paradise Island Cam playing

_______________________________________________
Linux-audio-user mailing list
[hidden email]
https://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|

Re: Help with jack-volume please

Athanasios Silis
Just for completeness I will also add here the possibility to use jack-mixer. Yes it is python based and has a gui but the core is a  C application that you can use directly. So mixing can be done there.
To control the input channels you will need to use midi signals, but it is possible to generate those from a bash script (this may give you some ideas http://linux-audio.4202.n7.nabble.com/how-can-I-send-a-midi-command-from-bash-through-jack-to-my-HW-controller-td104387.html).
So bash could then be used to orchestrate the channel volume fading and triggering the sound files. At the end of playing the stream execution in the script will continue to increase the volume again or unmute the AES channel.

Best regards,
Athanasios

On Wed, Feb 17, 2021 at 10:25 PM drew Roberts <[hidden email]> wrote:
Jannis,

I am experimenting a bit with the guts of this.

If I have rewired my jack graph correctly, I have liquidsoap taking in the soundcard audio and sending it out as normal, at specified times, the same liquidsoap instance plays the files and sends it to the jack graph as alert.

I have normal audio going into the main inputs of the compressor, I have alert audio going into the sidechain inputs of the compressor. I have the compressor outputs and the alert audio going out to the soundcard.

It seems to be working as well as what I was doing before and seems much more simple...

More experimenting to come.

Thanks for the help everyone.

all the best,

drew

On Wed, Feb 17, 2021 at 12:53 PM Jannis Achstetter <[hidden email]> wrote:
Am 17.02.21 um 18:39 schrieb Jannis Achstetter:
>
> Only drawback: you cannot do it sequentially like:
> - Fade down volume
> - Wait a second
> - Play files
>
> since the fading-down of the volume will be an effect of the files being
> played.


Thinking about it, it's possible:
Make the audio files go to the compressor's side chain input directly
and to a delay. That delay's output goes to the speakers.
This way, the audio from AES will fade out before the files' sound gets
to the speakers.

Making the audio files fade in some time after the audio files have
ended can be achieved by a reverb with long tail before the
sideband-input of the compressor.

This way, you could solve your requirements with one
sideband-compressor, one delay, one reverb, a command-line-player for
your audio files (mplayer, mpv, ...) and a cron-job that triggers it.

Best regards,
        Jannis
_______________________________________________
Linux-audio-user mailing list
[hidden email]
https://lists.linuxaudio.org/listinfo/linux-audio-user


--
Enjoy the Paradise Island Cam playing
_______________________________________________
Linux-audio-user mailing list
[hidden email]
https://lists.linuxaudio.org/listinfo/linux-audio-user

_______________________________________________
Linux-audio-user mailing list
[hidden email]
https://lists.linuxaudio.org/listinfo/linux-audio-user