Hot answers tagged

62

This is the main project my Raspberry Pi is dedicated to right now, so I figure I can add my two cents. Keep in mind this project is still very much a work in progress. I chose to use the C programming language for this project exclusively on the Raspbian OS, and that may have affected some of my decisions and instructions. I'm going to only list free and ...


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 ...


31

Turns out that the OP was thinking along the correct path with his trying $ sudo nano /etc/modprobe.d/alsa-base.conf and changing the index from -2 to 0 via adding options snd-usb-audio index=0 to the file. However, this wasn't working. The correct way to do it is to add options snd-usb-audio index=0 followed by options snd_bcm2835 index=1. Essentially ...


31

I have been on this project after while (to help my friend doing their paper for graduating) and find the online project doing just fine (although the pi processing the audio is quite lagging the pi, and voltage drop make it freeze as the only way to make it reboot is to unplugged the power cable). This is the step that I've been working on and it works on ...


27

If you are running Linux on your PC then this is perfectly doable, as long as you install and properly configure PulseAudio on both, your Raspberry Pi and your Linux PC. If your PC is running Windows... Skip to the end of the post (which I have just updated). Another option would be to use PulseAudio as an AirPlay receiver/client, but as far as I know, ...


21

Here is an alternate solution that doesn't rely on PulseAudio: https://github.com/lukasjapan/bt-speaker Install on raspbian as root with: curl -s https://raw.githubusercontent.com/lukasjapan/bt-speaker/master/install.sh | bash It will start a bluetooth speaker daemon that automatically accepts a single client for A2DP/AVRCP and pipes the audio stream ...


19

The official instructions for creating a "direct connection" on a network hopefully just work for most people, but it seems pulseaudio and I do not get along that well: it took me hours. [Besides "direct connection", you can also use a "tunnel" method described further down, but I recommend reading this first.] I now have a (...


19

There are a few reasons why this could be happening. Possible Problem #1: Wrong RasPi hardware audio output selected (auto vs. HDMI vs. headphone/pwm out) Solution: Force selection of the correct hardware. amixer cset numid=3 0 # automatic detection (not always reliable) amixer cset numid=3 1 # force headphone (PWM) output amixer cset numid=3 2 # force ...


17

With Raspbian Jesse, to change the default audio device is simpler than it used to be. Now, simply use this command to list your alsa-detected sound cards, and take note of the card number of your preferred device. aplay -l Then create/edit the alsa configuration file at ~/.asoundrc, or the system wide one at /etc/asound.conf, and paste these lines: pcm.!...


14

The product announcement does not list any form of audio in. You could use a USB device as mentioned by Phil, or use a hat that's designed for the job.


14

Judging by schematics the audio output circuit has not changed. It is definitely the same in Pi3 and Pi2, however in Pi1 this portion is omitted from the public schematics, but I have no reason to believe its different. This is a very simple audio output circuit that smooths PWM from the CPU through a bandpass filter @ 33Hz-15KHz. Additionally this shares a ...


13

You could use mpd, pulseaudio and raop2 module, if necessary: mpd for managing playlists, library, etc (sudo apt-get install mpd) pulseaudio for managing audio outputs: raop for AirPlay, or any other output device such as analog jack, HDMI, http streaming service, etc (sudo apt-get install pulseaudio) raop2 module for pulseaudio if the original raop module ...


12

If you want pulseaudio to start at boot, but as a user-level service, you can make a systemd unit file. This may help, as pulseaudio does not prefer to run in systems mode. https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/SystemWide/ Here is the service I wrote in /etc/systemd/system/pulseaudio.service [Unit] Description=PulseAudio ...


12

I have seen some tutorial where someone used an Phillips TEA 5767 FM Tuner to receive radio. with this breakout board. You should be successfull with that! It seems the TEA cost about $3~4$. This blog gives a detailed description how you can convert your PI into an FM Tuner: Here in this post where there is a discussion about the PI and the TEA. I hope ...


12

Use custom jack socket with plug detection. Hook the audio pins to Pi jack and the detect pin to GPIO. Make sure the detect pin works against ground (most of them do, but there always is a possibility of some exotic configuration). You pretty much can't use the Pi jack directly anyway, as doing so would put the power port toward the customer. Depending on ...


11

I think I have a way for solving your problem, try to type omxplayer -o local xxx.mp3(for mp3 file) or omxplayer -o local xxx.mp4(for mp4 file) to hear sound from raspi over your headphone. And you can also type omxplayer --help for more usage about omxplayer.


11

Ok, first delete the file /etc/modprobe.d/alsa-base.conf Raspbian Jessie does not use this config file like Wheezy did. To find what address your device uses you need to first enter the command aplay -l this shows all audio output devices, and their address. For example, my USB sound card comes up as device 1 in the output which looks like this. card 0: ...


10

I also ran into the same problem with my Raspberry Pi 2. I connected my Pi to my HD TV via an HDMI cable. My solution: Set the audio output using the following command: amixer cset numid=3 2 I tested the sound output using the following command, but no sound was heard: speaker-test -c2 -t wav To enable HDMI sound, I followed the directions found here ...


10

The audio jack channels (left and right) are provided by PWM driven GPIO (channel 0 by GPIO 12 or 18, and channel 1 by GPIO 13 or 19). So if you connect appropriate circuitry to those GPIO you will get audio. See BCM2835 ARM Peripherals for details on the GPIO and PWM peripheral. EDITED TO ADD Some background On recent Pis the audio jack output is ...


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.)


9

The Pi has only 1 "headphone jack" but no way of detecting if anything is actually connected to it, so you are out of luck unless you are designing your own hardware.


8

I have done a bit of experimenting with the general purpose clocks. This information appears to be correct (on the post date). Refer to http://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf pages 102-108. The clock frequencies were determined by experiment. The oscillator (19.2 MHz) and PLLD (500 MHz) are unlikely to change. ...


8

You can use this I2C ADC add on for the Pi. You can then directly solder the Microphone onto this expansion board without the use of breadboard. It is slightly pricey but it looks like a good quality and well thought out design. So its Plug and play. But you can obviously go the experimental route and buy your own I2C ADC (MCP3008) chip, wire it up on ...


8

No, those pins have nothing to do with audio. The upper two pins are to reset the Pi and are labeled "Run". While we have no schematics of the Pi Zero available yet, we can deduce this from former models of the Pi. According to this article it's a two pin header. The circuit with two clamp diodes, a pull-up resistor, and capacitor connected (at least that's ...


7

It is very much possible to use the Pi for realtime audio effects. The only limitations are the need for an external USB soundcard (not all soundcards are supported yet, but I know some people are working on it), and of course the power of the Pi itself (I managed to get a latency of 15 ms with some heavy FFT though, so there's a lot you can do before you ...


7

Yes, however, you need to short the two smd capacitors on the back of the PCB right by the Audio output jack (labeled C34 and C48 for me, one for each channel). You will get an output range from 0-1V. You can keep the sample values constant and get a constant voltage. For example, using a 16bit mode and only the sample value 0 you get a constant 0.5V (0 = ...


7

You can easily solve it by installing libasound2-dev. to do so just use the following code: apt-get install libasound2-dev Now you should be able to use alsa/asoundlib.h.


7

Not comming up with a complete answer but some thoughts on that matter. Let's have a look at the hardware side: schematics unfortunately not helpful for the Pi B+ and not even available for the Pi2, so we are stuck with B Rev 2.1 here for now. The audio output of the headphone jack is generated by PWM. Right from the BCM2835's GPIO pins 40 and 45 through a ...


7

That is correct, there is no audio input. The Pis generate analogue audio output using simple pulse width modulation (PWM) which is an efficient way to make output audio, but in the case of the Pi, it lacks great analogue separation. To get audio input, the Pi would have to have a dedicated audio codec, which it doesn't. A lot of people mention USB sound ...


7

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


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