interweber
Posts: 2
Joined: Tue Mar 01, 2016 11:51 pm

Re: Analog audio problems? post comments here!

Tue Mar 29, 2016 8:02 am

Hello,

I have written a python script that takes audio in through a SYBA external USB Stereo Sound Adapter. It works great when I plug my cell phone playing audio into it, but now I am trying to use the line out from an Audio Buddy preamp and the audio is not registering. I am using ALSA Audio with the following read settings:

data_in = aa.PCM(aa.PCM_CAPTURE, aa.PCM_NONBLOCK, 'hw:1')
data_in.setchannels(1) # I am splitting the stereo signal
data_in.setrate(8000)
data_in.setformat(aa.PCM_FORMAT_S8)

data_in.setperiodsize(256)

Does anyone have any insight into why this might not be working?

masa-aud
Posts: 154
Joined: Fri Feb 26, 2016 9:20 am

Re: Analog audio problems? post comments here!

Wed Mar 30, 2016 9:11 am

reply to interweber on no sound from preamp
As far as I understand your comment but vaguely, the situation might be because of an analog issue rather than PCM data format kind.
If your cell phone can output sound strongly to the USB device but whether the preamp cannot out it so strong or not ?

User avatar
Taxicletter
Posts: 200
Joined: Sat Mar 05, 2016 4:25 pm
Location: Antwerp, Belgium
Contact: Website

Re: Analog audio problems? post comments here!

Wed Mar 30, 2016 9:56 am

Answer to myself and general info:

-the analogue audio output isn't amplified, so it's not suitable for (most) headphones,
-the sound level is very sensitive, or only a small range is really respresented by the volume adjusters: with alsamixer in the terminal, I have to increase or decrease it for each different program that uses sound. A little too loud or too soft, and the sound vanishes or gots clipped.
-bluetooth sound is better, although I have to select the bluethooth device again with pavucontrol, most of the time.
--::--::- Raspberry Pi 3 - Raspbian 8.0 (32GB SAMSUNG EVO) -::--::--

msingler
Posts: 2
Joined: Thu Apr 21, 2016 1:51 am

Re: Analog audio problems? post comments here!

Thu Apr 21, 2016 1:59 am

DougieLawson wrote:Try this:
sudo amixer cset numid=3 2
This did not work for me. Don't understand why the provided Raspian browser does not produce audio when playing a youtube video out of the box?

User avatar
DougieLawson
Posts: 30213
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Analog audio problems? post comments here!

Thu Apr 21, 2016 1:04 pm

Have you added

Code: Select all

dtparam=audio=on
to your active config.txt?
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.

msingler
Posts: 2
Joined: Thu Apr 21, 2016 1:51 am

Re: Analog audio problems? post comments here!

Fri Apr 22, 2016 11:52 pm

DougieLawson wrote:Have you added

Code: Select all

dtparam=audio=on
to your active config.txt?
Yes, that is already uncommented. So I uncommented "hdmi_drive=2" and now I have audio.

Thanks for the lead.

User avatar
Taxicletter
Posts: 200
Joined: Sat Mar 05, 2016 4:25 pm
Location: Antwerp, Belgium
Contact: Website

Re: Analog audio problems? post comments here!

Mon Apr 25, 2016 1:38 pm

OK, it's been a while since I needed sound, so I don't know what exactly changed in my setup. I downgraded the kernel to 4.1 because 4.4 gives an error for Sonic Pi.

I have an external sound card which works fine for Rhythmbox. But the built in sound-card (BCM2835) doesn't work anymore (selecting audio out with raspi config or adjusting volume with alsamixer don't work, in pavucontrol the sound-card is selected, but no sound heard).

The problem is: I'd use that external card, but Sonic Pi doesn't show up in Pavucontrol and the built-in settings let me choose between default, headphones or HDMI.

How can I get Raspbian to use the internal card or set the "default" to the external card (in sonic pi or elsewhere)?

EDIT, additional info: like said before it IS PulseAudio or the combination ALSA/PulseAudio that causes the trouble. I removed Pulseaudio and immediatly I have sound via mini-jack output. I re-install it and the sound is gone. (For Bluetooth sound, you do need PulseAudio).
--::--::- Raspberry Pi 3 - Raspbian 8.0 (32GB SAMSUNG EVO) -::--::--

ShunJianLee
Posts: 70
Joined: Wed Nov 25, 2015 4:43 am

Re: Analog audio problems? post comments here!

Mon May 02, 2016 9:28 am

I am currently using pi 2 for my final year project for voice sensing. May i know how to setup for the speaker into 4 pole audio jack 3.5mm . Thanks

Major Tom
Posts: 66
Joined: Wed Feb 03, 2016 8:13 am
Location: Strung up in heavens high.

Re: Analog audio problems? post comments here!

Mon May 02, 2016 11:07 am

ShunJianLee wrote:I am currently using pi 2 for my final year project for voice sensing. May i know how to setup for the speaker into 4 pole audio jack 3.5mm . Thanks
Here is the pinout of the 4-pole a/v jack:
http://www.raspberrypi-spy.co.uk/wp-con ... ection.png

But, if you only want to use the audio output you can use a regular 3-pole stereo jack. The video output will be shorted to ground and ignored.
My circuit's dead, there's something wrong.

ShunJianLee
Posts: 70
Joined: Wed Nov 25, 2015 4:43 am

Re: Analog audio problems? post comments here!

Tue May 03, 2016 8:36 pm

Bro, i cant see the pin out of the picture. Is that link problems?

Major Tom wrote:
ShunJianLee wrote:I am currently using pi 2 for my final year project for voice sensing. May i know how to setup for the speaker into 4 pole audio jack 3.5mm . Thanks
Here is the pinout of the 4-pole a/v jack:
http://www.raspberrypi-spy.co.uk/wp-con ... ection.png

But, if you only want to use the audio output you can use a regular 3-pole stereo jack. The video output will be shorted to ground and ignored.

User avatar
DougieLawson
Posts: 30213
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Analog audio problems? post comments here!

Tue May 03, 2016 9:16 pm

ShunJianLee wrote:Bro, i cant see the pin out of the picture. Is that link problems?
Try http://www.raspberrypi-spy.co.uk/2014/0 ... ideo-jack/ which is were Maj. T. meant to send you.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.

Shawnerz98
Posts: 1
Joined: Thu May 05, 2016 6:33 pm

Re: Analog audio problems? post comments here!

Thu May 05, 2016 7:49 pm

Hello everyone.
I am using Gnu Radio Companion (GRC) and Gnu Radio on a Raspberry Pi 2+. I am getting ALSA audio errors. The GRC errors say:
Using Volk machine: neon_hardfp_orc
gr::log :INFO: audio source - Audio sink arch: alsa
gr::log :ERROR: audio_alsa_sink0 - [plughw:0,0]: snd_pcm_sw_params: Invalid argument
Traceback (most recent call last):
File "/home/pi/top_block.py", line 107, in <module>
tb.Start(True)
File "/usr/lib/python2.7/dist-packages/grc_gnuradio/wxgui/top_block_gui.py", line 73, in Start
self.start()
File "/usr/lib/python2.7/dist-packages/gnuradio/gr/top_block.py", line 104, in start
top_block_start_unlocked(self._tb, max_noutput_items)
File "/usr/lib/python2.7/dist-packages/gnuradio/gr/runtime_swig.py", line 4726, in top_block_start_unlocked
return _runtime_swig.top_block_start_unlocked(*args, **kwargs)
RuntimeError: audio_alsa_sink

Clipping some of the Python code like:

self.audio_sink_0 = audio.sink(48000, "plughw:0,0", True)

This is the connection

self.connect((self.rational_resampler_xxx_1, 0), (self.audio_sink_0, 0))

My AM demod is outputting 64 kb/s. In the rational_resampler, the stream is decimated by 4 and interpolated by 3 to give 48 kb/s to the audio sink.
But ALSA seems not to like something. I can't figure it out.
I can play mp3's using the omxplayer example.
Any ideas would be welcomed.
Thank you,
-Shawn

ASfy
Posts: 2
Joined: Fri May 13, 2016 3:52 pm

Re: Analog audio problems? post comments here!

Sat May 14, 2016 4:20 am

I just set Audio in raspi-config
It get error!!!!!!!
use amixer displays No such file or directory

There is a solution in Stackoverflow
http://raspberrypi.stackexchange.com/qu ... 7375#47375

User avatar
DrWizard
Posts: 2
Joined: Mon Jun 27, 2016 9:30 pm
Location: Orange Park, FL
Contact: Website

Re: Analog audio problems? post comments here!

Wed Jun 29, 2016 1:25 am

I just got a new Raspberry Pi 3 Model B for my birthday! Woo-Hoo! :D But I can't get the sound working. :cry:
I am very good with Arduino, and very good with Windows, but I'm a noob to Pi and my linux knowledge is limited.
I've been scouring the web and forums and blogs for 3 days, and I have found lots of "solutions" which confirm I have a problem, but none of them tell me how to actually solve it!

Brand New Raspberry Pi 3 B from Amazon.
A WaveShare 5" HDMI screen which piggybacks onto the Pi but has no sound of it's own.
Trying to get sound thru the 3.5 headphone jack.
Latest Raspbian Jessie may 2016 release.
Have run sudo update and dist-upgrade. Installed drivers for touchscreen and calibrated it.
Copied Pink Floyd Dark Side of the Moon to my music folder.
Speaker on the panel has a little X beside it
Running raspi-config and changing the audio output to the 3.5 jack returns:
"There was an error running option A8 Audio"
Running amixer cset numid=3 1 returns:
"amixer: control default open error: No such file or directory"
Running lsmod output includes:
snd_bcm_s708, snd_pcm, snd_timer, and just snd
Installed VLC, trying to play a MP3 file returns:
"Audio output failed: The audio device "default" could not be used: No such file or directory"
Started over, redownloaded Raspbian Jessie, confirmed the Sha hash, imaged to a new SD card, set up and updated and reconfigured everything again, same results.


So obviously something is missing, or not installed, or at least misconfigured. Could someone please help me figure out what?

User avatar
rpdom
Posts: 11719
Joined: Sun May 06, 2012 5:17 am
Location: Essex, UK

Re: Analog audio problems? post comments here!

Wed Jun 29, 2016 4:48 am

Is audio output enabled in your /boot/config.txt?

Code: Select all

pi@raspi6 ~ $ grep audio /boot/config.txt
dtparam=audio=on
If that line doesn't appear, you'll need to add it (raspi-config normally does that for you, but it may have failed in your case)

Use "sudo nano /boot/config.txt" and add that line at the end of the file.

User avatar
DrWizard
Posts: 2
Joined: Mon Jun 27, 2016 9:30 pm
Location: Orange Park, FL
Contact: Website

Re: Analog audio problems? post comments here!

Thu Jun 30, 2016 2:14 am

Thank you rpdom! That was indeed missing, and adding it and saving the file and rebooting did indeed fix the problem!

I'm a noob, but that seems to me to be a significant oversight by the folks maintaining the official raspbian jesse image. Perhaps I should report it? Or was it maybe left out for the older pi boards?

mderouss
Posts: 1
Joined: Fri Jul 08, 2016 12:38 pm

Re: Analog audio problems? post comments here!

Fri Jul 08, 2016 1:35 pm

Hi all,

I have a problem getting sound out of Qsynth/fluidsynth. I'm using Raspian Jessie on a Pi 2.

Basic sound is OK - I can run speaker-test and get sounds ( out of the audio jack ).

What I want to do is feed fluidsynth with MIDI info on channel 1 from VMPK, and get sound out. This is not working.

When I associate QSynth with .mid files, and click on a .mid file, I *do* get noises ( it sounds crap, which is a bit
strange because it's a GM .mid file, and supposedly fluidsynth is using it's GM soundfont ).

I can see note information messages from VMPK getting to fluidsynth ( in the fluidsynth Messages window ).

So the issue seems to be, why is fluidsynth not making noises when fed from VMPK ?.

Any ideas ? When I look at the fluidsynth configuration, I see 'alsa' listed as the device driver, but the 'device'
is blank. Is this significant ?

Thanks,
Mark

mulos
Posts: 1
Joined: Mon Jul 25, 2016 8:06 pm

Re: Analog audio problems? post comments here!

Mon Jul 25, 2016 8:14 pm

Hi, I have a raspberry pi 3. Audio is not working. If I manually call modprobe snd_bcm2835, the audio device is recognized.

In my /boot/config.txt it is enabled:
# Enable audio (loads snd_bcm2835)
dtparam=audio=on

Why do I have to call modprobe manually? Got the newest sources.

zuzaparany
Posts: 6
Joined: Tue Jul 26, 2016 6:05 am

Re: Analog audio problems? post comments here!

Tue Jul 26, 2016 6:18 am

Hello everyone! I have a really strange audio problem. I bought a RPi 3 6 month ago or so, and my usb sound card worked out of the box with great sound quality. But i updated from kernel 4.1 to 4.4 and the sound is really strange. The low and medium frequencies are okay, but the high is stuttering and "resonating" or i don't know what happens. I changed the cabel, set audio=on, checked alsamixer but the card has no mixer. I installet LibreELEC with noobs as well, and it also does this strange thing...BUT! if i install LibreELEC with berryboot, the sound is great.(propably because use the 4.1 kernel). What the on earth changed in 4.4 that cause this distortion?

Creativian
Posts: 17
Joined: Sun Apr 12, 2015 5:04 pm
Location: New Brunswick, Canada

Re: Analog audio problems? post comments here!

Wed Jul 27, 2016 8:48 pm

I have a puzzling situation with audio on my Model B+. When I did dist-upgrade, I was happy to get audio, maybe for the first time ever (I was listening to Soundcloud.com through 3.5 earbuds). A couple of weeks later, and the audio is no longer working. I've installed kweb since then; I don't know if that has anything to do with it.

Here's the weird part: I plugged the pi into my TV via a composite cable (it's an old TV; no HDMI) and I managed to get sound (and video), after commenting out "hdmi_force_hotplug=1" in my config.txt file. So I thought perhaps that fixed the problem, and plugged it back into the monitor and the earbuds. And I got no sound.

I don't get it. Why would it work with the TV and not the earbuds? They're both analogue audio. I know nothing has gone wrong with the earbuds because, for one, I plugged them into my Sansa Clip and could hear the music just fine; for another, when I reboot my pi with the earbuds still in, I hear clicks when it shuts down, and more clicks when it starts up. So the problem is not the earbuds.

I looked at some posts on the forum. I tried adding dtparam=audio=on to my config.txt. I also tried changing the text in /etc/modules from snd-bcm2835 to snd_bcm2835. Neither of these has worked. I've tried soundcloud.com, omxplayer, and whatever is that default player in Epiphany. I get no sound in any of these.

Creativian
Posts: 17
Joined: Sun Apr 12, 2015 5:04 pm
Location: New Brunswick, Canada

Re: Analog audio problems? post comments here!

Fri Jul 29, 2016 4:08 pm

After trying some pretty extreme things that I don't want to talk about, I have come to the conclusion that the audio jack wasn't plugged in properly. :oops:

Note: If your audio has mysteriously disappeared, the first thing you should do is pull out the audio jack a little bit and stick it back in again. You could save yourself a huge amount of time and bother.

wm6h_1
Posts: 9
Joined: Sat Dec 26, 2015 1:16 pm

Re: Analog audio problems? post comments here!

Thu Aug 04, 2016 4:05 pm

I wrote an audio recording program using portaudio. Jessie-lite isn't a real-time operating system but it works well on the fast multi-core Pis.

On the Pi Zero it works but sometimes about 30 seconds after starting, the green activity LED flickers (SD card access?) and the audio samples are corrupted. The time to get a frame's worth of samples lengthens.

But sometimes it survives this ACT event and runs reliably for days.

My knowledge of Linux is limited. I've used the various techniques to minimize SD card access (meant also to stop SD card corruption caused by cache and logging operations). And examining "Top" gives me no clue as to what is happening. My program has the highest priority.

Any suggestions? Can I somehow stop all SD card activity?

It may not be a solvable problem. I currently detect the long sample frame rate and reset the Pi Zero to give it another chance to get through the ACT issues. A kludge yes but for a $5 USD computer that runs Linux, I can probably live with it.
Bob

AicheeE
Posts: 1
Joined: Mon Sep 19, 2016 5:00 am

Re: Analog audio problems? post comments here!

Mon Sep 19, 2016 5:48 am

Noob here so be gentle. I read thru most of the posts but didn't see the same problem I have. I basically bought a Raspberry Pi 3 Model B to be used as a kid computer. I installed the latest version of Raspbian via a pre-installed SD card and hooked it up to a X2GEN VGA monitor (w/VGA - HDMI adapter), keyboard, mouse, and a bluetooth speaker (via the 3.5mm jack) that I had used on the older computer. When I first got it up and running, I had problems with the resolution being too large for the monitor, but the audio was fine. After researching I tried a number of solutions I found on the internet and eventually resolved the resolution problem. I wanted to try out the Ubuntu MATE distro, so I reformatted the card and loaded Noobs and Ubuntu. I made the same changes to the config file and resolved the monitor resolution problem, but this time, I have no analog audio. I researched the internet and tried a number of changes to the config.txt file (see below), but with no luck. I also tried to use the bluetooth function and although is successfully paired, I was still getting no audio. So I reinstalled Raspbian, did the update and upgrade command, and repeated my changes to the config.txt file to resolve the monitor resolution. Still no audio. Thinking that the sound card was fried, I bought a new RPi 3 Model B. Still no audio. Not sure what else to do at this point and would appreciate any help. I have also tried a set of earbuds using the 3.5mm jack just make sure the speaker wasn't the issue. Still no audio. Thx.

My config.txt file reads:
---------------------------
# For more options and information see
# http://www.raspberrypi.org/documentatio ... fig-txt.md
# Some settings may impact device functionality. See link above for details
# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1
# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1
# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16
# uncomment to force a console size. By default it will be display's size minus
# overscan.
framebuffer_width=1280
framebuffer_height=720
# uncomment if hdmi display is not detected and composite is being output
# uncomment to force a specific HDMI mode (this will force VGA)
# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4
# uncomment for composite PAL
#sdtv_mode=2
#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800
# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on
# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi
# Additional overlays and parameters are documented /boot/overlays/README
hdmi_force_hotplug=1
hdmi_drive=2
hdmi_group=2
hdmi_mode=16
#Enable audio (loads snd_bcm2835)
pi@raspi6 ~ $ grep audio /boot/config.txt
dtparam=audio=on
amixer cset numid=3 1
----------------------------------

pa_drone
Posts: 1
Joined: Tue Nov 15, 2016 3:50 pm

Re: Analog audio problems? post comments here!

Tue Nov 15, 2016 4:31 pm

Hello everybody.
I'm building a sort of cambot using a Raspberry pi 3 model B. So, I have several gpio pins wired to two H-Bridge motor drivers and various leds. I also wanted to output sound from a speaker, so i wired the analog jack to an lm386 audio amplifier which is connected to this speaker and is powered by one 5v gpio output from the raspberry (i also wired the ground to one ground gpio). The problem is that, as soon as I power on the raspberry, a crackling and buzzing audio comes out from the speaker. I can also hear the sounds that i play, but the rustling never ends. I've done several tests. If I wire an external audio source to the amplifier (still powered by the raspberry) the audio output is clear and perfect. The trouble still persist if I use an external usb sound card adapter.
I think that the problem is due to the fact that the audio output and the amplifier use the same power line (i can hear crackling even when I just move the mouse). What can I do to solve it and have a clear audio output (even if is only mono)? Thanks.

afan
Posts: 2
Joined: Tue Jan 31, 2017 8:13 am

Re: Analog audio problems? post comments here!

Tue Jan 31, 2017 8:39 am

I know the intergrated analog audio quality is pretty poor, but I have found a solution that makes it bearable (almost the same quality as with a simple external USB audio dongle).

I'm using RPi 3 B with MPD and Alsa output, and plug the board using 3.5mm jack to the amplifier.

First of all, I set mixer hardware sound level to 0db and never change it:

Code: Select all

sudo amixer cset numid=1 -- 0
Then I set MPD to use software mixer instead of hardware:

Code: Select all

sudo nano /etc/mpd.conf
Inside active audio_output { ... } block add the following line:

Code: Select all

mixer_type "software"
Save and exit the editor, then restart MPD:

Code: Select all

sudo service mpd restart
Now MPD uses software volume (0..100) while hardware volume stays the same. Having said that, I rarely need to change MPD software volume, since I control the volume on the amp. However, with maxed out hardware+software volume the signal is too loud for my amplifier, so to lower the desired volume range I use a resistor on each channel wire (between RPi and amp). In my case it's 22KOhm, but your mileage may vary.

With these settings the quality is pretty good (no audible background noise or whatever) for my specific — simple and vintage — amp and driver I use, so if your project doesn't require Hi-Fi quality, you can try this method before resorting to more expensive hardware options.

Return to “Troubleshooting”

Who is online

Users browsing this forum: No registered users and 32 guests