Record audio with the button

Most likely yes. You should really just use blokas-jack apt package (installed by default) - it installs jack.service. Customize Jack settings using patchbox or just edit /etc/jackdrc directly to change the command line.

You can do this to get it back on track if it was removed or disabled:

sudo apt install --reinstall blokas-jack
sudo systemctl unmask jack
sudo systemctl enable jack
sudo systemctl start jack

This way it’s compatible with patchbox stuff. :slight_smile:

Hi @Giedrius - it’s possible I removed/disabled it at some point, but now back in place following reinstall. However, it hasn’t resolved the issue jack_capture still not starting properly and exited with code-255 :frowning:

Wondering now whether to just start with a new image of patchboxOS - I’ve not really customised much else…

Hmm, not much more ideas why it wouldn’t work - I did test out the jack_capture.service on my system successfully. :slight_smile:

What is the full outputs of:

sudo systemctl status jack
sudo systemctl status jack_capture

Also check the journalctl of both services too:

sudo journalctl -u jack
sudo journalctl -u jack_capture

Hit the ‘end’ key to see the latest entries. If there’s something relevant, capture the entire log by appending something like > jack.log at the end of the command and post the file here :slight_smile:

Hi @Giedrius thanks for the help, here are the outputs:

sudo systemctl status jack

jack.service - JACK Server
   Loaded: loaded (/lib/systemd/system/jack.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2021-03-09 11:17:14 GMT; 1 day 10h ago
 Main PID: 532 (jackd)
    Tasks: 5 (limit: 2199)
   Memory: 86.8M
   CGroup: /system.slice/jack.service
           └─532 /usr/bin/jackd -t 2000 -R -P 95 -d alsa -d hw:pisound -r 48000 -p 128 -n 2 -X seq -s -S

Mar 09 11:17:16 patchbox jackdrc[532]: ALSA: final selected sample format for playback: 16bit little-endian
Mar 09 11:17:16 patchbox jackdrc[532]: ALSA: use 2 periods for playback
Mar 09 11:17:16 patchbox jackdrc[532]: port created: Midi-Through:midi/playback_1
Mar 09 11:17:16 patchbox jackdrc[532]: port created: Midi-Through:midi/capture_1
Mar 09 11:17:16 patchbox jackdrc[532]: port created: pisound:midi/playback_1
Mar 09 11:17:16 patchbox jackdrc[532]: port created: pisound:midi/capture_1
Mar 10 21:06:43 patchbox jackdrc[532]: port created: pisound-ctl:midi/playback_1
Mar 10 21:06:43 patchbox jackdrc[532]: port created: pisound-ctl:midi/capture_1
Mar 10 21:07:17 patchbox jackdrc[532]: port created: RtMidiIn-Client:midi/capture_1
Mar 10 21:07:17 patchbox jackdrc[532]: port created: RtMidiOut-Client:midi/playback_1

sudo systemctl status jack_capture

 jack_capture.service - osc controlled jack_capture
   Loaded: loaded (/etc/systemd/system/jack_capture.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Wed 2021-03-10 21:21:53 GMT; 5s ago
  Process: 3581 ExecStart=/usr/bin/env sh -c /usr/bin/mkdir -p /home/patch/recordings && exec /usr/local/bin/jack_capture -c 2 --daemon -O 7777 --filename-prefix /home/patch/recordings/ --port system:capture_1 --port system:capture_2 --time_machine --timemachine-prebuffer 300 (code=exited, status=255/EXCEPTION)
 Main PID: 3581 (code=exited, status=255/EXCEPTION)

Mar 10 21:21:59 patchbox systemd[1]: jack_capture.service: Service RestartSec=2s expired, scheduling restart.
Mar 10 21:21:59 patchbox systemd[1]: jack_capture.service: Scheduled restart job, restart counter is at 297.
Mar 10 21:21:59 patchbox systemd[1]: Stopped osc controlled jack_capture.

I don’t think there’s anything of note in the journal, but I’ve attached both here anyway. Thanks!

jackJournal.log (2.2 KB)

jackCapture_journal.log (290.4 KB)

Output like this in the log indicates that it may have failed to parse the command line arguments:

Mar 10 21:24:06 patchbox env[3882]: To record what you hear, just run
Mar 10 21:24:06 patchbox env[3882]:      jack_capture
Mar 10 21:24:06 patchbox env[3882]: To list advanced options, run
Mar 10 21:24:06 patchbox env[3882]:      jack_capture --advanced-options (or --help2)

Looks like there’s --time_machine instead of --timemachine argument. Please try again after removing the underscore.

@Giedrius, yikes, oh dear! Poor from me, well spotted. That’s it. Works just fine now, thanks!

One last thing in setting up is using Rclone to back my recordings folder up to Google drive. Going to play around with that and then post the results /steps involved here. I’ve already got rclone working from the terminal, just looking at the button script…

2 Likes

Argh, disaster. Got everything working and now seems to be something up with the button. It’s stopped clicking! How many clicks are the buttons supposed to be good for?!

Hey, it’s more likely the click script ends with a blocking command, getting the pisound-btn daemon stuck waiting for the script it ran to end than for the button to wear out. :slight_smile:

The script should only start software in the background, this is achieved by placing a & at the very end of the last line. Of course you’d have to handle the background process you just started when executing the script again properly.

Just in case, you may post the script you currently have here so we can see if this is really the case.

@Giedrius, no I don’t think it’s a software issue, both button scripts were working fine for about an hour. I mean the button seems to have physically stopped clicking. It felt like it was stuck so I’ve taken the case apart, and made sure the plastic button was seated correctly, but now won’t click anyhow. About one time in 10 it works for button presses, but it’s quite erratic. Is this likely? Is it enough to replace?

When it stops responding, what is the output of:

sudo systemctl status pisound-btn

Also, try running:

sudo systemctl restart pisound-btn

Does it make the button work at least for once again?

sudo systemctl status pisound-btn gives me

patchbox sudo[4950]: pam_unix(sudo:session) : session opened for user root by (uid=0)

To clarify, the button will work if I press really hard, and my scripts will launch but not everytime. I’ve got the button set up so that one clock launches the start recording script, and a 1 second hold launches the script to stop jack _capture

I need to press really hard for this to happen. The very definite click that used to be they’re when I pressed the button is gone, so definitely feels like a hardware problem.

Hmm, that’s odd, we haven’t heard yet of the button breaking for anyone. :slight_smile: It’s this button:

Any equivalent sized SMT ‘normally open’ button would work.

Replacing it would be quite straightforward for someone who has desoldered electronics before, the area around it is quite open.

Yeah, I’m surprised too, more so at the timing, just as I’d got the scripts working! :frowning:

Button is meant to be good for ‘300000 cycles’ - pretty sure I’ve not gone anywhere near that though…

The universe just keeps on spicing things up with challenges and obstacles. :slight_smile:

We could do the button replacement for you, but I suspect you could sort this out quicker by sourcing parts locally and repair yourself (or have some friend do it), and probably for lower cost than it’d end up costing to ship it to us.

Just let us know how we could help. :slight_smile:

1 Like

Hello! I’ve been trying to implement a super basic version of this - thank you everyone for your contributions!
@Giedrius - I have this super weird issue. Everything works well, but whenever I try to record something new - there is a significantly long silence before the recording comes through. 5s or 10s or 15s. Keeps increasing for every new file that I record. I am a complete linux noob and happy to share what I’ve done!