[PLUGIN] NanoSound CD plugin

Bug Report

  • rPi 4
  • External USB DAC (Topping E30)
  • Volumio cat /etc/os-release 2.917 build dd2a4339faaeb892c7f467e7dc8d424aefb0bd03
  • Nanosound 1.8.6
  • Nanosound 1.2.3
  • uname -a: Linux volumio 4.19.118-v7l+ #1311 SMP Mon Apr 27 14:26:42 BST 2020 armv7l GNU/Linux

Bug description

The plugin can be installed manually or by using the pre configured image without a problem. I can see the additional nav menu entry in the Volumio UI. CDs get read and I can see the track list. The CD and any track can be played and I can see the progress.

The plugin messed up the ALSA config. Running the CLI player list for the sound cards results in the following error output:

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
ALSA lib conf.c:1182:(parse_value) card is not a string
ALSA lib conf.c:1852:(snd_config_load1) /data/nanosound_cd/asound.conf:2:0:Invalid argument
ALSA lib conf.c:3615:(config_file_open) /etc/asound.conf may be old or corrupted: consider to remove or fix it
ALSA lib conf.c:3537:(snd_config_hooks_call) function snd_config_hook_load returned error: Invalid argument
ALSA lib conf.c:3986:(snd_config_update_r) hooks failed, removing configuration
aplay: device_list:277: control open (0): Invalid argument
ALSA lib conf.c:1182:(parse_value) card is not a string
ALSA lib conf.c:1852:(snd_config_load1) /data/nanosound_cd/asound.conf:2:0:Invalid argument
ALSA lib conf.c:3615:(config_file_open) /etc/asound.conf may be old or corrupted: consider to remove or fix it
ALSA lib conf.c:3537:(snd_config_hooks_call) function snd_config_hook_load returned error: Invalid argument
ALSA lib conf.c:3986:(snd_config_update_r) hooks failed, removing configuration
aplay: device_list:277: control open (1): Invalid argument
ALSA lib conf.c:1182:(parse_value) card is not a string
ALSA lib conf.c:1852:(snd_config_load1) /data/nanosound_cd/asound.conf:2:0:Invalid argument
ALSA lib conf.c:3615:(config_file_open) /etc/asound.conf may be old or corrupted: consider to remove or fix it
ALSA lib conf.c:3537:(snd_config_hooks_call) function snd_config_hook_load returned error: Invalid argument
ALSA lib conf.c:3986:(snd_config_update_r) hooks failed, removing configuration
aplay: device_list:277: control open (2): Invalid argument
ALSA lib conf.c:1182:(parse_value) card is not a string
ALSA lib conf.c:1852:(snd_config_load1) /data/nanosound_cd/asound.conf:2:0:Invalid argument
ALSA lib conf.c:3615:(config_file_open) /etc/asound.conf may be old or corrupted: consider to remove or fix it
ALSA lib conf.c:3537:(snd_config_hooks_call) function snd_config_hook_load returned error: Invalid argument
ALSA lib conf.c:3986:(snd_config_update_r) hooks failed, removing configuration
aplay: device_list:277: control open (5): Invalid argument

While the output should be this:

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 4/4
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 IEC958/HDMI [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: ALSA [bcm2835 ALSA], device 2: bcm2835 IEC958/HDMI1 [bcm2835 IEC958/HDMI1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
  Subdevices: 3/3
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
card 2: sndrpihifiberry [snd_rpi_hifiberry_dac], device 0: HifiBerry DAC HiFi pcm5102a-hifi-0 [HifiBerry DAC HiFi pcm5102a-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 5: E30 [E30], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Additional Info

 cat /proc/asound/cards
 0 [ALSA           ]: bcm2835_alsa - bcm2835 ALSA
                      bcm2835 ALSA
 1 [Headphones     ]: bcm2835_headphonbcm2835 Headphones - bcm2835 Headphones
                      bcm2835 Headphones
 2 [sndrpihifiberry]: RPi-simple - snd_rpi_hifiberry_dac   # <=== THIS ONE SOMETIMES GETS REMOVED. REASON UNKNOWN.
                      snd_rpi_hifiberry_dac
 5 [E30            ]: USB-Audio - E30
                      Topping E30 at usb-0000:01:00.0-1.3, high speed
$ ls /dev
# …
cdrom            loop6               ram3            tty11      tty37  tty62      vcsm
# …

(i) Card 5 is the DAC

$ cat /proc/asound/modules
 0 snd_bcm2835
 1 snd_bcm2835
 5 snd_usb_audio

The nanosound CD conf

$ cat /data/nanosound_cd/asound.conf
defaults.pcm.card 2
defaults.ctl.card 2

defaults.pcm.rate_converter "speexrate_best"

pcm_slave.x4 {
	pcm "hw:2,0"
    rate 176400
}

pcm_slave.x2 {
    pcm "hw:2,0"
    rate 88200
}

pcm.rate_convertx4 {
	type rate
	slave x4
	converter "speexrate_best"
}

pcm.rate_convertx2 {
    type rate
    slave x2
    converter "speexrate_best"
}

The external/ card 5/ hw5:0 DAC has the following capabilites:

$ cat /proc/asound/card5/stream0
Topping E30 at usb-0000:01:00.0-1.3, high speed : USB Audio

Playback:
  Status: Running
    Interface = 1
    Altset = 1
    Packet Size = 72
    Momentary freq = 44104 Hz (0x5.8358)
    Feedback Format = 16.16
  Interface 1
    Altset 1
    Format: S32_LE
    Channels: 2
    Endpoint: 1 OUT (ASYNC)
    Rates: 44100, 48000, 88200, 96000, 176400, 192000, 352800, 384000, 705600, 768000
    Data packet interval: 125 us
  Interface 1
    Altset 2
    Format: S32_LE
    Channels: 2
    Endpoint: 1 OUT (ASYNC)
    Rates: 44100, 48000, 88200, 96000, 176400, 192000, 352800, 384000, 705600, 768000
    Data packet interval: 125 us
  Interface 1
    Altset 3
    Format: SPECIAL DSD_U32_BE
    Channels: 2
    Endpoint: 1 OUT (ASYNC)
    Rates: 44100, 48000, 88200, 96000, 176400, 192000, 352800, 384000, 705600, 768000
    Data packet interval: 125 us

Efforts to fix the error

  • Plugins > Installed Plugins > Nanosound CD > Settings > Auto reconfig audio + restart rPi > not working
  • Changing the /data/nanosound_cd/asound.conf as shown in this thread > not working
  • Restarting after above change > WORKING

Working config

$ cat /data/nanosound_cd/asound.conf
defaults.pcm.rate_converter "speexrate_best"

pcm.!default {
	type plug
	slave {
		pcm "hw:5,0"
		rate 44100
	}
}

pcm.rate_convertx2 {
	type plug
	slave {
		pcm "hw:5,0"
		rate 88200
	}
}

pcm.rate_convertx4 {
	type plug
	slave {
		pcm "hw:5,0"
		rate 176400
	}
}

ctl.!default {
	type hw
	card 5
}

So it boils down to an invalid config from the plugin not being able to pick up the active, external DAC.

There are a couple of things I noticed, aside from a CD playing without audio output:

  • Preinstalled img, distributed by Nanomesh: Nanosound CD does not detect the DAC. It uses I2C per default
  • Manual installation of the plugin (settings > plugins), uninstallation, re-installation causes duplicate </data/nanosound_cd/asound.conf> lines in /etc/asound.conf. I notices in the install log (+ details) in the plugins screen that you check for duplicate plugins. You might want to do the same for pre-existing config lines. The line echo "</data/nanosound_cd/asound.conf>" | sudo tee -a /etc/asound.conf in your install.sh Bash Script is the source.
  • Switching the settings to I2C (in an effort to return back to the E30) results in an non recoverable error: The settings page stays empty. Note: I did not check the frontend PHP logs to diagnose the reason, but I assume it’s a combination of lousy code that crashes silently on the error or uses error suppression and aborts there. I would probably have to reconfigure FastCGI/PHP-FPM to get error reporting and then check the logs.
  • Bonus: You could easily speed up installs by checking if certain apt packages exist upfront: dpkg-query -W -f='${Status}\n' vlc 2>/dev/null | grep -c "installed" returns 1 for installed and 0 for not installed.

Additional note: The instructions on the Nanomesher homepage are missing an important part regarding the REST API and the start/ stop scripts to auto run or stop playing when a CD is inserted/ injected:

# /etc/udev/rules.d/99-local.rules
KERNEL=="sr[0-9]", ACTION=="change", ENV{DISK_EJECT_REQUEST}=="1", RUN+="/home/volumio/stopcd.sh &"

You can look up the original instructions by sideshowbob in this thread.

Further, the GitHub repository that is linked in the instructions post tells about issue tracking. In fact it’s linking to open pull requests. You might want to change the wording there @nanomesher.

@nanomesher please take a look at the previous post, as I forgot to mention you for a notification.

Hey @AionDemon

The cat commands just print the file contents to stdout (which probably just is the console you opened via PuTTY. aplay -l just lists all playback hardware devices.

The actual definition is what you configure inside /data/nanosound_cd/asound.conf.

Note that speexrate_best defines that resampling will be used. It might use a lot more CPU there, especially when for e.g. 88200 is used, when the actual rate is 96000Hz. Would be nice to have/ find some default CD sampling rates and setting up the conf according to that.

I have Volumio running on an old MacMini 2009.
I installed the plugin via Method 2 – Run the installation script.

Finally let volumio restart and enable the plugin.
But the CD is not read or displayed. Ejecting the CD works.
Then verify that installation is ok, I check below services are running:

systemctl status nanosoundcd_web
systemctl status nanosoundcd_progressweb

And below the result. There is one error message. Anyone have any idea if this can be solved?

● nanosoundcd_web.service - NanoSound CD Web Service
   Loaded: loaded (/lib/systemd/system/nanosoundcd_web.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2022-02-07 10:22:50 UTC; 33s ago
  Process: 1670 ExecStart=/home/volumio/nanomesher_nanosoundcd/nanosoundcd_web (code=exited, status=1/FAILURE)
 Main PID: 1670 (code=exited, status=1/FAILURE)

Feb 07 10:22:50 volumio-mac-mini systemd[1]: Started NanoSound CD Web Service.
Feb 07 10:22:50 volumio-mac-mini sudo[1671]:     root : TTY=unknown ; PWD=/home/volumio/nanomesher_nanosoundcd ; USER=root ; COMMAND=/usr/bin/python -c import nanosoundcd_web; nanosoundcd_web.main()
Feb 07 10:22:50 volumio-mac-mini sudo[1671]: pam_unix(sudo:session): session opened for user root by (uid=0)
Feb 07 10:22:50 volumio-mac-mini sudo[1671]: pam_unix(sudo:session): session closed for user root
Feb 07 10:22:50 volumio-mac-mini systemd[1]: nanosoundcd_web.service: Main process exited, code=exited, status=1/FAILURE
Feb 07 10:22:50 volumio-mac-mini systemd[1]: nanosoundcd_web.service: Failed with result 'exit-code'.




● nanosoundcd_progressweb.service - NanoSound CD Progress Web Service
   Loaded: loaded (/lib/systemd/system/nanosoundcd_progressweb.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2022-02-07 10:20:34 UTC; 4min 32s ago
  Process: 1636 ExecStart=/home/volumio/nanomesher_nanosoundcd/nanosoundcd_progressweb (code=exited, status=1/FAILURE)
 Main PID: 1636 (code=exited, status=1/FAILURE)

Feb 07 10:20:34 volumio-mac-mini systemd[1]: Started NanoSound CD Progress Web Service.
Feb 07 10:20:34 volumio-mac-mini sudo[1637]:     root : TTY=unknown ; PWD=/home/volumio/nanomesher_nanosoundcd ; USER=root ; COMMAND=/usr/bin/python -c import ripprogress_web; ripprogress_web.main()
Feb 07 10:20:34 volumio-mac-mini sudo[1637]: pam_unix(sudo:session): session opened for user root by (uid=0)
Feb 07 10:20:34 volumio-mac-mini sudo[1637]: pam_unix(sudo:session): session closed for user root
Feb 07 10:20:34 volumio-mac-mini systemd[1]: nanosoundcd_progressweb.service: Main process exited, code=exited, status=1/FAILURE
Feb 07 10:20:34 volumio-mac-mini systemd[1]: nanosoundcd_progressweb.service: Failed with result 'exit-code'.

Hi,
may i ask if there are plans on bringing NanoSound CD to volumio 3? I have seen that there are commits related to volumio 3 on github . I tried the install script, but after the install the plugin is not shown in the volumio gui. One problem i have noticed during the install was that vlc could not be installed.

 vlc : Depends: vlc-plugin-base (= 3.0.12-0+deb10u1+rpt3) but it is not going to be installed
       Depends: vlc-plugin-video-output (= 3.0.12-0+deb10u1+rpt3) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Thanks a lot and kind regards

Hello,
I am having a issue with a slot load cd/dvd player that I hope you may be able to resolve. Using the Nanosound CD, Volumio 2.873, and an LG tray load cd/dvd (USB 2) things are working well.

When I switch to the slot load player, NO NAME BRAND, Two usb connectors, one USB 3 the other USB 2. The system doesn’t seem to know what to do with it. It will eject the disk thankfully but beyond that it just kinda grunts and groans. This cd player works well on a Windows base pc.

I have a NANOSOUND ONE, Pi 4 4gB, 256GB USB stick, Argon Power Supply.

Any thoughts?

I am confused about the software. What does the NANSOUND ONE plugin do?

Ripping a cd to 4x upsampling but in playback it shows 44.1kHz and it appears that Volumio is doing the playback. Does NANOSOUND CD do playback from the USB ?

Thanks

hello.
Currently I am using volumio 3.324. I can’t get the nano sound cd to read the CD no matter what I do. Can you just help me?
@nanomesher

1 Like

Nanosound CD has not been ported to Volumio 3 yet.

thanks you! so sad

this way you can use cd
CD Player install…

sudo apt-get update
sudo apt-get install sg3-utils -y

1 Like

for volumio 3 ?

yes :wink:

Hi Aiello,
sorry to bother you, but would you be so kind and tell the steps you took to make cd play work a little more detailed? I installed nanosoundcd and sg3-utils but this changed nothing for my install.
Thanks a lot!

you don’t need to install nanosound…in sg3-utils, the menu to the cd is only displayed when a cd is inserted…

I tried installing via method 2 and says Tinkerboard not supported. So I assumed .Volumio 3 is not supported.
I have the A&K CdRipper Mkii and was trying to see if there would be a difference in sound. Oh well, whenever it’s updated I’ll try.
Just ran the scrip again with a cd in my cd player, didn’t install because it was already installed.

it now shows in my installed plugins after restart…

to be clear, I used Aiello’s commands…

should nanosound working with Volumio 3.378_x86?

I installed because I want to playback cd but nothing is loading in Nanosound cd.

nanosoundcd_web.service - NanoSound CD Web Service
Loaded: loaded (/lib/systemd/system/nanosoundcd_web.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2022-11-02 15:42:12 UTC; 1min 30s ago
Main PID: 1530 (code=exited, status=1/FAILURE)

hi @Aiello ,

I am using commands you shared for getting external usb cd player in Volumio 3.
I haven’t installed any plugin, as you mentioned is not necessary, but even after restart and with a cd insterted in the player, I cannot see any cd menu.
External usb cd player is connected to the board over USB, i am also using an external power supply for the cd player to be sure it has enough power.

Is there something I am missing?

Thank you

Hi,

is there way to use an old CD rom player with digital out?

thanks
Jem

Hello : mcarr6

Do you mean you can use nanosound CD on volumio 3 ?
Could you describe more detail on how to do it ?

I use Asus Tinkerboard with Volumio 2 and nanosound CD for a period and it works well.
2 days ago I upgrade to Volumio 3 and found the plugin not support.
So I downgrade to Volumio 2, but I can not install the nanosound CD plugin,
the volumio plugin install said
“Sorry, Tinkerboard is not supported via repository. Please visit NanoSound CD Plugin for Volumio – Support – Nanomesher for more detail”
I also tried the SSH script method, but there seems some 404 missing file error.

Is there any method to re-install nanosound CD on tinkerboard/volumio 2 ?
or can anyone send the pre-config image with volumio 2 and nanosound CD for tinker board ?

thank you very much !!!