pimoroni / speaker-phat

Software installer for Speaker pHAT
MIT License
52 stars 9 forks source link

Cracks and pops #11

Closed simonbugler closed 7 years ago

simonbugler commented 7 years ago

When using espeak the sound quality is very poor with lots of pops and cracks - it almost seems that it happens when there is output to the command line. The VU meter doesn't display.

Using omxplayer - it cracks and pops at the start - but during the play it is ok - the VU meter works as expected.

Using PIXEL gui with Chrome - it worked well the first time - after a reboot volume is very low - VU works the same.

I have two speaker phats so can rule out errors with them - I've used 3 Pi's, a zero, zero w and a Pi3

I've used latest version of Raspbian and Raspbian Lite and a year old version just to test - its the same results on all three.

funk0id commented 7 years ago

When using omxplayer were you within pixel or lite? I'm getting audio but no vu within lite.

simonbugler commented 7 years ago

In Lite - via ssh

pi@314-zerow1:~/music $ omxplayer Dexter_Britain_Charge_into_2015.mp3 -o alsa
Audio codec mp3 channels 2 samplerate 44100 bitspersample 16
Subtitle count: 0, state: off, index: 1, delay: 0
Using device: speaker-peat

I've got working vu - but sound quality poor - clicks/pops/distortion

simonbugler commented 7 years ago

omxplayer responds to alsamixer - just has some clicks and pops - vu works

espeak doesn't respond to alsamixer - lots of clicks and pops - vu doesn't work

funk0id commented 7 years ago

I'm using mine for a similar purpose, got everything working (at last!) but I'm yet to try it with Espeak which is what I'm using mine for too!

On 5 Mar 2017, at 09:08, simonbugler notifications@github.com wrote:

omxplayer responds to alsamixer - just has some clicks and pops - vu works

espeak doesn't respond to alsamixer - lots of clicks and pops - vu doesn't work

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

funk0id commented 7 years ago

@simonbugler I have exactly the same issue now, desperate to get the VU working with Alsa, cmsu on the command line works with MP3s, its just the output of espeak thats not working :( No idea where to start now either!

Got to say mine seemed louder before than it is now with the VU meter working :(

funk0id commented 7 years ago

so made a bit of progress with this.... if you output espeak to a wav it'll then playback via cmus complete with vu.... problem is it plays way way way way too quickly!!!

Edit - so mplayer works... nearly there. The wav is being generated fine it was the player that was the problem.

simonbugler commented 7 years ago

Loudness of the included speaker is very dependent on the environment you are listening in, and how much material is surrounding it.

For example with the speaker facing away from you and in a normal kitchen environment I could not hear it at all.

Also the volume depends on the type of sound. I haven't experimented but suspect that there are certain frequencies/sounds that work better than a standard mp3 music track.

I suspect that the sounds would need to be specifically processed to get the best out of it.

RogueM commented 7 years ago

we'll be looking into espeak support and issues specifically at some point in the near future - this is a fairly complex environment and I suspect it outputs each syllable as a separate stream, so once we have improved the overall situation with clicks and pops it may automatically cure that too.

VU not working (with espeak) is almost certainly due to the specific user context the application uses. We'll look into it, but ultimately I think our plans to avoid these types of issues is to dissociate the hardware access from the caller initialising the audio stream.

... if you can trace back the user to add to the i2c group you may be able to resolve the issue yourself. Try:

cut -d: -f1 /etc/passwd
sudo adduser <espeakuser> i2c

(just see if there is a user obviously associated with espeak in the output form the first command)

RogueM commented 7 years ago

hum, I have just installed espeak and it works for me, including VU on a pHAT BEAT, and no clicks/pops

... I didn't notice any specific user added to my system by the espeak package so would presume that should work with Speaker pHAT too, but perhaps there is something i pivumeter itself that somehow trips only when communicating over I2C.

RogueM commented 7 years ago

yes, just tried the speaker-phat and the VU meter works. Clicks at the start, but I don't think that can be avoided with the basic speaker included.

try to run the speaker-phat installer again - we made some changes to the asound shipped as default, and that is what I am using at this end.

RogueM commented 7 years ago

I just tried to re-implement the asound that was shipping before the wekend and indeed espeak is a total mess and the VU does not work either... try the most recent config by re-running the installer:

curl https://get.pimoroni.com/speakerphat | bash

please let us know if that resolves your issue (primarily with espeak, but feedback on any other playback application welcome).

simonbugler commented 7 years ago

Ran latest installer script and espeak is as you said - pops at the start but not during.

I've settled on mplayer as terminal player now - it seems to work the best.