Hot answers tagged

42

Background It's amazing to see how much effort has been put in to trying to resolve various sound related problems for the Raspberry Pi. Apparently it must be the weakest spot for new users to successfully develop with and use ALSA under Raspbian. Having spent considerable time and effort trying to get my own RPi3 sound working in different OS versions ...


27

According to the ALSA Wiki, under the title that reads "How to choose a particular order for multiple installed cards", it states the following: Which card is card number 0, 1 and so is by default determined by module load order. This is particularly useful to choose which card becomes the default one. In theory therefore it is possible to choose ...


15

Turns out the file is now called alsa.conf and is found in /usr/share/alsa. Changed the lines defaults.ctl.card 0 defaults.pcm.card 0 to card 1 and that's me up and running. Looks like others have different problems with other sound cards so worth looking at other solutions too. Found some good suggestions (including my solution) here: https://www....


9

To get different definitions for playback and capture, use the asym device: pcm.!default { type asym playback.pcm "plughw:0" capture.pcm "plughw:1" } (Something like this is not possible for control devices.)


7

If you want to compile something from source that links to a specific library, you also need the appropriate header files (#include ...). These are not included when the library is installed since they're only needed when compiling; instead, they come in small associated "development" packages. On Raspbian these have a -dev suffix: > apt-cache search ...


7

hw accesses the hardware device directly. plughw inserts sample rate and format conversion plugins, if needed.


7

Also check the /boot/config.txt file. It should look like this: # Enable audio (loads snd_bcm2835) dtparam=audio=on


6

Ok, first delete the file /etc/modprobe.d/alsa-base.conf Raspbian Jessie does not use this config file like Wheezy did. Now, to set the USB sound card to your default card you will need to edit the file /usr/share/alsa/alsa.conf with the command sudo nano /usr/share/alsa/alsa.conf scroll down until you find the lines defaults.ctl.card 0 defaults.pcm.card 0 ...


5

I'd guess that you're gaining the delay due to some sort of buffering taking place or due to high CPU load. The later you can check by running the top command. The FluidSynth Wiki suggests three command line options you can use to reduce latency. -r=RATE (sample rate, default 44100) -c=NUM (number of audio buffers, default 16) -z=SIZE (buffer size, default ...


5

I found a simple solution using just ALSA and uses little CPU - around 3-5% on RPi 3 using latest Jessie build and a USB Audio Device It appears that recent builds all come with ALSA's dmix plugin built-in. This allows you to share and output audio output stream Create New .asoundrc pi@raspberrypi:~ $ sudo nano .asoundrc Copy/Paste this based on USB ...


5

Short answer run: sudo apt-get install libasound2-dev before attempting to configure and compile ffmpeg or anything where you need alsa support. Process for resolving similar build dependencies: Returning to this build/install method: $ cd /usr/src $ sudo git clone git://source.ffmpeg.org/ffmpeg.git $ cd ffmpeg/ $ sudo ./configure && sudo make &&...


5

I suggest you run raspi-config, look at Advanced Options>Audio and make sure the "1 Force 3.5mm ('headphone') jack" option is selected. Then reboot...


4

By default pigpio uses the PCM peripheral to time the DMA leaving the PWM peripheral free for standard audio. Perhaps your ALSA device is using high quality audio. If that's the case you need to use the PWM peripheral to time the DMA leaving the PCM peripheral free for high quality audio. To do that from C use gpioCfgClock. Perhaps gpioCfgClock(/* ...


4

adding an 'asymmetrical' ALSA device worked: change the contents of /etc/asound.conf and ~/.asoundrc to the following: pcm.!default { type asym playback.pcm "hw:0,0" capture.pcm "hw:1,1" } and sudo alsa force-reload for good measure


4

Create a Bash file with the following code: amixer scontrols amixer sset 'Master' 50% Make the Bash file executable using chmod +x filename In Python, use the following: import os os.system("directorytobashfile/file")


4

You can use module-loopback functionality of PulseAudio. First identify the names for your sound card's line in and speakers using pactl list sources and pactl list sinks respectively. Then create the loopback: pactl load-module module-loopback source=src_name sink=sink_name If your soundcard is detected with correct default source and sink, simply running ...


4

I did manage to play sound and record using my Marshall MID headphones using a Raspberry Pi Zero W, which has a builtin WiFi + Bluetooth adapter, but no audio jack. Please note that there are different approaches using different tools such as bluez alsa and pulseaudio, hcitool, bluetoothctl. Install bluez-alsa Bluez Alsa let's you play sound on a ...


3

I found a workaround. Instead of re-ordering the index for the mic card, I can change the default mic card with this: $sudo vi ~/.asoundrc pcm.usb { type hw card Mic } pcm.internal { type hw card ALSA } pcm.!default { type asym playback.pcm { type plug slave.pcm "internal" } capture.pcm { ...


3

I got this working by running the following command to configure which audio output to use: amixer cset numid=3 1 The last number is the audio output with 1 being the 3.5 jack, 2 being HDMI and 0 being auto.


3

Configure looks for the presence of the development libraries of PulseAudio, Jack and ALSA, in that order. That is why in answers like this it is mentioned that "...It also appears that ALSA will not be used if PulseAudio is installed...". In my particular case, I didn't have anything else installed besides ALSA. But then I remembered that I did some tests ...


3

RPIO, like pigpio, servoblaster, piblaster, and possibly others, use DMA to time the servo pulses. In effect the pulses are hardware timed. In contrast to software PWM they suffer little if any jitter. The DMA timing is achieved by pacing transfers from a Broadcom SOC peripheral. There are only two which may be used, PWM and PCM. Initialising the ...


3

You can make these various settings in your asoundrc, discussed here. You need to set the default input and output in your asoundrc file. Note that when the input and output devices are different, there can be problems with playback and recording at the same time (full duplex). This is because the two sound cards don't share a common clock. It seems that it ...


3

I had the same problem on my Pi3B but could fix it by uncommenting "device" option in the "audio_output" block (in my case ALSA) in mpd.conf.


3

Here's a writeup for the hack we came up with in the comment stream: Most fortunately, we're able to take advantage of the limited scope of this request: I don't care that sound doesn't work on pygame. The application works perfectly just this annoying 6 line error message shows. I just want to get rid of the messages We don't know why exactly ALSA is ...


3

The subdevices are for multiple audio services usage that would be mixed to input/output. There are also subdevices that are a part of an input or output device. There must be at least 1 subdevice. In the context of output devices, a device having multiple subdevices means the hardware can do mixing, i.e. it can take multiple streams of PCM and mix ...


3

Section 3 at the bottom of the installation guide Troubleshooting part: Couldn't acquire D-Bus name: org.bluealsa It is not possible to run more than one instance of the BlueALSA server per D-Bus interface. If one tries to run second instance, it will fail with the "Couldn't acquire D-Bus name: org.bluealsa" error message. This message ...


2

You are supposed to mention your sound card number to store the settings using sudo alsactl store, You could see the card number of your device using the command, arecord -l The output would be apparaently in this form, List of CAPTURE Hardware Devices card 1: U0x41e0x30d3 [USB Device 0x41e:0x30d3], device 0: USB Audio [USB Audio] ...


2

aplay -l lists all hardware devices, i.e., devices handled by an ALSA kernel driver. These devices, identified by card number x and device number y, can be accessed directly with a device name hw:x,y. Software plugins that are layered on top of hardware device also accept these numbers, e.g., plughw:x,y or dmix:x. aplay -L lists the ALSA device names of all ...


2

As per the manual page (which should be installed, read man aplay): -l, --list-devices List all soundcards and digital audio devices -L, --list-pcms List all PCMs defined PCM is the standard way that uncompressed digital audio is encoded for playback. It may colloquially refer to a source/sink of such a signal ("PCM interface" might be clearer), ...


2

2 Bytes = 16 Bits Adding a bit of code so that I can understand how the wave module works: #!/usr/bin/env python3 import wave,struct,math waveFile = wave.open("/home/pi/Music/second_stupidest_birthday_ever.wav", "rb") frames = waveFile.getnframes() # total number of frames / samples rate = waveFile.getframerate() # number of frames / samples per ...


Only top voted, non community-wiki answers of a minimum length are eligible