Giter VIP home page Giter VIP logo

vinyl-cast's Introduction

Vinyl Cast

Listen to vinyl records wirelessly throughout your home using an Android device.


Vinyl Cast is an Android app used to wirelessly stream the audio of a vinyl record player (or any audio source for that matter) to Google Cast-enabled (Chromecast built-in) devices or groups.

The Vinyl Cast App makes use of Android's USB audio peripheral support, audio recorder, media codecs, Google Oboe libary, media APIs, and Cast API to stream the audio from a connected audio source to Cast-enabled devices.

Demo: YouTube

Website: Vinyl Cast

Note: The initial release of Vinyl Cast included using Audio ACR to detect the song being played, but unfortunately this feature relied on a now discontinued third-party library/service so the feature was removed. Other options are being explored to add this feature back to Vinyl Cast in the future.

Simple UI: Tap the record or play button to start streaming

The record in the app spins when actively streaming.

Required Hardware

πŸ“± Android Device

An Android device will be used to capture raw audio from your record player (or any analog audio source), perform audio format conversion (if selected), and act as a webserver to stream the digital audio stream to Cast-enabled devices. The Vinyl Cast app currently requires an Android device running Android 6.0 or later.

The app was developed and testing using a Nexus 6, Pixel 5C, and Pixel 3.

🎀 USB Audio Device

A USB audio interface is used to capture the raw audio from your Audio Source (e.g. record player) and make the analog audio stream available for recording/streaming by the Vinyl Cast app. If your analog audio source includes a USB interface, you can use this. If your record player only has analog audio output, I would recommend the Behringer UCA202 (without pre-amp), Behringer UFO202 (with pre-amp), or ART USB Phono Plus (a standalone pre-amp with USB interface but note while it has option to be powered externally, it ships without an external power supply).

The app was developed and tested using a Behringer UCA202.

Below devices determined to not be compatible with Android / Vinyl Cast:

πŸ”Œ USB Adapter

You will need a way to connect the USB Audio Device to your Android device. Typically, your USB Audio Device has USB-A male connector, and you will need a USB adapter/cable to attach the USB Audio Device to your Android device.

The USB adapter you need depends on the type of USB connector your Android device has (usually how you charge the device). If you have USB-C connector on your Android device, you'll need a USB-C to USB-A female adapter. If you have USB Micro-B connector, you'll need a USB OTG adapter from USB Micro-B to USB-A female. Note that USB adapters are now often included in the box with new Android phones to help transfer data from an old device (e.g. Pixel devices include a "Quick Switch Adapter" going from USB-C to USB-A female). Otherwise you can purchase one separately that should look like this USB Micro-B OTG cable or like this USB-C adapter.

An adapter with power passthrough like this one can be extra useful to be able to charge your Android device while also connected to your USB Audio Device.

🎢 Audio Source

You'll need an audio source (e.g. a vinyl record player) to provide audio input to the Vinyl Cast app. If you're not familiar, it could look like this.

πŸ“‘ Cast-Enabled Device

You'll need a Google Cast-enabled (aka Chromecast built-in) device hooked up to speakers to receive and playback the audio streamed from the Vinyl Cast app.

The app was developed and tested using a Google Home, Chromecast Audio, and Chromecast (2nd Generation).

Setup Hardware

The hardware should be set up as expected with the goal of recording audio from audio source via the Android device and wirelessly transmitting the audio to a Cast-enabled device.

Hardware Setup Flow Chart
Android Device πŸ‘‰ USB OTG Adapter πŸ‘‰ USB Audio Device πŸ‘‰ Audio Source
πŸ“‘
Cast-Enabled Device πŸ‘‰ Speakers

Get Casting

With the app installed and hardware setup:

  • open the Vinyl Cast app and open Settings via the gear (:gear:) icon
  • select a Recording Device (if connected, you should see your USB Audio Device in dropdown) - default: Auto select
  • select a Local Playback Device (if you want to hear the recorded audio on the Android Device speakers or USB output device) - default: None
  • select an Audio Encoding to adjust how much network bandwidth is used when streaming audio: WAV (lossless but more network bandwidth) or ADTC AAC (lossy but much less network bandwidth) - default: WAV
  • return to app home screen and tap the Cast button to begin a Cast sesion to a Cast-enabled device or group (for synced multi-room audio).
  • tap the vinyl record image or play button to begin audio recording & streaming

The vinyl record image will rotate to signify that the app is actively recording/streaming and a real-time spectral plot from the FFT of the raw audio (like a Graphic EQ) will give real-time feedback of the audio input.

Tap the record again to stop the stream or access controls via the Android playback notification.

Note there is about a ~10-20 sec audio delay in the playback on any Cast-enabled devices due to buffering of the media player of the Cast-enabled device.

Dev Notes

Google Oboe

Vinly Cast uses the Google Oboe library to access low-latency audio APIs on Android devices.

Audio Conversion

The app provides two choices for audio encoding: WAV and AAC. If AAC is selected, the app converts the raw 16 bit PCM stereo audio data captured from the USB audio device at a sample rate of 48kHz to an AAC LC 192kbps encoded stream with ADTS headers which is sent via HTTP 1.1 chunked transfer encoding.

Future Ideas

Audio ACR + Rich Notifications

Add Audio ACR to detect the current song being played and display the related metadata.

The song metadata is determined via audio acr (automatic content recognition) using fingerprints of the raw audio stream which upon successful matching, provides rich metadata for display and storage. The playback history is then stored in a local database for future features around sharing and analysis.

Check out what's playing from the notification bar or lockscreen.

Scrobble to Last.fm / Discogs / Twitter

The app can scrobble the listening history to Last.fm or update a user collection in Discogs or send out a tweet when a new record starts playing.

DJ Mode: add sound effects or record loops

With the raw audio stream, can add sound effects to the live stream [insert record scraaaatttch] or record loops of audio for later use.

Additional Analytics from Metadata

When a track is detected, there are additional traits available including genre, tempo, time progress, etc. Idea is to create insights into listening history data like what genre has been played the most, what record has been listened to the most or least, what's the favorite record for Tuesdays.

Client app to display metadata and provide controls

Since the Android device used is connected via USB to a record player, it's not very mobile while streaming. A client app can be created to run on a more-mobile device to display the latest metadata, access quick controls to pause/play, and even fetch playback history.

Record Flip Warning

If the track is detected, can give a warning based on track number and track progress time to notify the user that the side is about to be finished and will need to be flipped.

Android Things Support

This seems like a prime use case for an Android Things device to handle USB connection to record player and streaming audio. Android Things Developer Preview 2 did add support for USB audio devices.

During development, I attempted to use a Raspberry Pi 3 and Android Things DP 3, but routinely encountered a buffer overflow in the audio record thread. I did not investigate this issue any further.

Additional Hardware Integration

If the Android device is able to hook up to additional hardware devices (via GPIO or USB), idea is to build out additional-levels of hardware integration by modifying the record player hardware to be connected to the Android device and control the record player's start, stop, tone-arm position buttons via the app.

vinyl-cast's People

Contributors

aschober avatar kyleatmakrs avatar mtalbot03 avatar

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  avatar  avatar  avatar

vinyl-cast's Issues

Pixel 4 XL

HI. Your program refuses to work on my device, please tell me, will Vinylcast work if the sound is output not through chromecast, but through a 3.5 headphone jack?

Matter Casting - new/upcoming open protocol standard (so far only supported by Amazon)

Not as interesting as if adding support for Apple AirPlay casting, but request consider also looking into Matter Casting support someday.

"Matter Casting" is a new open protocol standard that is only a small part of the currently much-hyped Matter standard suite for IoT which is being lead and developed by the CSA (Connectivity Standards Alliance) and its very impressive list of member companies:

https://github.com/project-chip/connectedhomeip/blob/master/examples/tv-casting-app/APIs.md

https://github.com/project-chip/connectedhomeip/tree/master/examples/tv-casting-app

FYI, this is just an informal feature quest as an open discussion about this new open protocol that might become eventually a larger industry standard in the future as it is not proprietary like the competing Google Cast / Google Chromecast and Apple AirPlay.

"Matter Casting" is a technology that allows you to cast video and/or audio content from your smartphone, tablet, and computer to your TV or smart display. From an end-users point-of-view it will work the same thing as Google Cast and Apple AirPlay with one major difference: Matter Casting is a royaltee free and open protocol standward and will be based on common open-source code. That means it is a "free" casting standard designed from the ground up for cross-platform compatibility (with both Android, iOS devices, and various computer operating-systems being compatible from the start), allowing any developer to implement it into its products. Hopefullyy eventually ensureing wider-spread compatibility between devices of different manufacturers.

So the reason why I think this is interesting is that it is the first attempt by a large technology consortium (the Matter) to create also an open standard for local video and audio casting that is meant for broader adoption across different ecosystems for interoperability:

https://en.wikipedia.org/wiki/Matter_(standard)

https://csa-iot.org/newsroom/building-a-standard-that-really-matters/

https://csa-iot.org/all-solutions/matter/

Matter in general already has hundreds of member companies, but understand that not everyone has publicly commited to every part of that standard, as most have only announced support for the IoT parts that is controlling smart devices, however support for additonal device types is now being announced regularly

https://csa-iot.org/newsroom/matter-1-2-arrives-with-nine-new-device-types-improvements-across-the-board/

https://csa-iot.org/members/

Anyway, Matter Casting has so far 'only' been adopted by Amazon who announced that they will first add support to newer Amazon Fire TV and Amazon Echo Show series of smart display devices, and even it sounds as if they might initially only implement video streaming?

This is just hot from the press of the CES 2024 (Consumer Electronics Show, which is the lagest tech event in the world).

More interestingly, Amazon has now stated that they will not add support for Google Cast or Apple AirPlay casting to their devices:

https://www.aboutamazon.com/news/devices/amazon-ces-2024-announcements

https://csa-iot.org/csa_product/amazon-casting-video-player/

"Amazon is a long-time supporter of using open technology standards to give customers more choice over the devices and services they use in their homes. That’s also why Amazon is a founding member and key contributor to the Matter Standard. At CES, Amazon announced Matter Casting, which enables customers to cast content to Fire TV and Echo Show 15 devices directly from supported streaming apps on iOS and Android. Customers can begin watching a movie or browse for their next favorite show from Prime Video on their phone, and cast it to their compatible Fire TV device or Echo Show 15. This is an industry-first demonstration of implementing Matter Casting.

We are excited to work with Amazon to bring Matter Casting to the STARZ app. Matter has been easy to integrate and will provide even more options for customers to enjoy our extensive collection of original series and popular films on their device of choice,” said Alison Hoffman, STARZ President of Domestic Networks.

Matter Casting is available now for customers around the world who want to cast Prime Video content from iOS and Android devices to Echo Show 15. It will be coming to compatible Fire TV devices in the coming months, including smart TVs from Panasonic with Fire TV built in. We’re working with Plex, Pluto TV, Sling TV, STARZ, and ZDF to add Matter Casting support later this year."

https://www.engadget.com/amazon-wont-support-airplay-or-chromecast-but-will-adopt-matter-casting-instead-161933813.html

https://www.pocket-lint.com/what-is-matter-casting-amazon-open-casting-standard/

https://9to5google.com/2024/01/09/amazon-fire-tv-matter-casting/

https://www.theverge.com/2024/1/9/24030324/amazon-matter-casting-echo-show-fire-tv-prime-video

https://techcrunch.com/2024/01/09/amazon-adds-matter-casting-to-its-smart-displays-and-tvs/

https://www.macrumors.com/2024/01/09/amazon-unveils-matter-casting/

Disclaimer: Simply posted this for discussion since hoping for industry-wide adoption of an open standard for video and audio streaming in the future. I do not own any Amazon devices myself and do not plan on buying any (as personally already deeply invested in Google hardware, but if I ever migrate to a different ecosystem then decided it must be based on open standards).

When screen goes off/locks and music stops..

I've tried disabling power saving and battery saving altogether and removed it from being under "optimized battery". But it doesn't help. Does anyone have a solution?

I'm thinking getting a Y for USB-C and connecting power on there as well as the input USB device, and enabling screen always on when charging in developer options.

But please have an option for screen always on or dim the screen instead of going into a lock screen, because the app can't play in the background when it locks for some reason. I can play it in the background whilst doing other stuff on the phone though.

Lossless audio

Hello, this is an awesome project! I'm currently using Bluetooth transmitter to stream my turntable output to a wireless speaker (that supports Chromecast and AirPlay as well). Bluetooth has its limits when it comes to sound quality, so I am looking for a way to stream at the highest quality possible. Is there a reason the audio is converted to 16bit 192kbit AAC and not streamed in a lossless codec? By the way, I would connect my phone directly into https://www.project-audio.com/en/product/phono-box-ds2-usb/ which uses 48/96/192 kHz sampling. Would that work?

Fire HD tablet - FireOS

Massively dumb question - but I want to re-purpose one of my Fire HD tablets as a Vinyl-Cast machine. I'm getting a parsing error when installing the apk on a Fire HD 8 (Fire OS 5.6.4.0) and also a Fire HD 7 with Android 5.1.1. What's the minimum Android requirements for the 1.0.0 release?

Request: Dark Mode/Other Themes

This is a brilliant app, and I'd love to incorporate it into a standalone device for my Hi-Fi set up, but the current UI isn't something I'd want to incorporate into my current aesthetic. I think, even for now, just allowing the user to be able to select a customer background color (ideally including a pre-defined dark theme) would suffice without a full on redesign.

signal 11 (SIGSEGV), code 1 (SEGV_MAPERR)

The app keeps crashing when locking the phone.

I cloned the repo and debugged the app and found out that the file app/src/main/cpp/FullDuplexPassthru.h, line 64 the app starts to memset to invalid addresses.

Commented the code out and working, I wonder if we can check the lifecycle of the app and not call memset there.

I even wonder if that code is REALLY needed

Silence and Stuttering

When running this, one thing that has been noticed is that the audio will play fine for a few seconds, and then silence, and maybe bits and pieces in between.

It is able to determine what is playing.

Is this an issue with streaming? What could be done?

Crashes on samsung galaxy note 9

hi, i bought a usb c to usb b cable since my record player has a usb slot. But whenever i open the app and start streaming to my google home group is stops the app. When i try again i sometimes are able to listen to it for like 30 secs before is crashes again. I downloaded the app from the play store.

If i cast without the usb plugged in the app works obviously without music but when i plug in the usb again it stops right away.

The error i am getting is "vinylcast keeps stopping".

No audio from App - Turntable with USB output

First of all, thanks you Allen for all the time you've invested in this great project!

I can't get it to work, but I feel I'm very close - maybe somebody has a hint that can help me.

I'm using a LG G4 (LineageOS 15.1, Android 8.1). OTG mode seems to work fine - I can connect and use a mouse and an USB stick. Vinyl-Cast recognizes my turntable (Teac TN300) as a USB device. I can connect to my Chromecast Audio at home and hear the chord sound through my speaker. But when I activate Vinyl-Cast, no audio arrives comes out my chromecast device.

When I select the phone's speaker as output device, I don't hear anything, so most likely Vinyl-Cast is not receiving proper audio from the USB device. I remember seing something like 48kHz sampling rate in the settings menu, so some sort of audio stream is received by the app.

Anybody has experience in connecting a turntable with USB output?

App Crashes

App Crashes frequently on Galaxy S7 running android 7. Occasionally crashes after cast connection, always crashes after pressing the vinyl record icon to start stream

How to install

Hello , @aschober !

Could you please explain how to install this software on android (if i'm not coder).
I can't find a *.apk file. And there is no "Vinyl Casto" on GooglePlay.

Thank you!

upd
i have found the answer: #1

[REQUEST] Vinyl Cast "Music Provider" for "Music Assistant" (a.k.a. MA) for streaming high-quality audio directly to MA via Snapcast, Icecast or other streaming protocol?

@aschober Have you heard about Music Assistant (MA) project and any chance you be interested in adding support for using it?

The "Music Assistant" server is a music-streaming cross-ecosystem interoperability open-source software project that can work as a standalone product but is actually tailored to use side-by-side integration for Home Assistant (home automation software) as an addon.

Read this article announcement about new Music Assistant 2.0 release explaining how it works (and integrates with Home Assistant):

https://www.home-assistant.io/blog/2024/05/09/music-assistant-2/

Unfortunately it sounds as if Music Assistant can only stream to Google Cast speakers, it can not act as a Google Cast reciever itself?

Would be great if was easy to use Vinyl Cast to stream high-quality audio that is recieved by a "Music Provider" inside Music Assistant.

https://music-assistant.io/music-providers/

Any chance you consider building a solution that could achieve the concept of a Vinyl Cast "Music Provider" for Music Assistant?

https://music-assistant.io/music-providers/url

Music Assistant has support for manually adding radio station URLs to the database. You can for example You can add any online station or your locally created stations using, such as for example Icecast:

https://music-assistant.io/faq/stream-to/

I Want To Stream To - Music Assistant: "You could use Darkcast to stream to Icecast which in turn sets up a web radio stream that you could add to MA! You could use this to stream your turntable around the house for example. Here is a generic tutorial and for those that like a nice step by step look here. For input a HiFiBerry could be used or a USB Audio Interface like this one or this one"

https://en.wikipedia.org/wiki/Icecast

https://icecast.org/

It is possible to stream directly from app like Vinyl Cast if it implemented something like Darkice and Icecast? See examples: here

Streaming: On the Raspberry Pi, two critical software components come into play:

  • Darkice: This live audio streamer captures the digital audio and encodes it into a streamable format.
  • Icecast: This streaming media server takes the encoded audio from Darkice and broadcasts it, making it accessible to listeners over the internet.

Android TV support

Can't run app on android tv. Would be good to listen turntable on tv.

Releases

Can you release and add the apks to github

Won't work with Google Pixel 3XL

When I hit play, I can't hear anything out of my google speaker. I have everything needed for set up but when I plug the USB in, I still hear no sound. I tried playing with the settings, changing usb converters, and nothing is working. It might be because my pixel phone won't let me switch from charging to a different usb mode. I tried messing with developer settings as well. Any idea on what I can do to get to it to work?

Delayed audio

Hi, I am using the generated APK from the repo, when using it through UFO202 it seems to be delay (like 5 sec), I can say it by scratching the vinyl, but if I play it through the phone speaker the delay is minimum, can it be the UFO202 the problem or network related?

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.