Code Monkey home page Code Monkey logo

amplipi's Introduction

AmpliPi Home Audio System

Build Status Coverage GPL License

AmpliPi

AmpliPi™ is a multi room/zone home audio controller and amplifier made for whole house audio systems with many zones. It can play up to 4 simultaneous audio sources, each of which can be selected from either its analog RCA input or any supported digital stream (Pandora, Spotify, AirPlay, etc). Each source can be routed to one or more zones, all of which are configurable in real-time using the self-hosted AmpliPi Web App or its underlying REST API. It is expandable up to 36 zones using AmpliPi Zone Expanders.

The AmpliPi design is entirely open source, from the software, to the firmware, to the schematics. The REST API and Web App are written in Python and run on a Raspberry Pi 3+ Compute Module. The firmware, which provides the low level volume control and zone configuration, is written in C and configured by the Python API over I2C. All of the internal circuitry comes with full schematics (available in this repo).

The system is self-hosted on the Raspberry Pi and is privacy-centric. By design, AmpliPi doesn’t listen to you or spy on you — it just plays your audio! The way it should be. An internet connection is only needed for some external streaming sources, such as Pandora. The Python application running on the Pi hosts a mobile-friendly website and REST API used to control the system. The website is built on top of the REST API.

High-level Schematic

Check us out on Kickstarter!

Features

AmpliPi can play many different types of digital streaming inputs. Most of the streaming services supported can be played as independent digital streams on all four sources at once; check out the Multiple? heading. Below is the current status of our digital stream integrations.

Most of these digital streaming services are provided by other open-source projects; check out the Provided By heading.

Streaming Service Supported Multiple? Metadata Provided By Notes
Pandora Yes Yes Yes Pianobar
Airplay Yes Yes Yes Shairport-sync Airplay 2 for one stream only.
Spotify Yes Yes Yes Librespot Requires Spotify Premium, one account per stream. See disclaimer
DLNA Yes Yes Yes gmrender-resurrect
Internet Radio Yes Yes Yes VLC
Plexamp No No No Plexamp See #200
FM Radio Yes No Yes rtl-sdr/redsea Requires RTL SDR compatible USB device
LMS Yes Yes No squeezelite Requires separate LMS Server
Bluetooth Yes No Yes bluezero See Bluetooth docs
Google Cast No Need to investigate
Offline Music No See #66
TIDAL No See #87

In the future we plan to integrate with several home automation systems. Below is their current status.

Integrations Supported Notes
Home Assistant Yes See https://github.com/brianhealey/hacs_amplipi
openHAB Yes See https://next.openhab.org/addons/bindings/amplipi/
Alexa No See #25
Google Assistant No See #69

Quick Start Guide

If you are one of the lucky few to have a pre-release version of the AmpliPi, see docs/QUICK_START.md to get started.

Wall Panel

Check out our open source wall panel here!

Official Wallpanel

Speakers

Notes on picking and installing speakers for whole house audio can be found here.

Developing

For details on how to help out with new features and bug fixes, check out docs/DEVELOPING.md.

Web interface

AmpliPi hosts a mobile-friendly web app that can control the system from any PC or mobile phone on the local network. Its design was based on the idea that each of the four audio sources could be controlled separately by different people in the house. Each audio source's controls are in their own tab at the top of the app.

Here's an example of changing group and zone volumes:

Changing group and zone volumes

Check out the full documentation for the web app at docs/WEB_APP.md.

The REST API

AmpliPi has a REST API that can be used to control volumes, switch and control audio sources, configure different streaming sources, and much more. It allows full configuration and real-time control of the AmpliPi device. The API conforms to the OpenAPI standard. It is fully documented on our AmpliPi OpenAPI site.

REST API overview

With the REST API, you can easily add automation to your home audio system. Use the API to trigger your AmpliPi system to play music based on smart home events. For example, only play music in zones of your house where motion has been detected, or start playing Pandora when the front door is unlocked.

Not quite sure how to accomplish this? No problem - The AmpliPi controller hosts its API documentation as well. Using a web browser pointed at your local AmpliPi box, you can view the API documentation, as well as test sending and receiving API commands to and from the AmpliPi.

Updates and Releases

Releases are available on GitHub, see CHANGELOG.md for the changes in each release.

To update you AmpliPi to the latest version:

  1. Go to the web app at amplipi.local.
  2. Click the gear icon (⚙) in the upper right corner to go to the configuration page
  3. Select Updates and click the Check for Updates button
  4. Click the Update button

If you don't see an update button, you have an older version of AmpliPi. It will take a couple more steps to update this time around.

  1. From a laptop or desktop computer download this update.
  2. Click the browse button to select the downloaded AmpliPi-0.1.9-uv-hotfix.tar.gz file.
  3. Click upload software to start the update, when it is finished it will navigate to the updated web app.
  4. Please be patient, updates can take 20-30 minutes and progress info will be reported slowly.
  5. The update will mistakenly fail with the message "Error checking version: NetworkError when attempting to fetch resource". Just go back to the app at amplipi.local to enjoy the new feaures.

For custom changes or offline updating, a .tar.gz file can also be uploaded to the AmpliPi. This can be generated from a git checkout with poetry version prerelease && poetry build. The release will be generated to the dist folder.

amplipi's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

amplipi's Issues

Add OLED display support

  • Device selection
  • Hello World example
  • Determine information we want to display (e.g. IP address, CPU usage, zone status, etc)
  • Create module to display AmpliPi information
  • Integrate with main codebase

Document pi configuration

  • Add simple download image and flash pi guide
  • Add step by step installation from base raspbian image

Add TFT Display Support

  • Test and verify hardware interface works
  • Port OLED interface
  • Add the name of the selected stream for each source, as well as 'playing' status
  • Add volume bars for 6 zones
  • Add volume bars for 12 and 18 zones
  • Get touch events
  • Test out touch location capabilities
  • Add paged interface - there is only 1 page for now but the framework is there
  • If default AmpliPi API URL doesn't work, try the debug port 5000
  • Show errors on disconnect
  • Create service to launch at startup
  • Add to configure.py for setup
  • Add logging
  • Detect if not a Raspberry Pi or no display connected and quit
  • Add documentation, maybe a little tutorial on debuging

Tabled until later:

  • Does it work as a normal display?
  • Investigate flickering when backlight is set to less than full brightness
  • Create mock display for tests

Streaming scripts are not executable

I checked the padnora error and output files. Looks like this needs to be added to update_config.bash to configure some of the scripts to be executable:

# make scripts executable
chmod +x eventcmd.sh shairport_metadata.bash 

Reorganize Project

  • Figure out basic folder structure, separating webapp for the ampli peices
  • split api.py into controller.py, preamps.py and utils.py
  • add simple test structure that can be built upon
  • Update README and add link to kickstarter and github hosted api documentation
  • Add license

Document System

  • Add pretty block diagrams of a multiunit system and each of the individual boards in a box
  • Add example house configuration / with blueprint like view and corresponding config file, and pretty pictures of in ceiling

Add spotify streaming

  • Try out librespot on linux
  • Fix space issues
    • install vollibrespot
  • Can multiple spotify's run at once? Any special config?
  • How much space does a single user account or librespot instance require? (<10% CPU, ~1% MEM)
  • Figure out --onevent for librespot (vollibrespot commands replace this)
  • Look at librespot github to potentially output more track information (outside of just title)
  • Make spotify config generator
  • Investigate and make song info parser
  • Investigate play/pause control
  • Investigate song selection (Seeking works, specific selection still requires Spotify app)

Kickstarter

  • Research other projects and kickstarters mentioned amplipi chat
  • Start Kickstarter on micronova account
  • Add Jason's Story
  • Add Product Marketing info
  • Add Early Devloper Access Section
  • Add Production specification
  • Add pretty pictures of units
  • Add pretty pictures of Jason's house
  • Take video of Jason using AmpliPi around the house
  • Document JSON API
    • create open api spec
    • host github api webpage with ReDoc
    • plumb api making sure it matches spec
  • Document Python code structure
  • Cleanup diagrams
  • Submit for review
  • Update website with kickstarter information
  • Go Live
  • Promote Kickstarter

Use a RAM disk for volatile configuration

AmpliPi uses an mmc on board the Pi Cm3+. To reduce the wear on the mmc, we should configure any volatile writes to use a RAM disk. Almost all of the stream config should be moved to this.

  • RAM directory creation at startup
  • Add pertinent config and metadata files to RAM
  • Figure out how much space is needed for the partition (100 MB or smaller)

Potential Feature: snapcast

Snapcast support

Snapcast is a multi-room client-server audio player, where all clients are time synchronized with the server to play perfectly synced audio.

The idea is that the AmpliPi could be either a client or a server for snapcast. For larger locations you could have 2 AmpliPis in different locations powering lots of zones but minimizing wiring issues/distance. For some homes you could have the home on an AmpliPi+extenders, and portable speaker(s) or a pi+amp powering a backyard zone.

Add Server Sent Events (SSE)

SSE will allow notification on change events to be sent when the system state is modified. The idea is that a client registers to receive types of change events and is alerted when they happen. This will be useful for enhancing our webapp and should be useful for many different types of home automation integration.

Feature: Upgrade AmpliPi's directory structure for debian releases

  • Update AmpliPi layout, from /home/pi expectations to more standard linux layouts /etc/amplipi.conf , /var/web/amplipi, /usr/local/lib/amplipi, /usr/local/bin/amplipi,
    • Decouple stream scripts from /home/pi (all other python is relative)
    • Add memory drive for /var/web/amplipi/generated (requires #76)
    • Make amplipi able to be used and developed on using the simpler base directory structure (you should be able to run the debug webserver (with real streams if you want) from a git checkout)
    • Add /etc/amplpi.conf config file that is checked when a local config file is not found

Layout:

config/house.json -> /etc/amplipi.conf # includes hints for this directory layout (stop saving this all the time)
streams -> /usr/loca/bin/amplipi/streams # streaming scripts
amplipi -> /usr/local/lib/amplipi
web -> /var/web/amplipi

We still need to figure out where to put documentation, and source code

Make source based view in the android app

  • Add Source input configuration
  • Add mute and volume control for zones connected to a source
  • Add Mute and volume control for groups
  • Migrate app to latest version with streams so pandora and shairport can be selected as inputs to a source

Feature Request: Add Alexa Skill

We would like to add full Alexa support for the following command structures

  • Support Volume up, volume down, mute controls to zones and groups of zones
  • Support Play ______ on (Pandora/Spotify/...) on (Group or Zone)

Some interesting links to investigate:
See: https://developer.amazon.com/en-US/docs/alexa/music-skills/steps-to-create-a-music-skill.html
Python audio support: https://github.com/alexa/skill-sample-python-audio-player/tree/master/MultiStream
Basic integration with Volumio: https://github.com/alior101/Alexa-Volumio-Plugin

Document Apis

  • Generate Python documentation
  • Generate REST API documentation
  • Add example automation scripts

Add an option to install Roon Bridge?

Roon is a widely used music player software which streams locally from a "core" on the LAN to audio devices that support network access. It can be supported on audio equipment, include Pi-based devices like AmpliPi, by downloading and installing the Linux version of Roon Bridge. It would be great if the AmpliPi web page had a button which would cause it to download and install Roon Bridge.

Add the concept of a Preset

The api should add the concept of a preset configuration.

The idea is to save specific setups and make them loadable. Here are a couple of instances I though of:

  1. Watching TV: Click the watching TV preset button and the 3 sets of speakers in your living room are connected and set to the normal TV volume levels
  2. Spotify Party: Click the Spotify Party preset and the whole house tunes to a started spotify instance with a party playlist loaded. Outdoor speakers are turned to a high volume, the rest of the house is set to a taking level volume.

This could be tied to the concept of a play event, where when a specific source starts playing a specific preset configuration could be loaded. This has the potential to minimizes the use of the webapp for common setups.

Once play events are added many additional presets could be added. For instance there could be a whole house shairport stream that when it was played started playing music and connected all of the zones in the house to the source.

PCB Files

Could you publish the PCB files, not in pdf schematics, but the actual files? I would like to build my own board for compute module 3.

Pandora stops playing after 30 minutes

  • Test with simple console pianobar without the streaming api, does it work for more than 30 minutes?
  • Add pianobar output to console to debug further if necessary
  • Fix issue discovered, does it need a retry/relogin? What is going on?

Feature: Plexamp for Raspberry Pi

  • Test Plexamp v1 with MPD and make any required changes
  • Created Plexamp stream class and config handler (server.json/mpd.conf)
  • Find out a better way to handle user information in server.json (potentially not required for a simple audio endpoint)
  • Song metadata? <- Handled atypically in Plex, and seemingly unavailable until a newer, headless version
  • Create documentation on how to use plexamp on AmpliPi
  • Implement install process
    • Packaging our changes with plexamp v1 for initial install
    • Adding reqs to configure script (uuid-runtime, node 9 install)
    • "Pin" nodejs at version 9.11.2
  • Implement Plex account connection in WebApp

I've put some work into adding Plexamp support for the AmpliPi system - this issue will detail my findings.

Thanks to odinb1's efforts (detailed here: https://github.com/odinb/bash-plexamp-installer) I was able to reach the current state. You can install plexamp on the Pi using their script, or you can follow the official install guide here: https://forums.plex.tv/t/plexamp-for-raspberry-pi-release-notes/368282

Be sure to include the workaround that OttoKerner linked in the post above. In either guide, you will have to edit the server settings @ /home/pi/.config/Plexamp/server.json. Odinb1 talks about this on their GitHub README.md - you'll have to get a working copy of server.json from an old desktop version of plexamp.

  • What's missing?
    Check out both of my forum posts (1 and 2) to get the bigger picture of where we're at. Currently, there doesn't seem to be a way to specify channels for plexamp. This is problematic, given the fact that every other source we provide has the ability to specify a channel (which is set in asound.conf). The de-obfuscated javascript for the RPi version of plexamp can be found here: https://gist.github.com/micronova-jb/c7bc03ae046ce6ce988d3062555ed6e3

Perhaps there's something hidden in there that we haven't been able to find - for now, plexamp plays on ch1, ch2, and ch3 when cast to. These are the channels associated with the USB sound card.

I will try to keep this issue up to date as more information comes out!

EDIT 3/30/21: Jason and I are both in an external channel of the Plexamp Slack. Elan recommended an earlier version of headless plexamp for Pi (ver. 1.x), so I'm trying that now. I don't see any differences so far.
https://files.plexapp.com/elan/plexamp-v1.0.5-pi.tar.gz

EDIT 4/19/21: The older version of Plexamp is working! We had to make some tweaks to the javascript (after de-obfuscating), but you are now able to select an audio device! We're still unable to get multiple running at the same time - it seems like this will take significant changes to the plexamp software.

EDIT 5/4/21: Gist of the file actually being used on the AmpliPi (difficult to read because it is fully obfuscated and on one line)
https://gist.github.com/micronova-jb/1156b1d04639284e5c6a354de4ec3002

De-obfuscated version:
https://gist.github.com/micronova-jb/e66e4a78ad3feaa655c292de64c189cd

Look for the specific changes around lines 25200 - 25205 in the de-obfuscated file. Basically, we have to tell it to use the MPD configuration, taking the device name. In mpd.conf, the audio device can be selected (e.g. ch2)

EDIT 5/12/21: Check out the new forum post - I detailed some more of the process here: https://forums.plex.tv/t/configuration-settings-for-playing-audio-on-a-specific-channel-of-a-usb-audio-device-connected-to-raspberry-pi/696974/11

Feature Request: PA

The "Monoprice 6 Zone Home Audio Multizone Controller and Amplifier Kit" has a cool feature which is a 3.5mm input jack for a Public Address system. It mutes the input audio and plays whatever comes in on the line and then resumes the channels back to where they were.

I think something similar, if not the same, would be really useful. It doesn't even need to be a hardware input jack for my use case.

Example use case: An automation in Home Assistant triggered on the doorbell that announces over the entire house that there is a visitor at the front door. If this could be done via API command that simply plays a specific audio file over all the speakers and then restores those speakers back to whatever they were playing before would be excellent.

Optionally if it could be done via ducking and not a complete cut out of the playing audio, just a lowering of the volume by some percent and the audio file played over top. If "ducking" vs "mute" could be controlled via the API command that would be even better.

Add preamp bootloading support

  • Test with stm32 python library
  • Fix BOOT0 and NRST pins values (pi config)
  • Add script and document its use for single preamp upgrade
  • Document expansion preamp programming

Feature Request: Add Mopidy and USB storage

Mopidy is an open source music player that can play local files as well as some online sources and has a full API.

This combined with USB storage would enable the AmpliPi to play completely offline music on the system without the need for Internet or a second device (other than a USB Storage plugged into one of the USB ports).

Add basic DLNA support

Make the real dynamic webapp

  • Architect static page elements and generate with jinja template
  • Plumb source input selection
  • Plumb volume control request response update sequence
  • Add mute toggle and change color of volume slider based on muted (changing volume should unmute)
  • Plumb add zone/group
  • Plumb Play/Pause/Next
  • Plumb pandora status

Webapp Feedback

Jason:

  • Hard to tell whats playing
  • Slow when changing whole house volume
  • Can groups be subgrouped? This could be used to handle whole house
  • The 2 second refresh resets the source choices if you are currently in the process of picking a new one #254
  • Whole house maxed volume after change sometimes
  • #392

Lincoln:

Matthew:

  • #334
  • Zone 1 shouldn't be at bottom, it should be at TOP! Groups go below zone maybe?
    • Michael - maybe just remove all groups from the default config?
  • Rename shairport stream name to airplay in stream selection
  • Quick start should tell user how to configure Pandora before using it.
  • Remove most of the streams from the default config.
  • Can zones be removed from a source? #332

Ben

  • Consider a zone (and group) based view #211

Mark:

  • Fix horizontal scrolling bug on small iphone 6
  • Volume sliders are laggy

Ed:

  • Add Group or Zone should really be a multi-selector #228

Michael:

  • The web interface's source selector should include the type of stream (Spotify, Analog X, DLNA, etc.)
  • #331
  • Sources, groups, and zones should be shown in a diagram on the API page
  • In the API documentation, it would be helpful to have a "Get available {Source/Group/Zone} IDs"
  • #332
  • #568
  • To mirror the Pandora interface, change the heart to a thumbs up (just Michael's suggestion)
  • Add the ability to export/import config
  • Don't fail loading config when a stream doesn't exist (basically support best-effort config loading)
  • Give feedback when a config is loaded to show success or failure
  • For the configuration section:
    • Rename all the "Stream" wording to "Input" in the Inputs config section
    • Rename Management to Configuration
    • #362

Rick:

Olek:

  • Add offline indicator for when you can connect to AmpliPi but it cant connect to the internet #326

Add Streams to Api

  • Prototype pandora handling with pianobar
  • Prototype shairport handling
  • Add stream concept to api
  • Plumb shairport support through stream api
  • Plumb basic pandora support through api (no play/pause, no change station, no acct configuration)
  • Add shell of set_stream api method
  • Add play/pause commands
  • Add station selection ( need to make get_stations command)
  • Add current song info for Pandora
  • Add current song info for Shairport
  • Update eventcmd.sh for pianobar sources to provide a ping when a new song starts (and currentSong updates)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.