How do I configure JACK audio server to automatically use a specific card? - audio

I'm running Ubuntu 12.04 studio on a HP Pavilion dm1 4200sg netbook. It's pretty much a fresh install. I try to start jackd server by running
jackd -R -d alsa
and it fails with output:
JACK server starting in realtime mode with priority 10
control device hw:0
control device hw:0
audio_reservation_init
Acquire audio card Audio0
creating alsa driver ... hw:0|hw:0|1024|2|48000|0|0|nomon|swmeter|-|32bit
control device hw:0
ALSA: Cannot open PCM device alsa_pcm for playback. Falling back to capture-only mode
Cannot initialize driver
JackServer::Open() failed with -1
Failed to open server
Running aplay -l gives the following output:
**** List of PLAYBACK Hardware Devices ****
card 0: Generic [HD-Audio Generic], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: SB [HDA ATI SB], device 0: STAC92xx Analog [STAC92xx Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
I find that by running
jackd -R -d alsa -d hw:1
jackd starts successfully. I would like to configure my machine so that hw:1 is the default option (i.e. to make the original 'jackd -R -d alsa' command work). Can anyone help me to do this?
I've tried editing ~/.asoundrc to be
pcm.!default {
type hw
card 1
}
ctl.!default {
type hw
card 1
}
but this doesn't seem to work. I'm well out of my comfort zone here and any help would be appreciated. Thanks!

I've found a workaround. It doesn't configure JACK server but alters the order the sound cards are listed.
I first entered into the terminal:
sudo lshw -c multimedia
which showed which modules the two cards were using. They were both using 'snd-hda-intel'.
I then entered into the terminal:
cat /proc/asound/card0/id
cat /proc/asound/card1/id
Which gave ids 'Generic' and 'SB' for cards 0 and 1, respectively.
I then added the following two lines to the end of the file '/etc/modprobe.d/alsa-base.conf'
options snd-hda-intel id=SB index=0
options snd-hda-intel id=Generic index=1
After rebooting the machine, card 'SB' was loaded into position 0 and
jackd -R -d alsa
correctly started.

First, in a terminal window, run this command:
cat /proc/asound/cards.
You’ll see output a bit like this:
0 [SB ]: HDA-Intel - HDA ATI SB
HDA ATI SB at 0xfcef8000 irq 16
1 [DSP ]: H-DSP - Hammerfall DSP
RME Hammerfall DSP + Digiface at 0xfcff0000, irq 20
2 [NVidia ]: HDA-Intel - HDA NVidia
HDA NVidia at 0xfe57c000 irq 32
The “name” of each soundcard is in square brackets.
With this information, you can now refer to a particular device as, for example hw:DSP now you can execute the command:
jackd -d alsa -d hw:DSP
And thats all, taken from:
http://www.jackaudio.org/faq/device_naming.html
EDIT: added code tags

First, open up alsa-base.conf:
sudo gedit /etc/modprobe.d/alsa-base.conf
Find the following line:
"options snd-hda-intel index=-2"
And change it to:
"#options snd-hda-intel index=-2"
Restart your machine and try again. You may have to set the proper sound device (alsa) for your programs.

Related

Debian 9 Dummy Output after resume from suspend (snd_hda_intel codec)

I have an external monitor that I plug-in my Dell laptop after turn it on. The sound works before and after plug it in the Laptop, So the headphone works too, plugin it in and out too. The problem is when I resume Debian after suspend. The sound has gone, and some times when increasing and decreasing volume one of the three options appears in the screen: Headphone unplugged, HDMI output (or something like), or Dummy Output.
I will show now what happens when Dummy Output is displayed and some outputs of commands.
$ lspci | grep Audio
Output:
00:1f.3 Audio device: Intel Corporation Sunrise Point-LP HD Audio (rev 21)
$ lsmod | grep hda
Output:
snd_hda_ext_core 28672 1 snd_soc_skl
snd_hda_intel 36864 0
snd_hda_codec 135168 1 snd_hda_intel
snd_hda_core 90112 4 snd_hda_intel,snd_hda_codec,snd_hda_ext_core,snd_soc_skl
snd_hwdep 16384 1 snd_hda_codec
snd_pcm 110592 6 snd_hda_intel,snd_hda_codec,snd_hda_ext_core,snd_hda_core,snd_soc_skl,snd_soc_core
snd 86016 7 snd_compress,snd_hda_intel,snd_hwdep,snd_hda_codec,snd_timer,snd_soc_core,snd_pcm
$ sudo dmesg | grep snd
Output (when rebooting):
[ 13.341580] snd_hda_intel 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[ 13.461226] snd_hda_intel 0000:00:1f.3: CORB reset timeout#1, CORBRP = 0
[ 13.462799] snd_hda_intel 0000:00:1f.3: no codecs found!
$ sudo alsactl init
Output:
alsactl: init:1757: No soundcards found...
Complete Alsa Information script:
https://alsa-project.org/db/?f=ff03c7d8dac369fc1211822de963b337c132420c
So it looks like the sound card is there but alsa does not recognize it.
Many forums/sites recommend to blacklist snd_hda_codec_hdmi (that would be the case when the problem is with connecting/desconnecting HDMI for the external monitor), and also put a line:
options snd-hda-intel model=generic
in a file, e.g., /etc/modprobe.d/alsa-base-blacklist.conf.
But it didn't work.
Other sites suggest to disable and enable sound in BIOS. Didn't work.
Can anyone help me solve this forever issue?

How to set default microphone on Raspberry Pi 3B with Raspbian Stretch?

So far I have not found any guides on how to set the default USB microphone for Stretch and so I've followed all of the guides for Wheezy and Jessie and they do not work.
Typing in the command arecord sound.wav does not record anything from the microphone. However, if I were to type in this command it would work arecord -f cd -D hw:1,0 -d 10 sound.wav.
Here is what appears when I enter in arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: Headset [Plantronics Headset], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
I've edited this file /usr/share/alsa/alsa.conf and set the values to this
defaults.ctl.card 1
defaults.pcm.card 1
I've also edited the /etc/asoundrc file and changed it to this:
pcm.!default {
type asym
playback.pcm {
type plug
slave.pcm "hw:0,0"
}
capture.pcm {
type plug
slave.pcm "hw:1,0"
}
}
ctl.!default {
type hw
card 0
}
and this:
pcm.!default {
type hw
card 1
}
ctl.!default {
type hw
card 1
}
and it still does not work.
I've been having headaches with this one for about a day, but I finally made it work.
Your .asoundrc should actually look like this:
pcm.!default {
type asym
playback.pcm "plughw:0"
capture.pcm "plughw:1"
}
ctl.!default {
type hw
card 1
}
Otherwise your settings are ok, but I think this command is wrong:
arecord sound.wav
The proper command for testing the mic (or at least the one that works for me) is this:
arecord -D plughw:1,0 --duration=3 test.wav && aplay test.wav
This is setup for a 3 seconds recording and after recording stops it automatically plays back to you (assuming your audio also works).
This part plughw:1,0 points to your mic, which I see is set to card 1.
I you have created this file /etc/modprobe.d/alsa-base.conf during your tests please delete it and reboot your pi.
sudo rm -f /etc/modprobe.d/alsa-base.conf
Also if you have tried this for the AlexaPi project, make sure the service is stopped before you try your mic and audio.
sudo systemctl stop AlexaPi.service

alsa tool arecord not recognizing plughw:1,0 on Arch Linux

Edit: All of this was probably caused by a terribly configured microphone (or a faulty one, I changed laptops and now use Ubuntu instead of Arch Linux, so I actually don't have any idea). To record to a wav file, all I do now is run:
arecord -d $DURATION -f cd -t wav $OUTPUT_FILE_PATH
...replacing $DURATION with the duration of the recording in seconds, and $OUTPUT_FILE_PATH with the path to the desired file to write. I omitted the -D sysdefault argument as it caused problems for me (as with most things, your mileage may vary, so if the command doesn't work for you, try playing with several variables until it works).
Goes without saying, but all of this requires alsa-utils to be installed.
(The original question is left below, for those that still want to see it.)
Tl;dr version: arecord not recognizing plughw:1,0 , nor hw:1,0 , nor anything without the -D option
Whole story: I'm trying to make a simple voice assistant using a Bash script (I don't find Python/Perl easy for me to use, but that's just me). Dialogs are made in Zenity/KDialog. Voice recognition isn't included yet, so one has to type in the phrase/command. For now the program is represented in Spanish, but I plan to have an English version as well.
Doing my research, I found: http://blog.oscarliang.net/raspberry-pi-voice-recognition-works-like-siri/
But it doesn't work correctly on my machine.
[owner#arch-hp-2000-notebook-pc ~]$ ~/test-speech-input
“Recording… Press Ctrl+C to Stop.”
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM “plughw:1,0″
arecord: main:722: audio open error: No such file or directory
“Processing…”
^C
[owner#arch-hp-2000-notebook-pc ~]$
It apparently has to do with the arecord -D "plughw:1,0" -q -f cd -t wav part.
Output of arecord -l:
[owner#arch-hp-2000-notebook-pc ~]$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: Generic_1 [HD-Audio Generic], device 0: ALC269VC Analog [ALC269VC Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
Output of arecord -L:
[owner#arch-hp-2000-notebook-pc ~]$
null
Discard all samples (playback) or generate zero samples (capture)
pulse
PulseAudio Sound Server
default
Default ALSA Output (currently PulseAudio Sound Server)
sysdefault:CARD=Generic_1
HD-Audio Generic, ALC269VC Analog
Default Audio Device
front:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC269VC Analog
Front speakers
surround21:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC269VC Analog
2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC269VC Analog
4.0 Surround output to Front and Rear speakers
surround41:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC269VC Analog
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC269VC Analog
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC269VC Analog
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC269VC Analog
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
[owner#arch-hp-2000-notebook-pc ~]$
Following the first part of the answer by #CharlesDuffy (thanks for the help):
[owner#arch-hp-2000-notebook-pc ~]$ ~/test-speech-input
Recording… Press Ctrl+C to Stop.
Processing…
You Said: [owner#arch-hp-2000-notebook-pc ~]$
Following the new answer, also by #CharlesDuffy (although this system is all AMD I think, no intel):
[owner#arch-hp-2000-notebook-pc ~]$ test-speech-input
Recording… Press Ctrl+C to Stop.
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM CARD=Generic_1
arecord: main:722: audio open error: No such file or directory
Processing…
You Said: [owner#arch-hp-2000-notebook-pc ~]$
Following the newest answer by #CharlesDuffy:
[owner#arch-hp-2000-notebook-pc ~]$
Recording… Press Ctrl+C to Stop.
ALSA lib pcm_dsnoop.c:614:(snd_pcm_dsnoop_open) unable to open slave
arecord: main:722: audio open error: No such file or directory
Processing…
^C
[owner#arch-hp-2000-notebook-pc ~]$
Double-checked the volume of the internal mic, and it seemed to have selected a non-existent mic. Switching to the real mic yielded the same results.
I'm lost right now. Any other ideas? Is there any other command-line voice recording tool that might work or that might be easier to use (at least for me)?
Machine: HP 2000 Notebook PC, Arch Linux, uname -a returns Linux HOST_NAME 4.1.2-2-ARCH #1 SMP PREEMPT Wed Jul 15 08:30:32 UTC 2015 x86_64 GNU/Linux
The plughw:1,0 suggestion is specific to Raspberry Pi hardware, and doesn't necessarily apply elsewhere.
The first thing I'd suggest is removing the -D DEVICE argument entirely.
If that doesn't work, I'd suggest trying:
-D sysdefault
...for your basic on-board audio, as listed by arecord -L.

alsa on embedded system CORE9G25

I have a CORE9G25-CON (256MBRAM) (http://armdevs.com/core9g25.html) device with embedded linux installed on it.
The version of linux is:
# uname -or
3.6.9 GNU/Linux
# cat /etc/os-release
NAME=Buildroot
VERSION=2012.11.1-dirty
ID=buildroot
VERSION_ID=2012.11.1
PRETTY_NAME="Buildroot 2012.11.1
The device is equipped with USB host connector in which I connected an USB-AUDIO interface
The USB interface is recognize by the system
# cat /proc/asound/cards
0 [Device ]: USB-Audio - USB PnP Sound Device
C-Media Electronics Inc. USB PnP Sound Device at usb-at91-1, full speed
# cat /proc/asound/devices
0: [ 0] : control
16: [ 0- 0]: digital audio playback
24: [ 0- 0]: digital audio capture
33: : timer
# ls /dev/snd
controlC0 pcmC0D0c pcmC0D0p timer
I would like to handle the AUDIO interface by using ALSA but this is the error shown on the console by using the simple command aplay -l
# aplay -l
**** List of PLAYBACK Hardware Devices ****
ALSA lib control.c:739:(snd_ctl_open_noupdate) Invalid CTL hw:0
aplay: device_list:226: control open (0): No such file or directory
aplay: conf.c:3095: snd_config_update_free: Assertion `update->count > 0 && update->finfo' failed.
Aborted
I googled for about a week trying to fix the problem but, up to now, i didn't find any solution.
Could you help me to fix the problem ?
Had you other similar experience about it ?
Thank you very much for your help and cooperation
best regards
What does your alsa.conf look like ? do this
locate alsa.conf
typically found at
/usr/share/alsa/alsa.conf
do a google on
audio sound alsa Invalid CTL hw:0
this might get you on the right path
#alsa.conf minimal configuration
ctl.hw {
#args [ CARD ]
#args.CARD {
type string
}
type hw
card $CARD #with 0 alsamixer work, with $CARD alsamixer lend to invalid argument
}

RS232 console communication - set baudrate to 1 MBaud

Within a bash script, I use the following:
$ stty -F /dev/ttyUSB0 921600 raw
$ echo -n "some test data" >/dev/ttyUSB0
and it works as expected.
Using a PL2303 USB to RS232 adapter:
$ lsusb
...
Bus 006 Device 010: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 006 Device 011: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Now I tried to do the same with 1 MBd, but got an error:
$ stty -F /dev/ttyUSB0 1000000 raw
stty: /dev/ttyUSB0: unable to perform all requested operations
Also the same message when I try with 500 kBd. Trying 250 kBd the error message is different:
$ stty -F /dev/ttyUSB0 250000 raw
stty: invalid argument `250000'
Try `stty --help' for more information.
As seen here, it's a problem in the PL2303 linux driver.
I'm working on Kubuntu 12.04, 32 Bit. Unfortunally, I don't know how to fix that driver on my system (getting driver source, patch em, compile, install … hmm, maybe I learn a bit and give it a try - advice is welcome).
But maybe there is an updated driver avaliable which is easy to install?
Or does someone know an alternate USB to RS232 adapter which works at 1 MBd (hardware flowcontrol via rts/cts is needed, which works pretty well with the PL2303)?
After the realization that »Prolific and FTDI are competitors«, I bought Ftdi US232R-10 which is a FT232R based device and specified for 1 MBd transfer rate.
With this adapter I'd successfully tested communication at 1 MBd by transfering some GiB data without any error (including usage of Rts/Cts hardware flow control).
Configuring this device using stty like:
$ stty -F /dev/ttyUSB0 1000000 raw
works successfully.

Resources