Raspberry Pi Zero W SunVox and Linux Console Only (Without Xorg)

Multi-platform modular music creation studio
Post Reply
danzigism
Posts: 9
Joined: Sun Sep 17, 2017 11:42 pm

Raspberry Pi Zero W SunVox and Linux Console Only (Without Xorg)

Post by danzigism »

Hey there guys! To satisfy my curiosity I took on the project of getting SunVox to work on a Raspberry Pi Zero W without needing Xorg at all. Since SunVox uses libSDL, in theory it should work in the console without the need of a desktop environment. By eliminating Xorg out of the picture, you can save just a little more of those precious resources on your Pi. Well the good news is, it works great! Albeit, a bit of a lengthy process. The instructions should work for anything running Raspbian Lite.

I made a little video on how to do this along with a link to some written instructions for those that might be interested.

It's also a great tutorial for those that might need to figure out how to use JACK without using Qjackctl and is helpful to understand how a2jmidid and jack_connect play an important role in the whole process.

https://youtu.be/9QP2FGNeSsk

Hope you all have a wonderful day!
pepelnyy
Posts: 13
Joined: Wed Oct 10, 2018 6:27 pm
Contact:

Re: Raspberry Pi Zero W SunVox and Linux Console Only (Without Xorg)

Post by pepelnyy »

This is great work, sir!

But I'm absolutely newbie in linux. I loose two days trying follow your instructions. Today I have successfully starting sunvox. But jackd doesn't see any soundcard (including onboard one) but "arecord -l" does.

I need help! Please! Any way - by SSH, by skype ...
С уважением/WBR
Анатолий/Anatoly
danzigism
Posts: 9
Joined: Sun Sep 17, 2017 11:42 pm

Re: Raspberry Pi Zero W SunVox and Linux Console Only (Without Xorg)

Post by danzigism »

Hey there pepelnyy! Sorry for the delay in getting back to you. If JACK isn't seeing your soundcard, it's possible that the incorrect device parameters are specified in your ~/.jackdrc file. Specifically the attribute "-dhw:2,0". It might be "-dwh:1,0" in your case. But you definitely need to find the correct card and device numbers.

Could you possibly paste your ~/.jackdrc file as well as the output from arecord -l ?
pepelnyy
Posts: 13
Joined: Wed Oct 10, 2018 6:27 pm
Contact:

Re: Raspberry Pi Zero W SunVox and Linux Console Only (Without Xorg)

Post by pepelnyy »

Dear danzigism!
The problem is with dbus. It seems like no dbus is in my system but dbus-1 is. I really don't understand what it means and what I have to do with it.
Thank yoy for your attention!
С уважением/WBR
Анатолий/Anatoly
danzigism
Posts: 9
Joined: Sun Sep 17, 2017 11:42 pm

Re: Raspberry Pi Zero W SunVox and Linux Console Only (Without Xorg)

Post by danzigism »

Ahh ok, that is perfectly fine. You basically need to make sure you edit the /usr/share/dbus-1/system.conf file and create an empty space after any of the ending </policy> tags.

You're gonna create a brand new dbus policy that looks like this below. Ensure that you're using the "pi" user, or change it depending on your system.

Code: Select all

<policy user="pi">
<allow own="org.freedesktop.ReserveDevice1.Audio0"/>
<allow own="org.freedesktop.ReserveDevice1.Audio1"/>
<allow own="org.freedesktop.ReserveDevice1.Audio2"/>
</policy> 
You'll also need to make sure you edit the ~/.bash_profile file located in your home directory that has this line in it:

Code: Select all

export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/dbus/system_bus_socket
Let me know if that works for ya!
pepelnyy
Posts: 13
Joined: Wed Oct 10, 2018 6:27 pm
Contact:

Re: Raspberry Pi Zero W SunVox and Linux Console Only (Without Xorg)

Post by pepelnyy »

Yes! I thought about something like this, but didn't know exactly what to do. Thank you very much!
Now I'm in plane, flying from Sakhalin to Moscow, but at friday evening I will try to do it and will write here about results.
One more time thank you!
С уважением/WBR
Анатолий/Anatoly
danzigism
Posts: 9
Joined: Sun Sep 17, 2017 11:42 pm

Re: Raspberry Pi Zero W SunVox and Linux Console Only (Without Xorg)

Post by danzigism »

No problem my friend. Keep me posted. I'm happy to help out further. We'll get that sucker workin'!
pepelnyy
Posts: 13
Joined: Wed Oct 10, 2018 6:27 pm
Contact:

Re: Raspberry Pi Zero W SunVox and Linux Console Only (Without Xorg)

Post by pepelnyy »

Dear danzigizm!
Sorry for delay, it was really hard days!
Today I took brand new tf-card, flashed it by raspbian-lite and went through your instruction step by step.
I think you could make some changes in it, in some commads it is necessary to add "sudo".
About my progress - now I just couldn't check the MIDI-connection because I don't have my MIDI keyboard with me right now.
Sunvox starts and plays trough my soundblaster. But one thing - when I put audio by Jack I can't change buffer length and can't choose audio device, only "Auto" is suggested. In case of ALSA I have choice of all my audio devices and can change buffer (and latency) and can to choose "JACK" as MIDI input. Will it work?
Thank you!

p.s.: here is output in SSh console if we run Sunvox trough SSH. May be you will see there something that I don't :)

Code: Select all

pi@raspberrypi:~$ /home/pi/sunvox/sunvox/linux_arm_armhf_raspberry_pi/sunvox
SunDog Engine / Aug  3 2018 21:18:13
WM: device start
SDL: softrender enabled
WM: language = ru_RU
WM: screen_zoom = 1
WM: screen_ppi = 110
WM: screen size = 800 x 480
WM: flags SCALABLE OPTIMIZE_MOVE_EVENTS FRAMEBUFFER
WM: system palette init...
WM: initialized
Desired audio buffer size: 256 frames
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jackdmp 1.9.11
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2014 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 70
self-connect-mode is "Don't restrict self connect requests"
Cannot lock down 13589216 byte memory area (Cannot allocate memory)
audio_reservation_init
Acquire audio card Audio1
creating alsa driver ... hw:1,0|hw:1,0|256|3|48000|0|0|nomon|swmeter|soft-mode|32bit
configuring for 48000Hz, period = 256 frames (5.3 ms), buffer = 3 periods
ALSA: final selected sample format for capture: 16bit little-endian
ALSA: use 3 periods for capture
ALSA: final selected sample format for playback: 16bit little-endian
ALSA: use 3 periods for playback
Cannot use real-time scheduling (RR/70)(1: Operation not permitted)
AcquireSelfRealTime error
Cannot lock down 13589216 byte memory area (Cannot allocate memory)
Cannot use real-time scheduling (RR/65)(1: Operation not permitted)
JackClient::AcquireSelfRealTime error
WM: system palette init...
Stack ptr: 0
SunVox v1.9.4c Aug  3 2018 21:18:33; driver: JACK; 32bit floating-point; sample rate: 48000; ARCH: arm; OS: raspberry pi linux
SOUND: sundog_sound_deinit() begin
JackTemporaryException : now quits...
Jack main caught signal 2
SOUND: sundog_sound_deinit() end
SDL: video deinit...
Released audio card Audio1
audio_reservation_finish
Max memory used: 11149747
С уважением/WBR
Анатолий/Anatoly
pepelnyy
Posts: 13
Joined: Wed Oct 10, 2018 6:27 pm
Contact:

Re: Raspberry Pi Zero W SunVox and Linux Console Only (Without Xorg)

Post by pepelnyy »

Hurray!!!
Yesterday evening I had tried to connect MIDI keyboard. And it works. I hadn't enough time for doing full test but at first sight everything is good.
Thank you one more time for your help and for your job!
С уважением/WBR
Анатолий/Anatoly
pepelnyy
Posts: 13
Joined: Wed Oct 10, 2018 6:27 pm
Contact:

Re: Raspberry Pi Zero W SunVox and Linux Console Only (Without Xorg)

Post by pepelnyy »

Troubles came back...
here is output in SSh console if we run Sunvox trough SSH:

Code: Select all

pi@raspberrypi:~/sunvox/sunvox/linux_arm_armhf_raspberry_pi $ ./sunvox
SunDog Engine / Aug  3 2018 21:18:13
WM: device start
WM: language = en_US.UTF-8
WM: screen_zoom = 1
WM: screen_ppi = 110
WM: screen size = 1024 x 600
WM: flags SCALABLE OPTIMIZE_MOVE_EVENTS FRAMEBUFFER
WM: system palette init...
WM: initialized
Desired audio buffer size: 256 frames
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jackdmp 1.9.11
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2014 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 70
self-connect-mode is "Don't restrict self connect requests"
Failed to connect to session bus for device reservation Unable to autolaunch a dbus-daemon without a $DISPLAY for X11

Audio device hw:1,0 cannot be acquired...
Cannot initialize driver
JackServer::Open failed with -1
Failed to open server
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JACK: jack_client_open error 11
JACK: Server app seems not to be running!
Switching to alsa
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM pulse
ALSA ERROR: Can't open audio device pulse: No such file or directory
ALSA: default
ALSA HW Default rate: 44100
ALSA HW Rate: 44100 frames
ALSA HW Buffer size: 512 frames
ALSA HW Period size: 256
ALSA HW Periods: 0
ALSA SW Avail min: 256
ALSA SW Start threshold: 1
ALSA SW Stop threshold: 512
WM: system palette init...
ALSA snd_pcm_writei error: Broken pipe
ALSA EPIPE (underrun)
Stack ptr: 0
ALSA snd_pcm_writei error: Broken pipe
ALSA EPIPE (underrun)
ALSA snd_pcm_writei error: Broken pipe
ALSA EPIPE (underrun)
SunVox v1.9.4c Aug  3 2018 21:18:33; driver: ALSA; 32bit floating-point; sample rate: 44100; ARCH: arm; OS: raspberry pi linux
ALSA snd_pcm_writei error: Input/output error
ALSA xrun_recovery error: Input/output error
SOUND: sundog_sound_deinit() begin
SOUND: sundog_sound_deinit() end
SDL: video deinit...
Max memory used: 9671971
But if I change to ALSA it works. But not possible to change MIDI to JACK...
С уважением/WBR
Анатолий/Anatoly
pepelnyy
Posts: 13
Joined: Wed Oct 10, 2018 6:27 pm
Contact:

Re: Raspberry Pi Zero W SunVox and Linux Console Only (Without Xorg)

Post by pepelnyy »

Need help!
here is output in SSh console if we run Sunvox trough SSH:

Code: Select all

pi@raspberrypi:~ $ /home/pi/sunvox/sunvox/linux_arm_armhf_raspberry_pi/sunvox
SunDog Engine / Aug  3 2018 21:18:13
WM: device start
WM: language = ru_RU
WM: screen_zoom = 1
WM: screen_ppi = 168
WM: screen size = 1024 x 600
WM: flags SCALABLE FULLSCREEN TOUCHCONTROL OPTIMIZE_MOVE_EVENTS FRAMEBUFFER
WM: system palette init...
WM: initialized
Desired audio buffer size: 256 frames
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jackdmp 1.9.11
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2014 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 70
self-connect-mode is "Don't restrict self connect requests"
Cannot lock down 13589216 byte memory area (Cannot allocate memory)
Failed to connect to session bus for device reservation Unable to autolaunch a dbus-daemon without a $DISPLAY for X11

Audio device hw:1,0 cannot be acquired...
Cannot initialize driver
JackServer::Open failed with -1
Failed to open server
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JACK: jack_client_open error 11
JACK: Server app seems not to be running!
Switching to alsa
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM pulse
ALSA ERROR: Can't open audio device pulse: No such file or directory
ALSA: default
ALSA HW Default rate: 44100
ALSA HW Rate: 44100 frames
ALSA HW Buffer size: 512 frames
ALSA HW Period size: 256
ALSA HW Periods: 0
ALSA SW Avail min: 256
ALSA SW Start threshold: 1
ALSA SW Stop threshold: 512
WM: system palette init...
Stack ptr: 0
ALSA snd_pcm_writei error: Broken pipe
ALSA EPIPE (underrun)
ALSA snd_pcm_writei error: Broken pipe
ALSA EPIPE (underrun)
SunVox v1.9.4c Aug  3 2018 21:18:33; driver: ALSA; 32bit floating-point; sample rate: 44100; ARCH: arm; OS: raspberry pi linux
ALSA snd_pcm_writei error: Broken pipe
ALSA EPIPE (underrun)
ALSA snd_pcm_writei error: Broken pipe
ALSA EPIPE (underrun)
ALSA snd_pcm_writei error: Broken pipe
ALSA EPIPE (underrun)
...
...
ALSA snd_pcm_writei error: Broken pipe
ALSA EPIPE (underrun)
SOUND: sundog_sound_deinit() begin
SOUND: sundog_sound_deinit() end
SDL: video deinit...
Max memory used: 8797858
С уважением/WBR
Анатолий/Anatoly
pepelnyy
Posts: 13
Joined: Wed Oct 10, 2018 6:27 pm
Contact:

Re: Raspberry Pi Zero W SunVox and Linux Console Only (Without Xorg)

Post by pepelnyy »

Hi everyone!
Now I have working Sunvox but disconnected MIDI
Here is console output:

Code: Select all

login as: pi
pi@192.168.1.22's password:
Linux raspberrypi 4.14.78-v7+ #1156 SMP Tue Oct 23 14:34:39 BST 2018 armv7l
......
......

Bridge starting...
Using JACK server 'default'
Hardware ports will be exported.
Client name = a2j conflits with another running client
Cannot connect to the server
JackShmReadWritePtr1::~JackShmReadWritePtr1 - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
ERROR: a2j_jack_client_create: Cannot create jack client
ERROR: a2j_start: a2j_new() failed.
ERROR a2j:Oxygen 49 [24] (capture): Oxygen 49 MIDI 1 not a valid port
pi@raspberrypi:~$
С уважением/WBR
Анатолий/Anatoly
Post Reply