alsa on embedded system CORE9G25 - audio

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
}

Related

USB Audio Gadget Driver: How to rename/define displayed UAC1 device name at host device

I created an USB audio gadget using USB Audio Class 1 (UAC1) to send/receive audio over USB from a Linux device (Raspberry Pi) to/from a Windows host. The gadget is already working and Windows detects the Raspberry Pi as an audio in and output.
The problem I have is, that the audio output device is called "AC Interface" and the input audio device is called "capture input terminal (AC Interface) in Windows". However, I would like to define an own name, that will be display at the host. Can somebody help me how to do this?
I tried to change the name using uac1_legacy (https://www.kernel.org/doc/Documentation/ABI/testing/configfs-usb-gadget-uac1_legacy), but I couldn't manged to add this to the script.
Or do I have to configure the USB audio gadget using gadget schemes?
# Load libcomposite
modprobe libcomposite
# Create USB Gadget
mkdir -p /sys/kernel/config/usb_gadget/g1
# Device Descriptors
echo 0x1d6b > /sys/kernel/config/usb_gadget/g1/idVendor # Linux Foundation
echo 0x0104 > /sys/kernel/config/usb_gadget/g1/idProduct # Multifunction Composite Gadget
echo 0x0100 > /sys/kernel/config/usb_gadget/g1/bcdDevice # v1.0.0
echo 0x0200 > /sys/kernel/config/usb_gadget/g1/bcdUSB # USB 2.0
echo 0xef > /sys/kernel/config/usb_gadget/g1/bDeviceClass # USB 2.0
echo 0x02 > /sys/kernel/config/usb_gadget/g1/bDeviceSubClass # USB 2.0
echo 0x01 > /sys/kernel/config/usb_gadget/g1/bDeviceProtocol # USB 2.0
mkdir -p /sys/kernel/config/usb_gadget/g1/strings/0x409
echo "000001" > /sys/kernel/config/usb_gadget/g1/strings/0x409/serialnumber
echo "xy" > /sys/kernel/config/usb_gadget/g1/strings/0x409/manufacturer
echo "xy" > /sys/kernel/config/usb_gadget/g1/strings/0x409/product
# Configure UAC1 (audio)
mkdir -p /sys/kernel/config/usb_gadget/g1/functions/uac1.usb0
echo 0x1 > /sys/kernel/config/usb_gadget/g1/functions/uac1.usb0/c_chmask
echo 48000 > /sys/kernel/config/usb_gadget/g1/functions/uac1.usb0/c_srate
echo 0xf > /sys/kernel/config/usb_gadget/g1/functions/uac1.usb0/p_chmask
echo 48000 > /sys/kernel/config/usb_gadget/g1/functions/uac1.usb0/p_srate
mkdir -p /sys/kernel/config/usb_gadget/g1/configs/c.1
echo 250 > /sys/kernel/config/usb_gadget/g1/configs/c.1/MaxPower
ln -s /sys/kernel/config/usb_gadget/g1/functions/uac1.usb0 /sys/kernel/config/usb_gadget/g1/configs/c.1/
udevadm settle -t 5 || :
# End
ls /sys/class/udc/ > /sys/kernel/config/usb_gadget/sonoDSP_audio/UDC
You can check f_uac1.c. For me it seems you can not change the gstrings on the fly for the predefined funcation f_uac.
static struct usb_string strings_uac1[] = {
[STR_AC_IF].s = "AC Interface",
...,
[STR_IO_IN_IT].s = "Capture Input terminal",
...,
{ }
};
What you can do is, creating a simple functionfs user space program with your custom configurations. See the following for further details on ffs.
How to load ffs?
See: https://github.com/linkjumper/configfs/blob/master/setup_usb_gadget.sh
Documentation on how to write a userspace functionfs:
See: linux/tools/usb/ffs-test.c. (Spoiler, those testfile did not work for all endpoints to me. But it is a good source as an example.)
It is a little work, but worth it.

amixer controls won't get anything on my development board

I am trying to set volume on the minilinux system with amixer controls in development board,but it won't get anything.
~ # amixer
~ #
~ # amixer controls
~ #
I have tried to create a plugin by create this file in "/etc/asound.conf"as this How_to_use_softvol_to_control_the_master_volumesaid ,by type in this
pcm.softvol {
type softvol
slave {
pcm "hw:0,0"
}
control {
name "softctl"
card 0
}
}
but when testing it ,give me this error:
/etc # speaker-test -D softvol -c 2 &
/etc #
speaker-test 1.1.5
Playback device is softvol
Stream parameters are 48000Hz, S16_LE, 2 channels
Using 16 octaves of pink noise
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM softvol
Playback open error: -2,No such file or directory
when I changed the asound.conf to something like this:
pcm.softvol {
type hw
card 0
device 0
}
then exac " speaker-test -D softvol -c 2 & " the headphone have that pink noise.
This is really weird that I can play and record excpet control the volume. New to this,no idea what to do next.

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.

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.

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

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.

Resources