Pirate Radio Audio Issue - Scratchy

Ok, your Pirate Radio installer does not work (for me) with Jessie. I get nothing but a few pop sounds on boot up. No VU meter and no sound at all. Pressed every button repeatedly, the only one that does anything other than generate a pop sound is the power button that does a shut down. I tried it multiple times all with the same results.
In Stretch its very poor audio quality that’s not worth listening too. No pops on channel change though.

So what is one to do now? If I was to buy a new pHat Beat would my problems be solved?

Reading thru lots and lots of conversations on phatbeat forum, I have got the impression there is an updated version hradwarewise on the market. @gadgetoid, could you please explain differences as compared to previous version(s) .

A bit late but here is one stream that definitely sounds better with Pulse Audio disabled

https://energybasel.ice.infomaniak.ch/energybasel-low.mp3

Interestingly the test programmes sound fine.
Thanks for continuing to look into this issue. The support from Pimoroni - and the sense that you guys are really trying to help - definitely makes me consider buying more of your gadgets.

IMHO Pimoroni are top notch, support wise. Much better support than some of the other product support sites I’ve been on. Keep in mind its the weekend. They have a life too. ;) I imagine we’ll get some feedback Monday some time. I’m chilling out to some classic rock on my Pirate Radio as I type this. I had a backup image from an older working install I made a while back. I get a few pops when changing channels but the audio is nice and clean.

@calleblyh

there is an updated version hradwarewise on the market

Yes. We realised shortly after the switch from Jessie to Stretch that Pulse - which was previously installed by default and part of the audio stack - had been removed entirely. This exposed what I still believe to be a bug in ALSA (although I’ve had a whale of a time tracing it back) where it would run the I2S clock even when no data was being output. This has the unfortunate side-effect of causing the attached DAC to clamp the left/right terminals to +5v and GND, causing a constant current through the speaker :( (Note: This is bad!)

After much searching for a viable software fix, we decided to roll a small update to the hardware in the form of a transistor/capacitor gate on the clock signal. A capacitor is charged up by the I2S frame-sync/LRClock (this is the signal that tells the DAC whether the left or right audio data is currently being sent) and this capacitor opens a transistor that otherwise gates the clock line. This elegant fix makes the board immune to otherwise invalid signals.

Now, my conundrum is that software has no way of telling between the old board and the new board so I’m forced, in all cases, to take precautions as if it were the old board to prevent things going awry.

Unfortunately those precautions have had some side-effects in Jessie which I’d failed to catch, and they also produce scratch/awful audio under some circumstances.

In my PiratePython Radio software I cheated. I went right down to the base I2S kernel module and hacked it to squash the bug- eliminating the need for PulseAudio on either version of the hardware.

Welcome to my world ;)

Hi,
I bought the Pirate Radio Kit a few days ago,
did everything as posted in the tutorial and had the same issues.

The scratchy sound could easily be changed to great sound.

Just edit vlcd in /usr/bin:

sudo nano /usr/bin/vlcd

and change: --compressor-makeup-gain 12.0
to: --compressor-makeup-gain 0

this compressor should just be used as a limiter and needs no makeup gain…

I thought about sending it back to Pimoroni but now I’m impressed by the sound.

Greetz, CSX

2 Likes

^ it can’t be this simple? :D

I’d totally overlooked the VLC command-line options I had crafted. How could I be so stupid.

I’m going to have to try this. Thank you @csx333

Welp all!

@csx333’s solution works for me! I’ve changed the code on GitHub so future users should get the scratch-free-audio. If you don’t want to reinstall, then make the change as marked in the solution here, it’s a one-line tweak to /usr/bin/vlcd.

facepalm

I couldn’t see the wood for the trees, and didn’t have a rubber duck to question my intentions!

Thank you @csx333

1 Like

I have a spare SD card so I’ll give it another try with Full Stretch.

EDIT: Have to wait for my wife to get out of bed first though. Last time I tried it, it started on full volume. That wouldn’t go over very well with her still asleep, if you know what I mean. ;)

1 Like

Just did up a new card with Stretch and ran the one line installer. Audio was still scratchy, but after manually doing the edit above it sounds Ok. Mine was showing compressor-makeup-gain 12.0. I changed it to compressor-makeup-gain 0.0. No pops on channel change either. Good sleuthing guys and gals. Insert large thumbs up smiley here.

I do have one further suggestion though. Reduce the volume from max on first boot up.;)
That’s the only time I’ve ever seen all the LED’s on, even the RED ones. lol.

1 Like

Worked for me, as alphanumeric described. New card with Stretch and the sudo curl installer. Still scratchy. Manual edit of /usr/bin/vlcd and all is well.

Thanks, all.
Kevin

1 Like

Allways glad to support the support … ;-)

Thank you @csx333!

I’ll look into the super-loud-audio-on-first-boot issue, there must be a fix for that.

I already have a fix for the VU, but it’s not very elegant. It involves setting a vu-scale value in the asound.conf which controls what the upper-bound is for scaling the LEDs. I really need to get some sort of moving average in place, since the goal is to have a pretty VU, and not necessarily an accurate one.

Pi VU Meter is teetering on the edge of a move to mostly-Python, but it’s one of those cans of worms I’ve been afraid to open!

@gadgetoid A little more action from the VU meter would be cool. Nice to hear your working on it. For me, at the volume level I usually use, I see the bottom 1 or 2 LED’s lit. Just a very gentle flicker. I would also take a “pretty VU” over accurate. An “enhanced VU” as an option would likely satisfy most people.

I have to say though, as it is now, I am a very happy camper. Nice clean sound, no pops, = good stuff =).
Anything added now is just icing on the cake IMHO.

Wow, setting the compressor-makeup-gain to zero, really improves the sound quality. This is a step improvement vs. just stopping pulseaudio. Thanks for this.

It could also explain why this post found better sound quality when not using VLC with the phat beat

Looks good. I’m going to backup and try a stretch install today. Out of wonder, If fixes come through (e.g. for the VU meter), how do we install them?

Many thanks.

Is this still a thing?

I have the old hardware version, it’s been sitting in an unloved piradio that I wanted to set up over the weekend (I partly stopped using it because of the original jarring pops).

Fresh raspbian, vlc script, horrible scratchy sound.

It’s got the right makeup-gain value, I tried reduxing gain in vlcrc, and disabling pulse audio, still scratchy, actually even when fairly quiet.

Considering just getting the later phat beat if it makes the radio usable?

I have one of the original versions here running Pirate Radio. Audio quality is good after doing the stock install. The one liner for the phat beat and the VLC radio install. I get a few pops on boot up but the audio is nice and clean when playing a stream.

Thanks, that’s good to know!

🤔 Hmm, maybe my hardware has developed a fault?

I’d reimage your Micro SD card with the latest Raspbian. Rerun the installer and go from there. No special edits etc. I get a few extra pops I’d rather not hear on bootup, but other than that audio quality is good. I can remeber doing the edit once many moons ago. Before Pimoroni rolled the fix into the installer.
I will say though, I’m likely not running the latest Raspbian. I do believe I’m running Stretch, just haven’t done an apt-get update upgrade in a while. Why mess with something that works. ;) Plus its running headless, I’d have to hook up a monitor keyboard etc.