element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum Running Max2Play with the Cirrus Logic Sound Card and Concurrent Input Sources
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 0 replies
  • Subscribers 661 subscribers
  • Views 421 views
  • Users 0 members are here
  • raspberry_pi
  • raspeberry_pi_accessories
Related

Running Max2Play with the Cirrus Logic Sound Card and Concurrent Input Sources

nonchalant
nonchalant over 8 years ago

After spending far too much time trying to figure out how to get this configured correctly, I actually managed to get it running flawlessly. The end result is running LMS/squeezebox through max2play while also streaming from the S/PDIF In and Line In ports on the Wolfson card. The reason I wanted to do this is so that I could listen to Google Play Music (Max2Play being the only real option), vinyl records from turntable (Line In), or Xbox (games/plex streaming) on their own or in any combination without having to run any commands.

 

Max2Play

Simple to set up, make sure you download the base "Max2Play Raspberry Pi Image" as it runs Jessie-Lite without any extras. The squeezeplug version runs wheezy which makes installing googleplaymusicapi unreasonable. After you flash your SD card and let M2P install, ensure you have the Raspberry Setting Plugin enabled. Go ahead and install Squeezelite from the "Audioplayer" tab and if you want, grab shareport and the DLNA client (Also available as Squeezebox plugins). Install Logitech Media Server under "Squeezebox Server", make sure you install the 7.9 nightly release if you want to use Google Play Music. This installation will take 5-10 minutes so just be patient, Max2Play conveniently shows the installation log as it goes so you don't have to guess at its success. After it is complete, install the Google Play Music plugin and the ShareTunes2 plugin for airplaying files from iOS devices.

 

Cirrus Logic Setup

Reboot the pi once more and navigate to the "Raspberry Settings" tab. Select the Wolfson Card from the drop down list and reboot when prompted. Return to the same tab and check the "Enable I2S-MMAP (Mixerdevice for Soundcards)" check box. Now we get to where I started struggling. After reading every post from Ragnar (GOAT for this forum by the way!!!) numerous times I finally figured it out. First off, even though M2P knows you have a sound card in use at this point, it never changes the card number in the ALSA device structure. This was an oversight on their part so I chose instead to use Ragnar's .asoundrc file instead.

 

https://www.element14.com/community/message/107289/l/re-pjsippjsua-with-wolfson-audio-card#107289

 

sudo cp /etc/asound.conf ~/asound.conf.backup
# Make a copy of Ragnar's .asoundrc
sudo mv ~/.asoundrc /etc/asound.conf

 

 

Note: M2P implements a different order for sound cards than Ragnar's kernel does. So you will have to replace every "card 0" with "card 1"

 

Next, edit /opt/max2play/audioplayer.conf and change the squeezelite command to:

"SQUEEZELITE_PARAMETER=-o default -a 16"

This sets the audio device to the default device as configured in /etc/asound.conf which we set up to allow multiple input streams/recordings at once.

 

Routing Setup

M2P implements a slightly varied set of use case scripts that you will find whenever this sound card comes up and will be found in /opt/max2play/wolfson/

 

Since I am using the LineOut port, I edited the "Playback_to_Lineout.sh" file found in this directory. This script is run by Max2Play whenever squeezelite is started so it is kind of the only relevant script in this example. It is pretty straight forward to adapt to other outputs though. But here is my edited script:

 

#!/bin/bash
# $1 added to support 1st line argument. i.e. "./Playback_to_Lineout.sh -q" will stop all the control information
#being displayed on screen
#Playback from AP to Line Output, default gain 0dB


amixer $1 -Dhw:sndrpiwsp cset name='SPDIF In Switch' on


# Clear the HPOUT2 Input 1 and 2 mixers. This will ensure no previous paths are connected to the HPOUT2. This doesn't
# include Inputs 3 and 4.
amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2L Input 1' None
amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2R Input 1' None
amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2L Input 2' None
amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2R Input 2' None
amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2L Input 3' None
amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2R Input 3' None
# Setup HPOUT2 input path and volume for streaming
amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2L Input 1' AIF1RX1
amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2L Input 1 Volume' 20
amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2R Input 1' AIF1RX2
amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2R Input 1 Volume' 20
# Setup HPOUT2 input path and volume for S/PDIF in
# Pass through Low/High Pass Filter Fers
amixer $1 -Dhw:sndrpiwsp cset name='LHPF3 Input 1' AIF2RX1
amixer $1 -Dhw:sndrpiwsp cset name='LHPF4 Input 1' AIF2RX2
amixer $1 -Dhw:sndrpiwsp cset name='LHPF3 Mode' High-pass
amixer $1 -Dhw:sndrpiwsp cset name='LHPF4 Mode' High-pass
amixer $1 -Dhw:sndrpiwsp cset name='LHPF3 Coefficients' 240,3
amixer $1 -Dhw:sndrpiwsp cset name='LHPF42 Coefficients' 240,3
# Now add as input to HPOUT2
amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2L Input 2' LHPF3
amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2R Input 2' LHPF4
amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2L Input 2 Volume' 15
amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2R Input 2 Volume' 15
# Setup HPOUT2 input path and volume for Line-in better THD in normal mode vs lower noise floor in high performance
amixer $1 -Dhw:sndrpiwsp cset name='IN3 High Performance Switch' on
# Configure the input path for 0dB Gain, HPF with a low cut off for DC removal
amixer $1 -Dhw:sndrpiwsp cset name='LHPF1 Input 1' IN3L
amixer $1 -Dhw:sndrpiwsp cset name='LHPF2 Input 1' IN3R
amixer $1 -Dhw:sndrpiwsp cset name='LHPF1 Mode' High-pass
amixer $1 -Dhw:sndrpiwsp cset name='LHPF2 Mode' High-pass
amixer $1 -Dhw:sndrpiwsp cset name='LHPF1 Coefficients' 240,3
amixer $1 -Dhw:sndrpiwsp cset name='LHPF2 Coefficients' 240,3
# Now mix to HPOUT2
amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2L Input 3' LHPF1
amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2R Input 3' LHPF2
amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2L Input 3 Volume' 32
amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2R Input 3 Volume' 32
#Finally unmute HPOUT2
amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2 Digital Switch' on

 

 

That should do it! Now you can play from those three sources independently and simultaneously. All that is left is to open the LMS webui and configure squeezebox plugins to your needs!

 

Shoutout to ragnar.jensen for knowing the inner workings better than I ever will!

  • Sign in to reply
  • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube