Menu

Jack hangs frequently, and possible conflict with Audacity

2020-07-10
2020-07-24
1 2 > >> (Page 1 of 2)
  • Ben McDonnell

    Ben McDonnell - 2020-07-10

    Tonight after getting an “unable to connect” message in the jamulus mixer window, I noticed that I was again getting XRUNs.
    Once this happens I am unable to stop Jack properly. Sometimes it apparently stops after a long wait, but then it won’t start properly, the windows open but there are no graphics inside. So I have to do a reboot.

    Usually I can connect to servers normally, but once I get a “unable to connect” in the jamulus mixer window then I find I cannot close qjackctl.

    I can run Audacity, if I start it after I have connected to a server. If I stop recording but leave it open, then shut everything else, then export the Audacity recording and close Audacity, I can restart everything up normally.

    But if I stop Audacity recording, leave qjackctl and jamulus open while I export the recording, at the moment I close Audacity, all sound from the jamulus server stops, and although if I disconnect and remake connections in the qjack connections window, I can connect to a server; all sound is distorted, I may even be affecting what other players can hear, and I have to close down, and that means qjack will have hung again and I have to restart. The distortion probably has a name to it, it sounds like very short segments of sound are repeated or echo very quickly, like 10 times per second.

    So Audacity is something to do with it but not the only problem

    Screenshots attached are one good qjackctl start and one good close, but I’m afraid I lost count of what was happening when I took the others

    Linux Mint 19.2 Cinnamon
    AMD Ryzen 2200 cpu with onboard Radeon graphics
    Gigabyte mobo B450 Aorus M

     
  • Gilgongo

    Gilgongo - 2020-07-11

    Hi Ben - not sure what the cause of this problem is exactly but it does sound like Jack is getting confused in some way, or it's a symptom of the XRUNs, which might be caused by something else (eg the sound card not being able to keep up - you're using the onboard sound interface I take it). Can you post a shot of your QJackctl settings?

    EDIT: Just seen this thread. I think you may need to use a dedicated audio interface if you want to record and run Jamulus at the same time, as it may be that the onboard audio can't handle the scene. BTW if you have cotrol of the Jamulus server, you can record an Audacity compatibe format with that natively and ditch all the client side stuff if you want.

     
    👍
    1

    Last edit: Gilgongo 2020-07-11
    • Ben McDonnell

      Ben McDonnell - 2020-07-11

      Gilgongo asked for this screenshot. I am now using the Focusrite Scarlett gen 3 2i2. I haven't noticed any improvement over the previous interface I used, which was a zoom r 16 mixer in Audio I/O mode. I first posted in the hardware section.
      How do you record by the jamulus server?

       
      • Gilgongo

        Gilgongo - 2020-07-12

        How do you record by the jamulus server?

        The server must be started with the -R command line option and given a path to a directory to store the recordings. See the documentation here.

        BTW what happens if you put Frames to 128 in QJackctl? Does the problem become worse?

        Also, it may be worth testing JamulusOS on the machine (booting from a USB key) instead. You should be able to install Audacity temporarily on it. If you get the same issues it may be a hardware problem you're having.

         
        👍
        1

        Last edit: Gilgongo 2020-07-12
  • Ignotus

    Ignotus - 2020-07-11

    As I said in another thread, you need to add yourself to the 'audio' group.

    Try this:

    • Uninstall qjackctl
    • Download and install the deb package for the KXstudio repository: https://kx.studio/Repositories
    • Reload your software sources in Synaptic or whatever you use.
    • Install Qjackctl again. You'll be prompted to enable realtime use; click 'yes'.
    • Add yourself to the 'audio' group. Google it, it's quite simple.
    • Install a lowlatency kernel from the repositories, or if you're feeling adventurous, try this one - it's done wonders for me: https://liquorix.net/
    • Reboot.
      You should now get significantly better performance out of Jack.
     
    👍
    1
    • Ben McDonnell

      Ben McDonnell - 2020-07-11

      Ignotus, I will try to do what you recommend
      First of all though, thank you for reminding me of the previous thread you helped me in. I am sorry to say that I couldn't work out what these "groups" were, how they worked, nor whether I was in one or not. From the attached screenshot, am I in the audio group, how did I come to be in it and how will it help me? The only guides I can find online are way above my head.

      In the screenshot is a list of the groups I am in. For example I am checked for admin and audio, but I am not in avahi and bluetooth. There is a list of about 80 groups and I am in 8 of them. Is this audio group a global list open to any linux user in the world, or is it a group that only exists on my computer?

       

      Last edit: Ben McDonnell 2020-07-11
  • Ignotus

    Ignotus - 2020-07-11

    I've always had to add myself manually to the audio group (I also use Mint), so unless someone or some application did it for you, I find it strange that it would already be done. I'm using the MATE version so maybe the menus are a bit different (what I see in 'Users and Groups' is quite different). There should be an option to 'Manage groups', which shows a list of the groups. Scroll to 'audio' and see if its box is checked. Just make sure it is.

    A quicker way is with the command line: sudo adduser <username> audio

    Being in the audio group basically lets audio stuff run with realtime permissions when executed by that user (you).

     
    👍
    1

    Last edit: Ignotus 2020-07-11
  • Ben McDonnell

    Ben McDonnell - 2020-07-11

    Sorry, we crossed posts, I just did an edit

     
  • Ben McDonnell

    Ben McDonnell - 2020-07-11

    I do use synaptic, but what is meant by "reloading your software sources"?
    I am already in the Audio group, should I leave it first and rejoin in sequence?
    How do I find a low latency kernel? I have gone badly wrong with kernels before and once deleted my entire system, so no, not feeling particularly adventurous. I am really mystified by all this, don't mean to sound negative, I will give it a try, but where did that 35ms delay go? Why didn't I experience it on the same internet provider when I used jamkazam on my Windows 10 laptop?

     

    Last edit: Ben McDonnell 2020-07-11
  • Ben McDonnell

    Ben McDonnell - 2020-07-11

    BTW under the users tab in that screenshot, I am in "audio" and about 7 others, but under the "gropups" tab, the same list of groups is presented, but not one of them is checked. I don't understand that.

     
  • Ben McDonnell

    Ben McDonnell - 2020-07-11

    wrt realtime scheduling, in my qjackctl setup window, it is already checked. Does that imply that any of the above does not need to be done?

     
  • Ignotus

    Ignotus - 2020-07-11

    > I do use synaptic, but what is meant by "reloading your software sources"?
    Just click on 'Reload'.

    > I am already in the Audio group, should I leave it first and rejoin in sequence?
    Just leave it if you're already in it.

    > How do I find a low latency kernel?
    Use the search button in Synaptic and search for 'linux-lowlatency'. Install the one ( there will be several, go for the one with the latest version number) that says 'image'.

    > I will give it a try, but where did that 35ms delay go?
    Hard to say, but my guess is your jitter buffer/sampkles/buffer are too high but you can't bring them down because Jack has a hard time operating in realtime mode. But that's my uneducated guess.

    > but under the "gropups" tab, the same list of groups is presented, but not one of them is checked. I don't understand that.
    If you can check the audio group, do it. That would mean you weren't actually in it. Log out and back for it to take effect.

    > wrt realtime scheduling, in my qjackctl setup window, it is already checked. Does that imply that any of the above does not need to be done?
    No, you'd still have to do the above.

     
    👍
    1

    Last edit: Ignotus 2020-07-11
  • Ben McDonnell

    Ben McDonnell - 2020-07-11

    The kxstudio installer told me that I already had the “same version is already installed” of the kxstudio-repos.
    What does it mean if you have a repository installed? I can’t find any program on my system called kx.studio. And why do I need it?

    I clicked on reload in Synaptic. I didn’t select any packages. Hope that is what I should have done

    I wasn’t prompted to enable realtime, it as already checked

    I got up to installing the low latency package but when I clicked on it this was displayed
    “You likely do not want to install this package directly. Instead, install
    the linux-lowlatency meta-package, which will ensure that upgrades work
    correctly, and that supporting packages are also installed.”

    I don’t know what this means
    I can’t find any more about how to install the meta-package. Do you know what I should do or shall I ask on a general forum?

     
    • Gilgongo

      Gilgongo - 2020-07-12

      I got up to installing the low latency package but when I clicked on it this was displayed

      I'm not familiar with Linux Mint, but if it's based on Ubuntu, then that message may be referring to this explanation.

       
      👍
      1
  • Ben McDonnell

    Ben McDonnell - 2020-07-12

    to Gilgongo
    Re 128, my problem in this thread is hangs and possible conflicts with Audacity but I posted in Hardware that since I got my Focusrite I have had trouble with settings and cannot set below 256 anyway as it chops up all the sound output.
    Thank you for the link to low latency explanation, will try that now.
    One guy in the other thread thinks it is not solvable by low latency kernels and my cpu may not be coping, but I posted him back a screenshot of cpu in system monitor, which seemed OK.
    Anyway, I'll look at that link, we will see what works......

     
  • Ignotus

    Ignotus - 2020-07-12

    The kxstudio installer told me that I already had the “same version is already installed” of the kxstudio-repos.
    What does it mean if you have a repository installed? I can’t find any program on my system called kx.studio. And why do I need it?

    That would mean it's already installed. A repository is a place where software is stored and can be retrieved and installed. When you install stuff using Synaptic, you're getting it from Mint's or Ubuntu'st repositories. The KXstudio repository contains software that isn't necessarily available through the 'official' channels, specialising mainly in audio software. When you add this repository you're enabling access to the software it contains. Sometimes 3rd party repositories can cause dependency problems but in this case it's safe - I've been using it with Mint for years and never had any problems. What I find puzzling is that you already had it installed, as this is only possible if someone explicitly does it - it doesn't come enabled in Mint.

    As for the meta package, just locate it and install it, you're not going to break anything.

    I also doubt the CPU is the problem. I've used the Scarlett with far weaker PCs and could get low latency no problem.

     
    👍
    1

    Last edit: Ignotus 2020-07-12
  • Ben McDonnell

    Ben McDonnell - 2020-07-12

    Ignotus, I still don't understand.
    As for the meta package, just locate it and install it,
    How/where do I locate it? I typed "linux-lowlatency meta-package" into the synaptic search box and it just came up with the same result and message.

    Wrt kxstudio, I remember going through this youtube video at some stage near the beginning of my jamulus adventure
    https://www.youtube.com/watch?v=E6LuvdDEqCA
    so I must have got as far as I did with kxstudio according to that video, but never got any further.
    Have I got the following correctly: A software repository can be either on for example Mint or Ubuntu servers, or it can even be on the users computer. So I now have the kxstudio repository on my hard drive. So far I don't know where it is, but presumably it takes up less space as a repository for uninstalled programmes than all the programmes would take after they were installed from that repository?
    So why is it that I am advised to just install the repository rather than actually install and use the programs? I have no idea what these programs actually are or whether I will need them, right now I just want to jam live on jamulus.

     
    • Gilgongo

      Gilgongo - 2020-07-13

      If things are getting complicated, I would try using Jamulus OS. If you get the same issues with that then you have a hardware issue. If you don't then it's a software one. You may in fact decide to run it permanently.

      https://sourceforge.net/projects/jamulus-os/

       
  • Ignotus

    Ignotus - 2020-07-13

    I agree that this may be getting too complex and frustrating - I apologise if I've been adding to the confusion.

    If you can 'kind of' get Jamulus running for now you might want to wait until this is released: https://discourse.ardour.org/t/deb-file-to-optimize-linux-mint-to-use-in-proaudio/104368
    It's a .deb package that will do all the tweaks I've been suggesting (and more) without any of the hassle - just a couple of clicks. Bookmark that page and check in once in a while to see if it's been released. It might be better to start with a clean install of Mint but I don't think there should be any problems if you don't.

     

    Last edit: Ignotus 2020-07-13
  • Ben McDonnell

    Ben McDonnell - 2020-07-13

    Ignotus: I very much want to complete your list and had finished every stage except the low latency kernel which I would have done if not for that message about meta packages. I hope you can give me a push in the right direction there, there is other info about this on the net but I would prefer to do it via synaptic if at all possible. I am determined to get this done somehow.

    You haven’t added to the confusion, it’s just that there was more new ground to cover than I had thought.

    Gilgongo, I have the jamulus OS and wondered if running the hardware test would reveal anything, the more I do the more I can find out, but would prefer to sort out this meta package issue first.

    The deb package in Ignotus’s link looks great.

     
  • Ignotus

    Ignotus - 2020-07-13

    I've attached a screenshot of what I see in Synaptic when I do a search with 'linux-lowlatency'. You mark the one highlighted, click on 'apply' and it prompts you to install some additional packages - you accept and that's it.

     
  • Ben McDonnell

    Ben McDonnell - 2020-07-13

    Thank you Ignoto and Gilgongo, I think I have finally made some progress.

    The screenshot of the Synaptic window showing which kernel to install was useful.
    I have completed Ignotus’s list now. Now with buffer set at 128 the sound from other jammers is not breaking up. I have had no hangs so far, even after opening and closing Audacity.

    “Install the one ( there will be several, go for the one with the latest version number) that says 'image'.”

    Your screenshot pointed to a different one. I still don’t fully understand but I installed the one in your screenshot and it worked.

    Previous kernels I used were 5.30.51 generic, which is still the default kernel. I have 5 seconds to interrupt the grub menu and chose the lowlatency kernel, linux 4.15.0.109 lowlatency.
    I am now being offered an update: Linux 4.15.0-109.110 but when I click to install, all the packages it says will be installed are generic, not lowlatency. Do I need to do anything to make sure I get the right updates?

    I am still getting about 27ms latency loss unaccounted for
    EG my buffer delay 5ms, ping to jamulus server 10ms, overall delay 42ms,
    42 -(10 + 5) = 27
    My own ping to server is 9ms on a speed test.

    Could you help me with the next issue?
    I have been advised to check that request Realtime is selected in qjackctl, which it always is. However from what I have found in this jackaudio page:
    https://jackaudio.org/faq/linux_rt_config.html
    it seems that “many if not most Linux distributions do not allow applications run by ordinary users to request RT scheduling by default”
    including mine, as in jack messages I am getting the error:
    "cannot use real-time scheduling (RR/10)(1: Operation not permitted)"

    A 3 stage procedure is given to fix this, which I could manage, but is it necessary? I have seen posts which imply that RT scheduling and linux lowlatency kernels are alternatives

     
  • Ignotus

    Ignotus - 2020-07-13

    I am now being offered an update: Linux 4.15.0-109.110 but when I click to install, all the packages it says will be installed are generic, not lowlatency. Do I need to do anything to make sure I get the right updates?

    I don't know why it wants to install that kernel (maybe you have more 4.xx kernels installed) but it's not going to remove the lowlatency one, for which you don't have to do anything to receive updates for it.

    I am still getting about 27ms latency loss unaccounted for
    EG my buffer delay 5ms, ping to jamulus server 10ms, overall delay 42ms,
    42 -(10 + 5) = 27
    My own ping to server is 9ms on a speed test.

    What are the jitter buffers set to in Jamulus? You're not taking that into account for your calculation and it could be where those missing ms are.

    it seems that “many if not most Linux distributions do not allow applications run by ordinary users to request RT scheduling by default”
    including mine, as in jack messages I am getting the error:
    "cannot use real-time scheduling (RR/10)(1: Operation not permitted)"

    When you install QJackCtl and Jack2 from the KXstudio repos, step 1 in that guide gets done for you. Step 2 is adding your user to the audio group, which I'm not sure you've actually done (hence the error message in Jack). Just to make sure you can just type in this command:sudo adduser <username> audio, replacing 'username' with your user name. A lowlatency kernel by itself will not solve this, these are things you have to do yourself.

     

    Last edit: Ignotus 2020-07-13
  • Ben McDonnell

    Ben McDonnell - 2020-07-14

    I've been all day trying to get that lowlatency kernel to boot by default, I think I have succeeded by a very simple solution of adding two lines to the /etc/default/grub file. But that's by the by.

    I note what you say about updates, thank you

    Jitter buffer
    Local is 3, server is 5

    In terminal I got this
    ben@ben-B450-AORUS-M:~$ sudo adduser ben audio
    [sudo] password for ben:
    The user ben' is already a member ofaudio'.
    ben@ben-B450-AORUS-M:~$
    So you are saying that it would be good to go back to that guide and go through those steps t run with RT scheduling as well? OK, I will try to use kxstudio to do that, but should I uninstall qjackctl and leave the audio group first?

     
  • Ignotus

    Ignotus - 2020-07-15

    Here's a handy graphical tool for organising the boot menu: https://tipsonubuntu.com/2018/03/11/install-grub-customizer-ubuntu-18-04-lts/

    The jitter buffer setting is where your 'missing' ms are.

    I may be wrong in how I calculate this (someone please correct me if I am so I'm not spreading misinformation) but this is how I think you arrive at those 42 ms:

    • 10 ms to Jamulus server.
    • Local + server jitter buffer = (3 + 5) * 2.67 (jack latency per period/buffer) = 21.36 ms
    • Jack latency (works in asynchronous mode by default which adds another period) = 5.33 + 2.67 (extra period) = 8 ms

    So, 10 + 21.36 + 8 = 39.36 ms. Still 3 ms unaccounted for (probably interface hardware; jack doesn't show you the actual real world latency) but pretty close.

    The goal would be to use a 64 buffer size in Jack and enable 'use small buffers' in Jamulus. This would lead to a significant drop in overall latency. Also try to lower the jitter buffer settings if you can.

    It's confirmed you're in the audio group so you can leave that be - you don't need to touch that any more.

    If you installed Jack (and QjackCtl) after enabling the KXstudio repository then the tweaks in that guide have already been applied. If not, uninstall/install them again. In any event, you don't need to edit those files in the guide because it's done for you.

    The last couple of things I can suggest is to start Jack in synchronous mode (I've added a screenshot showing how to do it; write what's highlighted in blue in that field) and set the CPU governor to performance mode. You can do this by right-clicking on the panel -> add to panel -> CPU Frequency Scaling Monitor. After adding it, left click on it and you should get a menu with the performance modes -> click on 'performance'. You have to do this each time you boot the PC to use Jamulus because it defaults to 'ondemand' at boot.

    If after all this you can't get jack down to a buffer size of 64 without xruns I really don't know what to suggest other than trying the Liquorix kernel, which in my experience outperforms the lowlatency kernel by far. You just have to type the following in a terminal and you won't break anything:

    sudo add-apt-repository ppa:damentz/liquorix && sudo apt-get update

    sudo apt-get install linux-image-liquorix-amd64 linux-headers-liquorix-amd64

    It gets constantly updated so once in a while you have to uninstall the old versions via Synaptic, otherwise you end up with a huge list of kernels that just take up hard disk space.

    I have a 14-year-old Compaq laptop (1.86 ghz core duo) that can run Jack at 64 (and lower) without breaking a sweat so I doubt CPU horsepower has anything to do with it. As I said elswhere, trying different USB ports can also make a big difference.

     
    👍
    1

    Last edit: Ignotus 2020-07-15
1 2 > >> (Page 1 of 2)
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.