LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-30-2015, 04:16 AM   #1
browny_amiga
Member
 
Registered: Dec 2001
Location: /mnt/UNV/Mlkway/Earth/USA/California/Silicon Valley
Distribution: Kubuntu, Debian Buster Stable, Windoze 7
Posts: 684

Rep: Reputation: 56
Cool How to test Jackd server and play sound to test?


Hi,

I'm writing a test script that checks for the function of Linux audio, so it checks Alsa, Pulseaudio and Jackd, if they are available and play a test sound. The output then gets presented in this form:

--------------------------
| |
| ALSA BUSY |
| |
--------------------------
--------------------------
| |
| PULSE AUDIO NOT WORKING|
| |
--------------------------
--------------------------
| |
| JACKD WORKING! |
| |
--------------------------

The working ones are shown in green, the others in red.

Now I can check if Alsa and Pulseaudio are working or not by trying to play a sound file and if that does not work, catching the failure return code.

But I have not been able to do that with jack, as there seem to be no audio players that only work on jack and fail when jack is not available. Mplayer and vlc have a jack module, but when jack is not available, it does not produce an error code.

Strangely enough, there are no official python jackd bindings. I building this in Python and would prefer if I could resolve this by using an external command and not having to build everything from scratch.

Do you know of a sound player that directly interfaces with jack and fails properly when jack is not available for playing sounds?

Once this is done, I might release this script on github, so others can benefit from it, if they run into Linux audio trouble and need reliable troubleshooting.=

Thanks,

Markus
 
Old 04-30-2015, 04:44 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
According to the Jack User Documentation, you need to call jackd and alsa in the same command for jackd to work.

As for the test sound, the Jack doc provides an example which uses ecasound to produce a pure tone to test the sound card.

Extract from Jack User Documentation:
Code:
You can use ecasound to generate a pure sine wave tone for 
testing the sound quality of your device.

ecasound -f:32,1,48000 -i null -o jack_alsa,myport -b:1024 
-el:sine_fcac,440,1
From the Ecasound package description:
Quote:
Ecasound is a software package designed for multitrack audio processing. It
can be used for simple tasks like audio playback, recording and format
conversions, as well as for multitrack effect processing, mixing, recording
and signal recycling.
Jack User Documentation
 
Old 04-30-2015, 09:26 PM   #3
browny_amiga
Member
 
Registered: Dec 2001
Location: /mnt/UNV/Mlkway/Earth/USA/California/Silicon Valley
Distribution: Kubuntu, Debian Buster Stable, Windoze 7
Posts: 684

Original Poster
Rep: Reputation: 56
Thanks, that command sounded perfect. Unfortunately, it does not fail gracefully when the jack server is not running or not available:

Cannot connect to server socket err = Connection refused
Cannot connect to server request channel
Cannot connect to server socket err = Connection refused
Cannot connect to server request channel
Cannot connect to server socket err = Connection refused
Cannot connect to server request channel
Cannot connect to server socket err = Connection refused
Cannot connect to server request channel
Cannot connect to server socket err = Connection refused
Cannot connect to server request channel
Cannot connect to server socket err = Connection refused
Cannot connect to server request channel
jack server is not running or cannot be started
(eca-chainsetup) "rt" buffering mode selected.
(eca-chainsetup) Opened input "null", mode "read". Format: s32_le, channels 1, srate 48000, interleaved.
Cannot connect to server socket err = Connection refused
Cannot connect to server request channel
Cannot connect to server socket err = Connection refused
Cannot connect to server request channel
Cannot connect to server socket err = Connection refused
Cannot connect to server request channel
Cannot connect to server socket err = Connection refused
Cannot connect to server request channel
Cannot connect to server socket err = Connection refused
Cannot connect to server request channel
Cannot connect to server socket err = Connection refused
Cannot connect to server request channel
jack server is not running or cannot be started
Cannot connect to server socket err = Connection refused
Cannot connect to server request channel
Cannot connect to server socket err = Connection refused
Cannot connect to server request channel
Cannot connect to server socket err = Connection refused
Cannot connect to server request channel
Cannot connect to server socket err = Connection refused
Cannot connect to server request channel
^C^C

it just keeps going forever with the error messages.
 
Old 05-01-2015, 03:04 AM   #4
browny_amiga
Member
 
Registered: Dec 2001
Location: /mnt/UNV/Mlkway/Earth/USA/California/Silicon Valley
Distribution: Kubuntu, Debian Buster Stable, Windoze 7
Posts: 684

Original Poster
Rep: Reputation: 56
[solved]

There seems to be no way to play a sound on jack and have it fail, so I check for the existence of the jack process first and then play a sound:

pslist = psutil.get_process_list()

#if we have not found jack, it is off
jack_ok = False


for element in pslist:

if "jackd" in element.name:
jack_ok = True

if jack_ok == True:
#play a test sound
os.system("mplayer -really-quiet -ao jack /usr/share/tuxtype/sounds/harp.wav")

So the script is almost finished, I can't believe how many years I spend constantly troubleshooting my audio setup without every realizing I urgently needed a test-script like this.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Load test, boundary test & stress test for USB EHCI/xHCI driver rama_toshiba Linux - Kernel 5 02-29-2012 02:43 PM
Suse 11.3/i586 Sound Config test works, multimedia test + flash silent? brianpbarnes Linux - Software 3 12-19-2010 12:43 PM
[SOLVED] Silencing the line "echo test > test/test.txt" in a shell script Arenlor Linux - General 2 06-18-2010 01:37 PM
my sound works on boot and shutdown and on test but i cannot get a cdrom to play audi tbrownarcher Linux - Hardware 8 04-10-2006 03:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration