I have an app that uses electron. I want to snap it. I have the following problem with the audio. I use sox in the app, but in the snap the program cannot find the sox executable, or it calls it inappropriately, I am not sure which one. Otherwise my app seems to work.
I can run the program with ‘npm run start’, and I can get the flatpak system to containerize the app, and it works mostly from there too. I feel I am doing something simple wrong. My host system is ubuntu 22.04.
$ DEBUG=record gpt-etc
I get this error.
Gtk-Message: 10:48:46.984: Failed to load module "colorreload-gtk-module"
Gtk-Message: 10:48:46.984: Failed to load module "window-decorations-gtk-module"
[54366:0529/104854.279497:ERROR:sandbox_linux.cc(377)] InitializeSandbox() called with multiple threads in process gpu-process.
record Started recording +0ms
record {
record sampleRate: 16000,
record channels: 1,
record compress: false,
record threshold: 0,
record thresholdStart: null,
record thresholdEnd: null,
record silence: '10.0',
record recorder: 'sox',
record endOnSilence: false,
record audioType: 'wav',
record sampleRateHertz: 16000,
record verbose: false,
record recordProgram: 'rec'
record } +1ms
record sox --default-device --no-show-progress --rate 16000 --channels 1 --encoding signed-integer --bits 16 --type wav - +4ms
record Recording ended +241ms
record STDERR: sox FAIL sox: Sorry, there is no default audio device configured
record +11ms
sox has exited with error code 1.
This is part of my snapcraft.yaml file.
apps:
#sox:
# command: sox
gpt-etc:
command: gpt-etc/gpt-etc --no-sandbox
extensions: [gnome-3-38]
plugs:
- browser-support
- network
- network-bind
- pulseaudio
- alsa
- audio-record
- audio-playback
environment:
# Correct the TMPDIR path for Chromium Framework/Electron to ensure
# libappindicator has readable resources.
TMPDIR: $XDG_RUNTIME_DIR
LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/usr/lib
parts:
#sox:
# plugin: autotools
# source: https://sourceforge.net/projects/sox/files/sox/14.4.0/sox-14.4.0.tar.gz/download
# source-type: tar
gpt-etc:
plugin: nil
source: .
override-build: |
npm install electron electron-packager
npx electron-packager . --overwrite --platform=linux --output=release-build --prune=true
cp -rv gpt-etc* $SNAPCRAFT_PART_INSTALL/gpt-etc
build-snaps:
- node/16/stable
build-packages:
- unzip
stage-packages:
- libnss3
- libnspr4
- sox
- libsox-dev
- libsox-fmt-all
- libpulse0