Topic: Linux, pianoteq and 'system' audio (e.g. youtube)

I'm trying to watch a video on youtube and use pianoteq?
If pianoteq is running, youtube suspends, no audio?

Has anyone resolved this please? perhaps using qjackctl?

Re: Linux, pianoteq and 'system' audio (e.g. youtube)

A Windows user here, but the same happens when I run Pianoteq at any sample rate other than 44.1 kHz. Just set it in the Pianoteq audio options.

Last edited by AKM (13-09-2015 11:38)

Re: Linux, pianoteq and 'system' audio (e.g. youtube)

AKM wrote:

A Windows user here, but the same happens when I run Pianoteq at any sample rate other than 44.1 kHz. Just set it in the Pianoteq audio options.

Yes, I'm set at 44.1kHz.

Re: Linux, pianoteq and 'system' audio (e.g. youtube)

pe2dave wrote:

I'm trying to watch a video on youtube and use pianoteq?
If pianoteq is running, youtube suspends, no audio?

Has anyone resolved this please? perhaps using qjackctl?

For these "problems" sound-servers, like pulseaudio were invented (which can combine several audio-streams). But don't expect the same latency, when using "PulseAudio Sound Server" in Pianoteq's Output devices instead of  "Direct hardware device without any conversions". But you can watch google youtube and use Pianoteq at the same time ...

Re: Linux, pianoteq and 'system' audio (e.g. youtube)

Thanks. Already running. I'll figure out H2 configure it for the two.
Latency isn't an issue with my usage!

Re: Linux, pianoteq and 'system' audio (e.g. youtube)

Try "Windows Audio" in Audio device type.
P.S. Oh, excuse me, I didn't notice, that you use Linux

Last edited by Kridlatec (13-09-2015 13:18)
Pianoteq 6 Pro (D4, K2, Blüthner, Model B, Grotrian, Ant.Petrof)
Studiologic SL88Grand, Steinberg UR22mkII

Re: Linux, pianoteq and 'system' audio (e.g. youtube)

If your computer is really fast, PulseAudio will work.

If not, JACK is the solution on Linux for audio sharing at low latency/low cpu usage.

Last edited by Mossy (14-09-2015 02:34)

Re: Linux, pianoteq and 'system' audio (e.g. youtube)

Mossy wrote:

If your computer is really fast, PulseAudio will work.

If not, JACK is the solution on Linux for audio sharing at low latency/low cpu usage.

No - and with v.little conf doco, I think jack is a better option.

Thanks.

Re: Linux, pianoteq and 'system' audio (e.g. youtube)

pe2dave wrote:
Mossy wrote:

If your computer is really fast, PulseAudio will work.

If not, JACK is the solution on Linux for audio sharing at low latency/low cpu usage.

No - and with v.little conf doco, I think jack is a better option.

Thanks.

JACK of course works better.

I was just saying PulseAudio "works" if your computer is fast enough.  On my 4 core laptop i5, PulseAudio takes up an entire core.  I normally keep the laptop underclocked at 1.1ghz for Pianoteq + Direct HW audio but while I was testing PulseAudio, I had to let it run at the max 2.3ghz to keep the sound from breaking up.

JACK does require the standard Linux voodoo config of course for corner cases.  For example, JACK does not recover from a suspend so you need to insert scripts to trigger upon Resume to restart JACK.

Re: Linux, pianoteq and 'system' audio (e.g. youtube)

In Linux, you really should better use jack over pulseaudio for music playing. The setup is very easy.
In Ubuntu, you first install qjackctl package. It will pull the jack itself too. Then you need to install pulseaudio-module-jack package. It brings interaction between JACK and pulseaudio.
Now, run Qjackctl, open Setup window and remove Realtime tick. Realtime JACK is good for latency but requires much more tinkering to run.
Now, press start. Wait several seconds till JACK starts.
Now, it Ubuntu sound settings choose JACK instead of your soundcard as main audio output.
Open pianoteq, select JACK as audio system to use, restart pianoteq. 
Everything should be working.

Re: Linux, pianoteq and 'system' audio (e.g. youtube)

Barafu wrote:

In Linux, you really should better use jack over pulseaudio for music playing. The setup is very easy.
In Ubuntu, you first install qjackctl package. It will pull the jack itself too. Then you need to install pulseaudio-module-jack package. It brings interaction between JACK and pulseaudio.
Now, run Qjackctl, open Setup window and remove Realtime tick. Realtime JACK is good for latency but requires much more tinkering to run.
Now, press start. Wait several seconds till JACK starts.
Now, it Ubuntu sound settings choose JACK instead of your soundcard as main audio output.
Open pianoteq, select JACK as audio system to use, restart pianoteq. 
Everything should be working.

Thanks for that. So the result would be running both jack and pulseaudio?
I did wonder why 'audio' (in Jack) never offered the option of switching sound 'sources'. This sounds practical .... when using pianoteq, but would seem to require jack even for other than pianoteq output? Is that right?

Re: Linux, pianoteq and 'system' audio (e.g. youtube)

Both JACK and Pulseaudio must capture the device for their exclusive use. They can not share the device. In the setup I described, Pulseaudio will send its sounds into JACK for JACK to play them. If you have two sound cards, you can set JACK to use one and Pulseaudio to use another.
If you are going to use this Linux system for daily practises, it may be a viable decision to turn off Pulseaudio completely, and channel sounds from all applications into JACK through ALSA emulation. This will free you from having to start JACK before playing, but will bring troubles with some other apps. (Wine, for example.?)

Re: Linux, pianoteq and 'system' audio (e.g. youtube)

Barafu wrote:

Both JACK and Pulseaudio must capture the device for their exclusive use. They can not share the device. In the setup I described, Pulseaudio will send its sounds into JACK for JACK to play them. If you have two sound cards, you can set JACK to use one and Pulseaudio to use another.
If you are going to use this Linux system for daily practises, it may be a viable decision to turn off Pulseaudio completely, and channel sounds from all applications into JACK through ALSA emulation. This will free you from having to start JACK before playing, but will bring troubles with some other apps. (Wine, for example.?)

I don't use wine. My need is to play 'system' sounds, e.g. youtube video, with pianoteq? The only device that is being shared (I think) is my audio output?  Do you mean I cannot 'share' the speakers with two sources?
You might gather, I am new to linux sound setup.

Re: Linux, pianoteq and 'system' audio (e.g. youtube)

Lets fix the terminology first. Pulseaudio collects data from different sources - browser with youtube, the piano software, system sounds, the malware that insults you verbally - etc. These are sources. After that it mixes the sound - coverts it all to the same sample rate and sample size, then adds up. Then it pours the resulting mix into one or more sinks - the soundcard, the file, the malware that eavesdrops on you, etc. One sink can serve as a source for another. For example, system-wide reverb is a sink. JACK works the same way.  But their internals are different. JACK starts clipping if it can't provide the proper latency, while Pulseaudio does not care.

So yes, you can not share one sink between Pulse and JACK. However, you can make JACK to serve as a sink for Pulse. Just as you can not share one sink between Pulse and ALSA, and Pulse serves as a sink for ALSA sources.

Last edited by Barafu (15-09-2015 11:49)

Re: Linux, pianoteq and 'system' audio (e.g. youtube)

Barafu wrote:

Lets fix the terminology first. ....

So yes, you can not share one sink between Pulse and JACK. However, you can make JACK to serve as a sink for Pulse. Just as you can not share one sink between Pulse and ALSA, and Pulse serves as a sink for ALSA sources.

So I need both pulseaudio and pulseaudio-module-jack, with jack taking the output of browser/youtube and pianoteq, feeding my (only ) sink, my speakers.

Thanks - I'll have a go at setting that up.

Re: Linux, pianoteq and 'system' audio (e.g. youtube)

Barafu, a question to latency:

Do you have some positive experience with Pianoteq over "jack over pulseaudio" with "removed Realtime tick"?

Thanks

Re: Linux, pianoteq and 'system' audio (e.g. youtube)

I've never tried to plug JACK into Pulseaudio. I see no reason to build such config. I have tried to use pure Pulseaudio with different synthesiers. I have installed and set up a realtime kernel and stuff. But I could not achieve any acceptable latency over Pulseaudio. Even more, it was so late (a 1/4 of a second) that I'm sure it was not the case with videos/games or I would have noticed.
Anyway, I'm satisfied with the setup I described - plug Pulseaudio int JACK.

Last edited by Barafu (15-09-2015 17:53)

Re: Linux, pianoteq and 'system' audio (e.g. youtube)

There are several ways to run jack and pulseaudio at the same time. The simplest is to run pulseaudio as a jack "client", and tell all apps that use pulseaudio to use the "jack-sink" output device, and the "jack-source" input device if they need to record/capture audio.

One way to do this is documented in detail on wikbooks. Personally i like to have my audio stuff independent of the graphic stuff (what's gotten into linux distros lately??) so i run it in a slightly different way, which also allows any user part of the group "audio" to use Pulse (but not jack). Feel free to PM me if you need more help/info.

(yeah, linux audio these days is a mess )

http://soundcloud.com/delt01
Pianoteq 5 STD+blüthner, Renoise 3 • Roland FP-4F + M-Audio Keystation 88es
Intel i5@3.4GHz, 16GB • Linux Mint xfce 64bit

Re: Linux, pianoteq and 'system' audio (e.g. youtube)

The routings described seem to be a bit unclear to me.

I'll try to sort it out:

* Most simple: Pianoteq --> Audio device type: ALSA --> Direct (audio)hardware. (I use this all day)

* Alternatively: Pianoteq --> Audio device type: ALSA --> Pulse Audio Sound Server --> hardware. (Personally I have no use for this and have not tested the latency).

* Additionally qjackctl/jackd can be installed: Pianoteq --> Audio device type: JACK --> hardware. (jack is a low latency audio server and router).

* Additionally pulseaudio-module-jack can be installed: Pianoteq --> Audio device type: JACK --> and then? is audio next routed to Pulse Audio Sound Server?? But I see no other options in qjackctl than without pulseaudio-module-jack? Can someone clarify this?

Thanks!

Re: Linux, pianoteq and 'system' audio (e.g. youtube)

In Linux, there always seems to be many options of accomplishing what one wants.  So another option is to consider using the capabilities and repositories of KXStudio (http://kxstudio.linuxaudio.org/), which is capable of doing what you are asking.  KXStudio is a collection of Linux audio capabilities where a talented software person has set things up to work well with audio.  The repositories can be used with Ubuntu or Debian.  A tool called Cadence (part of KXStudio) makes it easier to control PulseAudio and Jack together or turn PulseAudio off if you don't want it running.

On the question of how things are routing, please see my attempt to diagram it below:

                        Pianoteq -->|
                                           |--> Jack --> ALSA --> Soundcard  --> Speakers
Youtube --> PulseAudio -->|

where ALSA is the software that drives your soundcard, which outputs to your speakers.  Note Pianoteq and PulseAudio are both feeding into Jack (it is hard to draw).  Unfortunately, Youtube (I assume through your browser) does not know how to talk to Jack directly, but does recognize PulseAudio.  Jack is a program that is very good at combining sounds coming from different programs, but the programs have to be "Jack aware," which many audio programs are.  What I wrote down is consistent with Barafu's earlier post and is also one of the ways KXStudio can route the sound.

Re: Linux, pianoteq and 'system' audio (e.g. youtube)

To add a little more, I briefly ran qjackctl on my system and did not see Pulseaudio at all.  I use a program called Catia (part of KXStudio) and can see PulseAudio running there and can reroute it if I want that way.

Re: Linux, pianoteq and 'system' audio (e.g. youtube)

My setup is more like:

Jack apps (such as pianoteq) --> jackd --> alsa kernel drivers --> hardware (This is where pianoteq/renoise/ardour/etc. "pro aduio" software sends audio)
Most apps --> pulseaudio --> jackd (This is where desktop apps ie. browser, and so on, send audio)
Alsa/old apps --> pulseaudio --> jackd (this is where all the other/obsolete apps will "normally" send audio by default.)

Not gonna pollute the forum with any more fancy ascii art here, but you get the general idea

Note that a lot of programs have the option to use one, several, or all of the above options. Also, i could get "slightly" lower latency by sending pianoteq directly to the alsa drivers, but that would completely occupy the sound card solely for pianoteq, and no other apps could play sound.


On my main computer i use this simple script to tell pulseaudio to run its signal through jack - it just needs to be run after jack is ready to process requests. It should be all you need.

For more advanced users: to get jack running at system boot time, ie. before any login prompt appears, i use this script, which i wrote for my particular setup, but if you want to use it and need help with it, just pm me and i'll do my best to help


/* EDIT */ Oops, i totally forgot that linux mint, and some "compact" 32bit distributions, for some reason don't include the two very small and necessary files for this to work: they are called "module-jack-sink.so" and "module-jack-source.so". I extrated them from ubuntu studio, 32 and 64 bit. (version 14.04) Here are the packages: 32bit, 64bit -- or if you prefer plain old tarballs, 32bit and 64bit.

Last edited by delt (17-09-2015 04:35)
http://soundcloud.com/delt01
Pianoteq 5 STD+blüthner, Renoise 3 • Roland FP-4F + M-Audio Keystation 88es
Intel i5@3.4GHz, 16GB • Linux Mint xfce 64bit

Re: Linux, pianoteq and 'system' audio (e.g. youtube)

groovy wrote:

* Additionally pulseaudio-module-jack can be installed: Pianoteq --> Audio device type: JACK --> and then? is audio next routed to Pulse Audio Sound Server?? But I see no other options in qjackctl than without pulseaudio-module-jack? Can someone clarify this?

mwinthrop wrote:

              Pianoteq -->|
                          |--> Jack --> ALSA --> Soundcard  --> Speakers
Youtube --> PulseAudio -->|

@mwinthrop: So pulseaudio-module-jack is the required layer between PulseAudio -->|--> Jack?

delt wrote:

Most apps --> pulseaudio --> jackd (This is where desktop apps ie. browser, and so on, send audio)
Alsa/old apps --> pulseaudio --> jackd (this is where all the other/obsolete apps will "normally" send audio by default.)

@delt: That seems to confirm, that 'pulseaudio-module-jack' is just the necessary glue between pulseaudio and jackd.

PS: Youtube of course can talk directly to ALSA and hardware, it is not mandatory to use sound-servers like pulseaudio or others in between.

Re: Linux, pianoteq and 'system' audio (e.g. youtube)

Using pure ALSA these days is still possible, of cause, but unnecessary oldschool. Nothing to gain over JACK setup except for may be the last 0.05ms of latency, but a lot of configs to write and maintain (hello, dmix!) for everything to play properly.  pulseaudio-module-jack makes Pulseaudio think that JACK is a soundcard, and makes JACK think that Pulseaudio is a single player application. Is it clearer now?

Re: Linux, pianoteq and 'system' audio (e.g. youtube)

Oldschool or not - just Pianoteq and pure ALSA are doing exactly, what I need :-)

Barafu wrote:

pulseaudio-module-jack makes Pulseaudio think that JACK is a soundcard, and makes JACK think that Pulseaudio is a single player application. Is it clearer now?

Yes, that's clearer. I just can't find it represented in my real setup. Just for interest I installed pulseaudio, pulseaudio-module-jack and qjackctl on my workstation.

It is no problem to get sound from Pianoteq -->  Audio device type: ALSA --> Pulse Audio Sound Server --> hardware. (I expected that)

But I can't find an option to connect Pulse Audio Sound Server with qjackctl, as you described (neither in pulseaudio/pavucontrol nor in qjackctl). When qjackctl is running (with realtime option of course), the sound-output from Pianoteq via pulseaudio stops working. Maybe the layer "pulseaudio-module-jack" is not working or has to be configured??

Anyway ... it is not really important for me. I just wondered, if someone really has it working this way.

Last edited by groovy (17-09-2015 22:37)

Re: Linux, pianoteq and 'system' audio (e.g. youtube)

groovy wrote:

@mwinthrop: So pulseaudio-module-jack is the required layer between PulseAudio -->|--> Jack?

If you want to use Pianoteq and hear sound from Youtube at the same time, then pulseaudio linked to Jack using pulseaudio-module-jack is a way to do this.  Not sure if there is another way.  If Pianoteq connected to ALSA is all you need, then perhaps all is good as it is.  I would again recommend looking at KXStudio.  If you were to decide to install it, it could make things easier.  It did for me when I was new to Linux.

Re: Linux, pianoteq and 'system' audio (e.g. youtube)

You configure it not in jackctl, but in system settings - audio or in pavucontrol

Re: Linux, pianoteq and 'system' audio (e.g. youtube)

I found a solution on my Debian/Jessie to force pulseaudio to use jackd (if needed).

Short answer:
Click the option "Enable D-Bus interface" in qjackctl. :-)

Long, descriptive answer:
Per default Debian has a pulseaudio config (/etc/pulse/default.pa), that tries to autodetect a running jackd soundserver:

 
### Automatically connect sink and source if JACK server is present
.ifexists module-jackdbus-detect.so
.nofail
load-module module-jackdbus-detect channels=2
.fail
.endif

But for this autodetection to work, jackd needs to be connected to the D-Bus.
http://www.freedesktop.org/wiki/Softwar.../#index9h2

Then in the pulseaudio Volume Control window (pavucontrol) a new "Jack sink" appears, which can be assigned to the "ALSA plug-in [Pianoteq 5].

The final routing is now:

Pianoteq --> Audio device type: ALSA --> Pulse Audio Sound Server --> pulseaudio-module-jack --> jackd (RT) --> soundcard.

cheers

Last edited by groovy (18-09-2015 22:05)