Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Instruction Guide An extension to support OLED, IR control, and CD playback
#1
An Extension for Moode, including OLED display, IR control, and CD playback.

For now, it is running in an RPi4B with Moode 6.4.0.
With this extension, you can use the Apple Remote to control Moode in RPi4B and roon in Windows.

Basically, I just integrated the following posts.

  1. Thread Modes Instruction Guide AUDIOPHONICS RaspDAC Mini Kit - I-Sabre ES9038Q2M
  2. USB CD-Rom + Moode = UPnP streamer
  3. Playing CDs directly from MPD
  4. Automated CD ripping, tagging and adding to collection
These works have also been pushed to Github.


***NOTICE: Use these scripts at your own risk, some have not been fully tested!***

Demo

I use this system under these scenarios.

  1. NAS -> PRi4B(Moode) -> DAC
  2. CD Drive -> PRi4B(Moode) -> DAC
  3. ROON in Windows -> PRi4B(Roon Bridge) -> DAC
  4. ROON in Windows(Surface Go) -> HQPlayer(PC) -> PRi4B(NAA) -> DAC
The OLED display has 3 screens, including Date Screen, Play Screen, and Renderer Screen.
Date Screen: Display date and IP.
Play Screen: Display song info, only activate if Moode is playing.
Renderer Screen: Only activate if Moode is not playing but DAC is occupied.

The OLED display will go out after 10 seconds to prevent OLED burn-in and any key pressed on the Apple Remote will light it for 10 seconds.

[Image: Demo.jpg]




Hardware
Wire Connection

IR Receiver Module
The Argon One Case reserved a place for VS1838B, just connect it.
Insert Flirc USB IR Receiver into a windows pc.

OLED Module

[Image: OLED.jpg]


Installation
Requirements
  • Install roon bridge and NAA (optional).
  • Follow the instructions to ensure that the OLED module works properly.
  • Follow the instructions to ensure that the IR receiver module works properly. If you use the default position for IR in Argon One, the GPIO pin should be set as 23.
  • Use the following code to install packages required by CD playback.
    sudo apt-get install eject cdparanoia cdde inotify-tools
OLED Display
Code:
cd /home/pi
git clone https://github.com/TongboZhang/Moode_Extension.git
cd Moode_Extension
sudo chmod 755 src/OLEDDisplay/main.py
sudo cp src/OLEDDisplay/oledd.service /etc/systemd/system/

# Test OLED display
sudo systemctl start oledd

# Wait 10 seconds to start the service
sudo systemctl status oledd

# Make OLED service automatically start on boot
sudo systemctl enable oledd

Remote Control

Code:
sudo cp src/RemoteControl/apple-silver-A1294-lircd.conf /etc/lirc/lircd.conf.d/
sudo cp src/RemoteControl/irexec.lircrc /etc/lirc

# Test LIRC service
sudo systemctl start lircd
sudo systemctl status lircd

# Test IREXEC service
sudo systemctl start irexec
sudo systemctl status irexec

# Make LIRC and IREXEC service automatically start on boot
sudo systemctl enable lircd
sudo systemctl enable irexec

CD Playback

Code:
sudo chmod 755 geneCD.sh
sudo cp src/CDPlayback/99-srX_change.rules /etc/udev/rules.d/

When you insert a CD, it will generate a playlist named CDPlayer automatically.
[Image: CDPlayer.jpg]


Usage
After installation, you can use the Apple Remote to control Moode in RPi4B.

To control roon, you should set these key mapping in Flirc App.
Here is the key mapping of mine.


| Apple Remote Key Description                     |
| UP               | Moode: Previous Track           |
| DOWN             | Moode: Next Track               |
| Enter            | Moode: Play/Pause               |
| LEFT             | Roon in windows: Previous Track |
| Right            | Roon in windows: Next Track     |
| Play             | Roon in windows: Play/Pause     |
| Menu             | None                            |
Reply
#2
[My personal preference is to break out the various functions into separate guides since, for example, a user might want only to implement CD playback.]

Good stuff!

I'll restrict my comments to the CD playback portion of this post, and, please, consider this to be commentary by a techie, not criticism! The code here works. As I type I'm listening to a Stan Getz CD using this code.

There's considerable similarity between the udev rule and associated script here and the material Ashley Cox sent me on which we subsequently worked jointly. It was new to me but I'm guessing it's one of those "how everybody does it" things.

I think it's clever to create a playlist when the CD is inserted. Ashley and I were experimenting instead with adding the tracks directly to the MPD current queue. I can see pros and cons to both approaches.

However, while the code here creates the playlist when the CD is inserted, it doesn't remove the playlist when the CD is ejected [1], leaving a playlist of zombie tracks. Fixable with a change to the udev rule and the addition of another shell script. Note that ejecting the CD also turns into zombies any tracks already copied to the current queue. This is a hard one; even with the fixes I allude to, the user will have to clear the offending queue entries manually. As an aside, in my tests, if a CD track is playing at the moment the CD is ejected, playback continues until an internal buffer is emptied. On my test system, playback ceases some dozen seconds after the eject button is pressed. [2]

The code here doesn't deal with the case I ran into with the CD drive occasionally being enumerated as /dev/sr1 instead of /dev/sr0. Fixable with a change to geneCD.sh.

What remains is the challenge of modifying the moOde playback screen so we get something intelligent instead of strings like "cdda:///1", "File does not exist" and "Unknown artist - Unknown album".  One would  also like to display some sort of CD logo instead of the default moOde logo when a track is playing. Fixing these issues requires modification of core moOde code and is a work in progress.

Clearly I need to create a github repo of Ashley's and my work rather than just post to the forum. 

Regards,
Kent

[1] Indeed, I don't see any code here which deals explicitly with CD ejection. Perhaps I overlooked it?

[2] In our approach, we clear the queue when the CD is inserted and then load the CD track list into the queue. We stop the player and clear the queue when the disc is ejected. This avoids all the points I raised with my "however" paragraph. In the approach here, on the other hand, the current queue and the currently playing track may be from some other source and shouldn't simply be cleared.
Reply
#3
Hi Kent,

any progress here on CD playback facility with Moode?

Thanks again,

Greg
Reply
#4
(03-07-2021, 02:28 PM)gregvds Wrote: Hi Kent,

any progress here on CD playback facility with Moode?

Thanks again,

Greg

The Version 0 code in my moOdeCDPlay repo still works as far as I know. I haven't worked on Version 1 in a year for two reasons: 1) disruptive house moves and 2) loss of interest. After the novelty wore off, I realized that if I had a CD in my hands that I wanted to play once, then I wanted to rip it to my library so I can play it many times. Increasingly, I use streaming services for randomly sampling new music.

Regards,
Kent
Reply
#5
Thanks Kent for this. I'll try it, even if I think it will always be easier to put the CD in my usual CD transport.

If it helps me understand better linux stuff, rules, services and others, it's always a good thing :-).
Reply


Forum Jump: