I2s Soundcard on Nanopi M4V2?

Has anyone got this working?

I found this guide: https://forum.armbian.com/topic/11721-nanopi-m4-audio-i2s-output-on-gpio/

I’ve tried poking about a bit with it but I lack the general skills to work out what I might have done wrong when it didn’t work.

I’ve got a Terradac 9023 that I’d really like to use with this board - setup was always so easy on regular Pi’s using Diet Pi but nothing on this FriendlyArm board seems to quite work as it should it’s already been relegated (having been bought to be a Kodi box) to the secondary music server box, but even this isn’t going well!

Also I’m having trouble getting mopidy-spotify on to it (so it’s failing pretty hard as far as a music box goes so far! :wink:)

Any pointers gratefully received

This is the problem I’m hitting with Mopidy-spotify, it seems to be a mismatch between where pip is expecting to find the build tools it needs to compile this element and the reality of where they’re actually installed?

Building wheels for collected packages: pyspotify
  Building wheel for pyspotify (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 /usr/local/lib/python3.7/dist-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpnrkv3h0q
       cwd: /tmp/pip-install-vlg09f4h/pyspotify
  Complete output (60 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-aarch64-3.7
  creating build/lib.linux-aarch64-3.7/spotify
  copying spotify/version.py -> build/lib.linux-aarch64-3.7/spotify
  copying spotify/utils.py -> build/lib.linux-aarch64-3.7/spotify
  copying spotify/user.py -> build/lib.linux-aarch64-3.7/spotify
  copying spotify/track.py -> build/lib.linux-aarch64-3.7/spotify
  copying spotify/toplist.py -> build/lib.linux-aarch64-3.7/spotify
  copying spotify/social.py -> build/lib.linux-aarch64-3.7/spotify
  copying spotify/sink.py -> build/lib.linux-aarch64-3.7/spotify
  copying spotify/session.py -> build/lib.linux-aarch64-3.7/spotify
  copying spotify/search.py -> build/lib.linux-aarch64-3.7/spotify
  copying spotify/playlist_unseen_tracks.py -> build/lib.linux-aarch64-3.7/spotify
  copying spotify/playlist_track.py -> build/lib.linux-aarch64-3.7/spotify
  copying spotify/playlist_container.py -> build/lib.linux-aarch64-3.7/spotify
  copying spotify/playlist.py -> build/lib.linux-aarch64-3.7/spotify
  copying spotify/player.py -> build/lib.linux-aarch64-3.7/spotify
  copying spotify/offline.py -> build/lib.linux-aarch64-3.7/spotify
  copying spotify/link.py -> build/lib.linux-aarch64-3.7/spotify
  copying spotify/inbox.py -> build/lib.linux-aarch64-3.7/spotify
  copying spotify/image.py -> build/lib.linux-aarch64-3.7/spotify
  copying spotify/eventloop.py -> build/lib.linux-aarch64-3.7/spotify
  copying spotify/error.py -> build/lib.linux-aarch64-3.7/spotify
  copying spotify/connection.py -> build/lib.linux-aarch64-3.7/spotify
  copying spotify/config.py -> build/lib.linux-aarch64-3.7/spotify
  copying spotify/compat.py -> build/lib.linux-aarch64-3.7/spotify
  copying spotify/audio.py -> build/lib.linux-aarch64-3.7/spotify
  copying spotify/artist.py -> build/lib.linux-aarch64-3.7/spotify
  copying spotify/album.py -> build/lib.linux-aarch64-3.7/spotify
  copying spotify/_spotify_build.py -> build/lib.linux-aarch64-3.7/spotify
  copying spotify/__init__.py -> build/lib.linux-aarch64-3.7/spotify
  running egg_info
  writing pyspotify.egg-info/PKG-INFO
  writing dependency_links to pyspotify.egg-info/dependency_links.txt
  writing requirements to pyspotify.egg-info/requires.txt
  writing top-level names to pyspotify.egg-info/top_level.txt
  reading manifest file 'pyspotify.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no files found matching '*' under directory '.github'
  no previously-included directories found matching 'docs/_build'
  no previously-included directories found matching 'examples/tmp'
  warning: no previously-included files matching '__pycache__/*' found anywhere in distribution
  writing manifest file 'pyspotify.egg-info/SOURCES.txt'
  copying spotify/api.h -> build/lib.linux-aarch64-3.7/spotify
  copying spotify/api.processed.h -> build/lib.linux-aarch64-3.7/spotify
  running build_ext
  generating cffi module 'build/temp.linux-aarch64-3.7/spotify._spotify.c'
  creating build/temp.linux-aarch64-3.7
  building 'spotify._spotify' extension
  creating build/temp.linux-aarch64-3.7/build
  creating build/temp.linux-aarch64-3.7/build/temp.linux-aarch64-3.7
  aarch64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.7m -c build/temp.linux-aarch64-3.7/spotify._spotify.c -o build/temp.linux-aarch64-3.7/build/temp.linux-aarch64-3.7/spotify._spotify.o
  build/temp.linux-aarch64-3.7/spotify._spotify.c:569:10: fatal error: libspotify/api.h: No such file or directory
   #include "libspotify/api.h"
            ^~~~~~~~~~~~~~~~~~
  compilation terminated.
  error: command 'aarch64-linux-gnu-gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for pyspotify
Failed to build pyspotify
ERROR: Could not build wheels for pyspotify which use PEP 517 and cannot be installed directly

Hi,

maybe you can have a look to this guide for installation of pyspotify https://pyspotify.readthedocs.io/en/latest/installation/

This is the section for libspotify https://pyspotify.readthedocs.io/en/latest/installation/#libspotify

probably it would need to be installed

apt install libspotify-dev

But that it was that simple!

root@DietPi:/# wget -q -O - https://apt.mopidy.com/mopidy.gpg | sudo apt-key add -
OK
root@DietPi:/# sudo wget -q -O /etc/apt/sources.list.d/mopidy.list https://apt.mopidy.com/buster.list
root@DietPi:/# apt update
Hit:1 http://ppa.launchpad.net/spocon/lovspotify/ubuntu bionic InRelease
Hit:2 https://apt.mopidy.com buster InRelease                                                                                 
Hit:3 https://deb.debian.org/debian buster InRelease                                                                          
Hit:4 https://deb.debian.org/debian buster-updates InRelease
Hit:5 https://deb.debian.org/debian-security buster/updates InRelease
Hit:6 https://deb.debian.org/debian buster-backports InRelease
Hit:7 https://minio.k-space.ee/armbian/apt buster InRelease
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.
root@DietPi:/# apt install libspotify-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package libspotify-dev

Why can’t I get apt-mopidy to work?

(it works fine on both a regular raspberry pi and also on a NanoPi Neo)

I did the following

wget -q -O - https://apt.mopidy.com/mopidy.gpg | sudo apt-key add -
wget -q -O /etc/apt/sources.list.d/mopidy.list https://apt.mopidy.com/buster.list
apt update

and my system was able to locate the package now

root@DietPiVM1:~# apt show libspotify-dev
Package: libspotify-dev
Version: 12.1.51-1
Priority: extra
Section: libdevel
Source: libspotify
Maintainer: Stein Magnus Jodal <stein.magnus@jodal.no>
Installed-Size: 1,681 kB
Depends: libspotify12 (= 12.1.51-1)
Homepage: http://developer.spotify.com/en/libspotify/
Download-Size: 464 kB
APT-Sources: https://apt.mopidy.com buster/non-free amd64 Packages
Description: Library for using the Spotify music streaming service
 This development package provides the header files and the symbolic links to
 allow compilation and linking of programs that use the libraries provided in
 the libspotify12 package.

root@DietPiVM1:~#

Inspired by this https://github.com/mopidy/libspotify-deb

Thanks for persisting with me Joulinar, as far as I can tell those are the same commands with sudo removed from them. For the record:

root@DietPi:~# wget -q -O - https://apt.mopidy.com/mopidy.gpg | sudo apt-key add -
OK

root@DietPi:~# wget -q -O /etc/apt/sources.list.d/mopidy.list https://apt.mopidy.com/buster.list

root@DietPi:~# apt update
Hit:1 http://ppa.launchpad.net/spocon/lovspotify/ubuntu bionic InRelease
Hit:2 https://apt.mopidy.com buster InRelease                                                       
Hit:3 https://deb.debian.org/debian buster InRelease                                                
Hit:4 https://deb.debian.org/debian buster-updates InRelease
Hit:5 https://deb.debian.org/debian-security buster/updates InRelease
Hit:6 https://deb.debian.org/debian buster-backports InRelease
Get:7 https://imola.armbian.com/apt buster InRelease [18.3 kB]
Fetched 18.3 kB in 3s (6754 B/s)                  
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.

root@DietPi:~# apt show libspotify-dev
N: Unable to locate package libspotify-dev
N: Unable to locate package libspotify-dev
E: No packages found

not sure if this is related but you should remove the Ubuntu source list. DietPi is based on Debian and you should avoid mixing it with Ubuntu.

http://ppa.launchpad.net/spocon/lovspotify/ubuntu bionic InRelease

another option might be, libspotify-dev is not available for your board. But there I’m not an expert. Maybe MichaIng has an idea.

btw can you share you /etc/apt/sources.list.d/mopidy.list

This is /etc/apt/sources.list.d/mopidy.list

# Mopidy APT archive
# Built on Debian 10 (buster), compatible with Ubuntu 19.10 and newer
deb https://apt.mopidy.com/ buster main contrib non-free
deb-src https://apt.mopidy.com/ buster main contrib non-free

The lovspotify thing seems to be working, well it’s running, as an extension of the original post I’m also enjoying hardware issues where I can’t get the i2s card working but actually I can’t get the onboard codec card working either!