Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SuperBoucle losing jack connections #64

Open
manucontrovento opened this issue Nov 2, 2019 · 30 comments
Open

SuperBoucle losing jack connections #64

manucontrovento opened this issue Nov 2, 2019 · 30 comments

Comments

@manucontrovento
Copy link
Contributor

Hi everyone! I'm new to SuperBoucle and I'd like it to become my best friend on stage.. I switched to Linux for my audio production for almost every step, except for live-looping... I tried Bitwig but it doesn't recognize my akai apc key 25; I like LuPPP but important features are missing.. I like SuperBoucle and I hope it will replace Ableton Live, and to definitively uninstall Windows from my pc...

The issue is: after a while, after some switching clips on/off, SuperBoucle is not playing anything anymore. When I check Jack connections, I find out that connections are "vanished". SuperBoucle is still listed among Jack applications but not connected anymore to system inputs and outputs.

What could I check? The problem happens with 1.1.0 and 1.2.0 versions both.

Greetings from Italy
Manu

@Vampouille
Copy link
Owner

Hello @manucontrovento, thanks for this report. It is weird because superboucle only manage connections at startup: it connects superboucle main output to the system output (first 2 channels). * Do you see some xruns when connections disappear ?

  • Are you able to reproduce this bug ?
  • What is your latency ?
  • Can you increase the buffer/lantency of the jack server and retry ?

@manucontrovento
Copy link
Contributor Author

Hello @Vampouille I just tested (and reproduced) the issue.

  • I start Jack at usually 512 samples (but then I tried with 256, 1024 and 2048)
  • I start a2jmidid
  • I start SuperBoucle (and outputs and inputs automatically connect to system)
  • I connect AKAI midi keyboard in JACK connections
  • I load a song (connections are still there and pads correctly light on, according to the song)
  • I press PLAY... on screen or on AKAI controller transport either... and...

...connections disappear, and it is not possible to restore them... like they are "busy"

Now I paste the screenshots. Song loaded:

immagine

Pads on AKAI are correctly set:

immagine

I arm some clips for playing:

immagine

and on controller, it's correctly managed:

immagine

and then, pressing PLAY, connections are lost:

immagine

At first I thought it was because of my midi controller or some a2jmidid inetgration issues, but then I found out that the problem is always happening now, even without controller connected and without starting a2jmidi.

Thank you,
have a nice time
Manu

@Vampouille
Copy link
Owner

Ok it's very strange, thanks for this detailed report. It's always nice to see superboucle light up an AKAI in Italy :-)
I will try to reproduce this.
The only workaround or test I can find is to create a new port in the "port manager" then change the "output" of each clip to the new port. On jack connect the new port to output, then start the song. It can be interesting to see if the new connections also disappear.

@manucontrovento
Copy link
Contributor Author

Hi, I just tried, unfortunately the problem is the same, when pressing Play, the connections between the new port and the output vanish... I can tell you 2 things:

  • I'm quite sure that at first, when I started trying SuperBoucle, this problem was not happening. Now it's happening all the times, so I can't get SB to work anymore. It's like something somewhere is corrupted, maybe something saved in some hidden folder as system application settings. In fact, the problem happens despite of which SB version is running....
  • other jack applications work, connections are not lost, so when this "something" happened, it only affected SB

Bye
Manu

@manucontrovento
Copy link
Contributor Author

Ok it's very strange, thanks for this detailed report. It's always nice to see superboucle light up an AKAI in Italy :-)
I will try to reproduce this.
The only workaround or test I can find is to create a new port in the "port manager" then change the "output" of each clip to the new port. On jack connect the new port to output, then start the song. It can be interesting to see if the new connections also disappear.

Maybe you could add a log file, tracing a bunch of steps, then I could launch the logged version to understand where the connections get lost.

@manucontrovento
Copy link
Contributor Author

Hi everyone! Any news about this issue? At now I'm facing a big change: I'm moving to another house, so I'll continue my tests as soon as possible; is it possible to have a kind of log file to understand what's happening with connections?
Have a nice day everyone

@manucontrovento
Copy link
Contributor Author

Hi everyone,

to solve at his root the problem, I installed a new version of Ubuntu Studio, starting from scratch (i.e. Ubuntu Studio 19.10) to avoid problems due to a "dirty" packages installing situation

Now I get this problem, loading a previous session... and I can't understand what's happening :(

immagine

and obviously the software plays nothing :(

Now, even if nothing plays, audio connections are not lost anymore, but midi connections (in a2jmidid jack section) are still lost

please help me :)

@Vampouille
Copy link
Owner

Sorry for the delay in response. For your connections issue, I added some debug log in a local branch (not pushed), to track connections and disconnections. I will send you the now code as soon as possible.
For your last issue, I think it's related to a change in audio lib and #54.

@manucontrovento
Copy link
Contributor Author

@Vampouille thanks, I can't wait to get the new code for logging and also solve last problem.
When you're ready, I'll continue the tests.
I was making a short video tutorial in italian too, to show live looping with SuperBoucle.
As soon as I'll get it working, I'll start enjoying linux live stage music!

@Vampouille
Copy link
Owner

@manucontrovento There is a "debug" branch that you can test. Additionnaly, this branch include a modification on the jack lib used. In debug branch it use jack lib from system so an additional python dependency is required : JACK-Client>=0.4.5
You can install it with a pip3 install -r requirements.txt

https://github.com/Vampouille/superboucle/tree/debug

@Vampouille
Copy link
Owner

@manucontrovento After a careful read of your error message, your song file (*.sbs) seems to be corrupted. The sbs file is a ZIP archive with one metadata.ini file and wav files. The metadata.ini file refer a file called DD_KikSnrA130-04.wav but this file is not part of the ZIP file. Can you decompress the sbs file (right click in a file browser, "extract here") and check if you there is a file called DD_KikSnrA130-04.wav ? I will try to find how Superboucle can generate a metadata.ini that refer a missing file.

@manucontrovento
Copy link
Contributor Author

Hi @Vampouille , I read all and I downloaded the Debug branch
All the listed requirements were satisfied.
Concerning my .sbs song file, actually in the zip archive only the "metadata.ini" file is compressed: all the others .wav files are outside the archive.
I deleted the sbs file, got again from scratch all the .wav files, loaded them into a new SB session, so I created a new .sbs file, but the result is the same: here is how the files are shown in my directory and the .sbs file only contains the metadata.ini:

immagine

Visual composition of the screen in a bit strange too, not showing transport icons and overlapping the labels:

immagine

Errors seem to be listed when loading the song, even if nothing is playing yet:

immagine

And then when I press PLAY, these are the messages, and nothing plays:

immagine

and I couldn't find any log file, or something similar... am I doing well?
Is log file stored anywhere else?

cheers,
Manu

@Vampouille
Copy link
Owner

The issue is the missing wav files in the archive. As a workaround, you can add wav files into the archive so superboucle can find them. I find a way to run superboucle on a ubuntu 19.10. I will try to find why this happens. @manucontrovento Do you record with superboucle or import existing wav files ?

@manucontrovento
Copy link
Contributor Author

manucontrovento commented Dec 3, 2019

Hi @Vampouille
I usually import existing wav files, I haven't tried recording yet.
Tonight I'll try adding the files to the archive.
So, you just need to tell me how to activate or where to find the log concerning the disconnecting of the midi connections...

To try SB on Ubuntu Studio 19.10 without any revolution, you could simply start the Live version of the system, since the same ISO image which can be downloaded for install, can be used for live trying too. Myabe in this case you need to additional download a2midid and some python packages.

have a nice day

@Vampouille
Copy link
Owner

So, you just need to tell me how to activate or where to find the log concerning the disconnecting of the midi connections...

To see logs, you need to run SB in a terminal: open a Terminal and run the superboucle --debug command, logs will appears in the console. Sorry I forgot the --debug option.

@Vampouille
Copy link
Owner

I read carefully the code but Ican't find where a wav file can be forgot. Can explain steps to reproduce this bug ?

@manucontrovento
Copy link
Contributor Author

manucontrovento commented Dec 4, 2019

Hi @Vampouille , I think we are about to close this thread and maybe to open a new one, concerning saving/loading songs in Ubuntu 19.10... I will explain:
now the problem of losing jack/midi connections isn't happening anymore, finally. I don't know what could have changed at some point on my previous Ubuntu system. Now, after installing 19.10, audio / midi finally seem to work!
I have to say that just to give it a try, I started latest main version and not the debug one.
I put all .wav files in the song zip, and now the song opens, and I can play it with my midi controller.

but, if I want to save the changes, when saving some errors occurr (they seem to be the same, concerning the zip managing):

immagine

After that, the song seems "corrupted" again, and loading it, it doesn't work anymore. Like before manually adding the files to the song zip.

In fact, zip file doesn't contain the song files anymore:

immagine

Another thing I noticed is that transport icons are not displayed anymore:

immagine

So, not loading icons, and problems saving/loading clip files, maybe something changed, generally, in file managing (loading/saving), something about this 19.10 Ubuntu release
[but it also solved the connections issue... :) ]

manu

@manucontrovento
Copy link
Contributor Author

Hi again , I also tried the --debug version, just to give it a try. But I haven't any additional info about saving/loading clips in a song.
One thing I noticed: sometimes, when loading a song, the pads on the controller are not automatically lighted on anymore. In other words, there are no red-idle clips marked on the controller.
Then , when triggering, the pads gets correctly lighted.

@manucontrovento
Copy link
Contributor Author

Sorry... making some other tests, I still got the disconnection problem... tomorrow I'll try with debug version. And I'll let you know.

@manucontrovento
Copy link
Contributor Author

manucontrovento commented Dec 5, 2019

Hi @Vampouille , here I am.

Unfortunately I didn't reach to reproduce the connections issue, while the saving issue still occurs. Tonight I used the debug version and this are the results:

  • I still manually added the wav files to the song zip sbs file, to open a song

1) first case: No midi controller connected, no a2jmidid started.

this is the text in terminal. there is 1 error, but the song seems to play correctly, without any problem:

qt5ct: using qt5ct plugin
qt5ct: D-Bus global menu: no
port_registration: jack.OwnMidiPort('Super Boucle:input') True
port_registration: jack.OwnPort('Super Boucle:input_L') True
port_registration: jack.OwnPort('Super Boucle:input_R') True
port_registration: jack.OwnMidiPort('Super Boucle:output') True
port_registration: jack.OwnPort('Super Boucle:Main_L') True
port_registration: jack.OwnPort('Super Boucle:Main_R') True
graph_order
port_connect: jack.Port('system:capture_1') -> jack.OwnPort('Super Boucle:input_L') True
port_connect: jack.Port('system:capture_2') -> jack.OwnPort('Super Boucle:input_R') True
port_connect: jack.OwnPort('Super Boucle:Main_L') -> jack.Port('system:playback_1') True
port_connect: jack.OwnPort('Super Boucle:Main_R') -> jack.Port('system:playback_2') True
graph_order
xrun: %sus
xrun: %sus
xrun: %sus
xrun: %sus
qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 1012, resource id: 10736832, major code: 40 (TranslateCoords), minor code: 0
xrun: %sus
xrun: %sus
xrun: %sus
xrun: %sus

  1. connecting my midi controller, and managing it through a2j, there is still the problem that when loading the song, the pads on the controller won't automatically light up anymore, but they light up when triggered and, just in case 1, everything seems to play correctly.

  2. last step is to run Qsynth, connecting it via Jack to the same MIDI controller, so that I can control a virtual synth with piano keys (midi channel Add delete button on clip #2) and the clips in SuperBoucle with pads (midi channel Add a way to move/reorganize clip #1). I think this was the step that yesterday made me lost any connection, but today everything worked....

So, I'm quite sure the problem is still there, since yesterday I saw it happen, but today I wasn't able to reproduce it. (except from saving problems).
What can I do now? I even re-installed my system from scratch to use SuperBoucle :) I really need it.

greetings and best whishes.
Manu

@manucontrovento
Copy link
Contributor Author

manucontrovento commented Dec 6, 2019

By The Way, don't you have a link to let the user to make a donation ? I always make a donation on free software I use :)
I hope to solve soon al there strange behaviours, I can't wait to get on stage!

@Vampouille
Copy link
Owner

now the problem of losing jack/midi connections isn't happening anymore, finally

Really happy to see this ! :-)

xrun: %sus
xrun: %sus
xrun: %sus
xrun: %sus

Some random issue you have like "pad don't light up" may be related to xrun. xrun occurs when jack does not have enough time to process to current sound buffer. So at least one application does not have enough time to generate the audio corresponding to the current timeframe. This also includes MIDI messages send and received.
@manucontrovento What is your current latency and can you try to increase it ? You can find it on qjacktl if you use it or on another frontend application that manage jack server. Try to increase to multiply by 4 the buffer size for example.

I still manually added the wav files to the song zip sbs file, to open a song

I think you find a way to reproduce this bug:

  • Add missing waves in the sbs zip archive
  • Open the sbs archive with sb
  • Change master volume
  • Save
    The saved sbs file cannot be reloaded and does not contains the waves

Can you confirm the steps to reproduce the bug and can you send me the sbs file after adding the missing waves ?

By The Way, don't you have a link to let the user to make a donation ? I always make a donation on free software I use :)

I never had donations and I have no link. If you want to make a donation, I can take look at some donation systems.

@manucontrovento
Copy link
Contributor Author

Hi @Vampouille

yes, increasing the buffer I don't get Xruns anymore.
Setting to 2048 never had xruns, and the output is like this (it seems that an error occurred):

qt5ct: using qt5ct plugin
qt5ct: D-Bus global menu: no
port_registration: jack.OwnMidiPort('Super Boucle:input') True
port_registration: jack.OwnPort('Super Boucle:input_L') True
port_registration: jack.OwnPort('Super Boucle:input_R') True
port_registration: jack.OwnMidiPort('Super Boucle:output') True
port_registration: jack.OwnPort('Super Boucle:Main_R') True
port_registration: jack.OwnPort('Super Boucle:Main_L') True
graph_order
graph_order
qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 990, resource id: 10715969, major code: 40 (TranslateCoords), minor code: 0
port_connect: jack.MidiPort('a2j:APC Key 25 [24] (capture): APC Key 25 MIDI 1') -> jack.OwnMidiPort('Super Boucle:input') True
graph_order
port_connect: jack.OwnMidiPort('Super Boucle:output') -> jack.MidiPort('a2j:APC Key 25 [24] (playback): APC Key 25 MIDI 1') True
graph_order
port_connect: jack.OwnPort('Super Boucle:Main_L') -> jack.Port('system:playback_1') True
graph_order
port_connect: jack.OwnPort('Super Boucle:Main_R') -> jack.Port('system:playback_2') True
graph_order
qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 1525, resource id: 10723959, major code: 40 (TranslateCoords), minor code: 0

Setting buffer to 1024, sometimes an Xrun occurs, but the pads are lighted up correctly anyway.

The reason I set buffer to 512 was to reduce latency, so that if I play live and record my instruments to SB, I feel no latency (about 10 ms)

I can confirm you the steps which produce the saving issue: after saving, wav files are not in sbs zip file anymore.

Output goes like this:

Traceback (most recent call last):
File "/home/manu/Applicazioni/SuperBoucle-Debug/superboucle/gui.py", line 473, in onActionSave
self.song.save()
File "/home/manu/Applicazioni/SuperBoucle-Debug/superboucle/clip.py", line 250, in save
self.saveTo(self.file_name)
File "/home/manu/Applicazioni/SuperBoucle-Debug/superboucle/clip.py", line 290, in saveTo
format='WAV')
File "/usr/lib/python3/dist-packages/soundfile.py", line 313, in write
channels = data.shape[1]
IndexError: tuple index out of range

Here in attachment the .sbs original file and the corrupted one (with no wav)
(just renamed .sbs to .zip)

Test130_original.zip
Test130_corrupted.zip

@Vampouille
Copy link
Owner

The reason I set buffer to 512 was to reduce latency, so that if I play live and record my instruments to SB, I feel no latency (about 10 ms)

i known we need very low latency for live ! SB is written in python and python is not really suitable for a realtime process. One way to improve this is to rewrite the callback in pure C language but it's a lot of work. Anyway, SB seems to work well with "low" lantency but maybe not as low as you want with the current implementation.

Here in attachment the .sbs original file and the corrupted one (with no wav)
(just renamed .sbs to .zip)

Thanks I will test it on my side, and listen some clip ;-)

@Vampouille
Copy link
Owner

@manucontrovento Nice music to make test ;-) I fix the saving for both song and export clip function with 03d19f9. So you can pull last modifications of the master branch and be able to save a song with waves.

@manucontrovento
Copy link
Contributor Author

hi @Vampouille thanks a lot.
Music for test is nice yes, I did some percussive loops and then I used some ready melodic loops. But my goal is to play just music all made by me.

I'll test the master branch as soon as possible.

One question: When increasing the buffer, is it possible that some latency occurs in MIDI notes too?
This afternoon I made some test and I felt like some notes played a bit late
(I usually use Qsynth to play MIDI piano over loops.)

I see a lot of nice functions and of potential in SB, for live looping in Linux is the best app I found till now. Of course, Bitwig is very powerful and complete but very expensive too. LuPPP is nice but many features are missing. SB has more interesting and useful functions and it's more flexible too: a scene can be arranged all over the grid, not only just line per line. So at the moment SB is the best app for my purpose. I'll see what happens with a latency of 512 or 1024 (I usually set to 256).

I'll continue posting my proposal and suggestions

@Vampouille
Copy link
Owner

One question: When increasing the buffer, is it possible that some latency occurs in MIDI notes too?
This afternoon I made some test and I felt like some notes played a bit late
(I usually use Qsynth to play MIDI piano over loops.)

yes the latency is apply to audio and midi

I'll see what happens with a latency of 512 or 1024 (I usually set to 256).

Try to find the best value with a good balance between xruns and latency...

I'll continue posting my proposal and suggestions

Thanks, I think I will work on:

@manucontrovento Can we close this thread ?

@manucontrovento
Copy link
Contributor Author

solved with 10/12/2019 update in master branch

@manucontrovento
Copy link
Contributor Author

Hi @Vampouille
I need to know a little bit more about SB and latency, because I'd like to reduce the buffer size (and latency)
Could you explain me something about the problem, and why xruns affect SB signals exchange with controller and (most of all) break connections?
Some possible workarounds, working with a smaller buffer size (e.g.512 ): maybe it's possible to insert some small time.sleep() statements? when loading songs, of before, or just later? I used this way to solve the problems of:

  • turning devices light on exit (after sending all black color to the device cells I had to wait 1 second for all note-on signals to be processed, otherwise it didn't work)
  • turn on the light on scene button on device (selected = green, all the others = black). To make it work I had to insert a time.sleep() of 0,01 seconds between each note-on to the device, otherwise sometimes it didn't work (maybe signal processing was too fast)

What do you think about it?
Do you think we could improve the latency matter, with this method or in some other way?
Have a nice day

@manucontrovento
Copy link
Contributor Author

@Vampouille hi,
about this topic, in application readme.md, you wrote about a "latency compensation" feature.-.
could you briefly explain how it works?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants