Problem getting started on a PiZero

Hello all!
I am trying to get a Pi Zero to act as a bluetooth dongle to my old stereo. I found balenaSound through this great article/walk-through: https://www.balena.io/blog/turn-your-old-speakers-or-hi-fi-into-bluetooth-receivers-using-only-a-raspberry-pi/

I got BalenaSound almost working on a Pi3+ (some issue with bluetooth stuttering, and line out levels). So I put the project aside for a couple of months, as I had to use the Pi3+ to its original purpose.

After checking, there seems to be fixes for my issues, so I read up a bit more, and decided to get a PiZ with a Pirate Audio DAC.

I have followed the walk-through, and everything seems fine in the balena cloud, but looking at the logs in the “terminal window” I could see more or less all services waiting on the sound-supervisor. and after filtering for the sound-supervisor I could see it exits with an error whenever it tries to start.

So it seems it cannot find a module “pulseaudio”. Isn’t this supposed to be a part of the project, or have I missed something? I searched for pulse audio, but could not find anything relating to it missing.

Any suggestion on what to check next?

Supervisor log:
26.12.20 04:54:49 (+0100) sound-supervisor > node build/index.js
26.12.20 04:54:49 (+0100) sound-supervisor
26.12.20 04:54:56 (+0100) sound-supervisor internal/modules/cjs/loader.js:834
26.12.20 04:54:56 (+0100) sound-supervisor throw err;
26.12.20 04:54:56 (+0100) sound-supervisor ^
26.12.20 04:54:56 (+0100) sound-supervisor
26.12.20 04:54:56 (+0100) sound-supervisor Error: Cannot find module ‘@tmigone/pulseaudio’
26.12.20 04:54:56 (+0100) sound-supervisor Require stack:
26.12.20 04:54:56 (+0100) sound-supervisor - /usr/src/build/audio-block/index.js
26.12.20 04:54:56 (+0100) sound-supervisor - /usr/src/build/index.js
26.12.20 04:54:56 (+0100) sound-supervisor at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)
26.12.20 04:54:56 (+0100) sound-supervisor at Function.Module._load (internal/modules/cjs/loader.js:687:27)
26.12.20 04:54:56 (+0100) sound-supervisor at Module.require (internal/modules/cjs/loader.js:903:19)
26.12.20 04:54:56 (+0100) sound-supervisor at require (internal/modules/cjs/helpers.js:74:18)
26.12.20 04:54:56 (+0100) sound-supervisor at Object. (/usr/src/build/audio-block/index.js:12:22)
26.12.20 04:54:56 (+0100) sound-supervisor at Module._compile (internal/modules/cjs/loader.js:1015:30)
26.12.20 04:54:56 (+0100) sound-supervisor at Object.Module._extensions…js (internal/modules/cjs/loader.js:1035:10)
26.12.20 04:54:56 (+0100) sound-supervisor at Module.load (internal/modules/cjs/loader.js:879:32)
26.12.20 04:54:56 (+0100) sound-supervisor at Function.Module._load (internal/modules/cjs/loader.js:724:14)
26.12.20 04:54:56 (+0100) sound-supervisor at Module.require (internal/modules/cjs/loader.js:903:19) {
26.12.20 04:54:56 (+0100) sound-supervisor code: ‘MODULE_NOT_FOUND’,
26.12.20 04:54:56 (+0100) sound-supervisor requireStack: [ ‘/usr/src/build/audio-block/index.js’, ‘/usr/src/build/index.js’ ]
26.12.20 04:54:56 (+0100) sound-supervisor }
26.12.20 04:54:56 (+0100) sound-supervisor npm ERR! code ELIFECYCLE
26.12.20 04:54:56 (+0100) sound-supervisor npm ERR! errno 1
26.12.20 04:54:56 (+0100) sound-supervisor npm ERR! sound-supervisor@1.0.0 start: node build/index.js
26.12.20 04:54:56 (+0100) sound-supervisor npm ERR! Exit status 1
26.12.20 04:54:56 (+0100) sound-supervisor npm ERR!
26.12.20 04:54:56 (+0100) sound-supervisor npm ERR! Failed at the sound-supervisor@1.0.0 start script.
26.12.20 04:54:56 (+0100) sound-supervisor npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
26.12.20 04:54:56 (+0100) sound-supervisor

Hello Jonas, That does seem strange. My initial instinct would be to reflash the SD card and follow the steps again (including recreating the app on the cloud, since it’s a different device type), in case something was missed. I’ll ping the team that created the project in case they have any more insight.

Hi,

I created a new application, and flashed the SD-card, now everything is working. Thanks for the suggestion. Seems strange something got missed during creation/flashing without some error, but things happens.

One thing you might want to ping the project team with is when re-naming the device using the SOUND_DEVICE_NAME it seems to work fine for all services except bluetooth, Thankfully the image on the project page is an old one, so after adding BLUETOOTH_DEVICE_NAME I could make the device show up is I wanted.

Now I just have to figure out the loudness, quite different levels between airplay and bluetooth, but that is something for tomorrow.

Thanks again for the help!

/Jonas

Hello Jonas,

I did a quick search and found this issue that’s similar to what you’re pointing out. It should’ve been fixed in this pull request so you might want to check out a newer version just in case.

Let us know if that works.
Cheers,
Nico.

Hi Nico,

Got everything working with said SOUND_DEVICE_NAME & BLUETOOTH_DEVICE_NAME set. Still there seems to be quite a bit of different levels between bluetooth connectivity and airplay connectivity. Nothing major, just a bit strange for a line level.

/Jonas

I was able to solve this using the variables specified here:

There is more info on this here, but I’m still not seeing a difference in volume.

Glad it worked Jonas. A bit of difference in levels across plugins (bluetooth, spotify, etc) is to be expected. They all go through pulseaudio before the line out but they originate from completely different sources so it’s not entirely possible to perfectly match them.

I have got the airplay to adjust the volume (within limits), but BT still make some problems depending on the sender…

(Then I have a completely different issue as I’ll write on below)

Hi tmigone,

As you say different sources may have different levels, unfortunately it seems BT is on Venus when it comes to levels. To add to the problem, I can adjust the level on BT like I can on Airplay. I am not sure who is to blaim, but BT should be a digital source, while I use Airplay over a HifiBerry DAC, so would assume it has line levels? Not blaiming anyone, levels seem to have gone astranged and noone is really comprehending to any standards, so I will have to adjust manually.

I have come to a completely different issue:

It seems my Raspberry Zero re-writes my SD cards in a week or to, which make my installation broken.
Has anyone seen this? Is my SD card broken, or should i put it on read-only? This has happened twice, and it is a Verbatim card (while I guess it was cheap enough to carry the Verbatim label from any crap vendor).

I’m not completely sure what you mean by “my Raspberry Zero re-writes my SD cards” but if I understand it right it does sound like the SD card may need to be replaced.

I am not very sure either…
After two weeks my device stops working, and does not reboot. Completely dead.
If I flash the SD it works again, for two weeks (aprox.). I was thinking of setting all params after flashing, and then put the SD card into locked mode after the settings has been set, to see if that changes anything. Very strange, have not seen this on any SD card before. Might be a bad card, will update.

It definitely sounds like a bad SD card, it might be one or couple dead sectors, so every time you reflash they might not be used and it will work for a while, until something gets written to them. I’d just recommend replacing the SD card, it is a common issue, especially if it is not a very high quality one.