# Use Festival to read mpc status

**URL:** <https://discourse.mopidy.com/t/use-festival-to-read-mpc-status/1236>\
**Category:** Pi MusicBox (archive)\
**Created:** [May 20, 2016, 12:35pm UTC](https://discourse.mopidy.com/t/use-festival-to-read-mpc-status/1236 "2016-05-20T12:35:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steve\_Lambert](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/steve_lambert/32/1149_2.png) [@Steve\_Lambert](https://discourse.mopidy.com/u/Steve_Lambert)\
**Post date:** [May 20, 2016, 12:35pm UTC](https://discourse.mopidy.com/t/use-festival-to-read-mpc-status/1236/1 "2016-05-20T12:35:57Z")

</div>

I would like to use festival to read the title and artist of a now playing song, if anybody can point me in the right direction I would be grateful.

---

<div class="post-metadata">

**Author:** ![Steve\_Lambert](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/steve_lambert/32/1149_2.png) [@Steve\_Lambert](https://discourse.mopidy.com/u/Steve_Lambert)\
**Post date:** [May 21, 2016, 9:40am UTC](https://discourse.mopidy.com/t/use-festival-to-read-mpc-status/1236/2 "2016-05-21T09:40:05Z")

</div>

I’ve got most of it sorted out by using the script below, it works fine but it includes all the other bits from mpc status  
(i.e.[paused] #24/65 0:38/3:11 (19%) volume: 5% repeat: off random: off single: off consume: off) which I don’t really want read out. Is it possible to just get the artist and track title from mpc?

!/bin/bash  
write the mpc title and artist to a text file, and pause the currently playing track  
mpc -f %title% \> ~/title.txt; mpc -f %artist% \> ~/artist.txt; mpc pause  
introduce the track and artist  
echo "Hi Steve, the currently playing track is " | festival --tts  
read the track title  
festival --tts ~/title.txt  
echo “by the artist” | festival --tts  
and the artist is  
festival --tts ~/artist.txt  
resume playing track  
mpc play  
clear both text files for next time  
rm ~/title.txt  
rm ~/artist.txt

---

<div class="post-metadata">

**Author:** ![Steve\_Lambert](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/steve_lambert/32/1149_2.png) [@Steve\_Lambert](https://discourse.mopidy.com/u/Steve_Lambert)\
**Post date:** [May 21, 2016, 12:56pm UTC](https://discourse.mopidy.com/t/use-festival-to-read-mpc-status/1236/3 "2016-05-21T12:56:45Z")

</div>

Putting these 2 lines after writing the txt files and before festival reads them removes all but the first line and saves the file with it’s original name.

sed -i.bak ‘1!d’ ~/title.txt  
sed -i.bak ‘1!d’ ~/artist.txt

This topic could be removed now as I have sorted it - but it might be of interest to others.

---

<div class="post-metadata">

**Author:** ![Steve\_Lambert](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/steve_lambert/32/1149_2.png) [@Steve\_Lambert](https://discourse.mopidy.com/u/Steve_Lambert)\
**Post date:** [September 28, 2016, 8:56pm UTC](https://discourse.mopidy.com/t/use-festival-to-read-mpc-status/1236/4 "2016-09-28T20:56:12Z")

</div>

Have now found a neater way to do it and also send email with details at same time.

It’s called ~/current.sh and I use it from the 0 key on the remote.

#!/bin/bash  
#write the mpc title and artist to a text file, and pause the currently playing song  
mpc current -f “[This track is [%title% by]%artist%]” \> ~/titleartist.txt  
mpc pause  
festival --tts ~/titleartist.txt  
mpc play  
mpc current -f “[[%title% - %artist%]” | mail -s “Artist & title” an email address @ goes here  
#clear text file for next time  
rm ~/titleartist.txt

I have put a zipped copy of Pimusicbox for the Pi Zero including festival and lirc on the link below. It’s 850mb zipped and will need a 4gb card.  
When installed and with sound on, you should get a ‘tada’ then festival man will read time and date, then the ip address of the pi. To change it - as it will get annoying go to nano /opt/musicbox/startup.sh and change at the bottom of file.  
I think I’ve cleared any personal info from it, if you come across any please let me know so I can redo it.  
Hope it’s useful to somebody.

> **[Dropbox - Error](https://www.dropbox.com/s/g9q0688d5a472i8/Trial4gb.zip?dl=0)**
>
> Dropbox is a free service that lets you bring your photos, docs, and videos anywhere and share them easily. Never email yourself a file again!

---

<div class="post-metadata">

**Author:** ![jodal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/jodal/32/2564_2.png) [@jodal](https://discourse.mopidy.com/u/jodal)\
**Post date:** [February 19, 2026, 11:47am UTC](https://discourse.mopidy.com/t/use-festival-to-read-mpc-status/1236/5 "2026-02-19T11:47:23Z")

</div>


