UbubtuMAME - Adding a Jukebox System

From JTSageWiki

Jump to: navigation, search

Contents

[edit] Picking a Jukebox Program

For my uses, I choose to use a python based solution called PyTone. PyTone is a music jukebox written in Python with a curses based GUI. While providing advanced features like crossfading and multiple players, special emphasis is put on ease of use, turning PyTone into an ideal jukebox system for use at parties.

Additionally, I found that PyTone can't easily be run in the background, so I will provide information for using MPD, the music player daemon instead.

custom term papers

[edit] Installing PyTone

Ubuntu has a package for PyTone, so simply use apt-get to install:

 mame@mame-machine:~$ sudo apt-get pytone

Configuration

Next, open the configuration file, /etc/pytonerc (use sudo).

The following settings must be changed - your playlist directory - be sure to create this:

   playlistdir = /home/playlists/

The location of your music files:

   musicbasedir = /home/musiclink/

Note: do NOT play music off of a SMB share. The Ubuntu smbfs package has a bug where if PyTone reads more than one file at a time (and it will), the whole system will freeze up for a while.

And enable the internal ASLA player (disable the oss player) - Uncomment:

   type = internal
   driver = alsa09
   device = default
   bufsize = 100
   crossfading = on
   crossfadingstart = 5
   crossfadingduration = 6

Edit the keybindings as needed, and save the file - when I wrote this, the playlist 'play this song now' function didn't seem to work. More to follow on this.

Adding to AdvanceMENU

First, we need to create the PyTone 'ROM':

 mame@mame-machine:~$ sudo mkdir /usr/share/advance/juke
 mame@mame-machine:~$ sudo touch /usr/share/advance/juke/Launch\ Jukebox.txt

Next, we add the emulator to ~/.advance/advmenu.rc :

   emulator "PyTone Jukebox" generic "/usr/bin/pytone"
   emulator_roms "PyTone Jukebox" "/usr/share/advance/juke/"
   emulator_roms_filter "PyTone Jukebox" "*.txt"
   emulator_altss "PyTone Jukebox" "/home/mame/.advance/juke-snap/"

Grab a nice PNG of a jukebox, name it "Launch Jukebox.png" and drop it in /home/mame/.advance/juke-snap/

The jukebox should now appear as another emulator under the menu. Note that this method can be used to launch just about anything. Coming next is an attempt to use AdvanceMENU to switch virtual terminals so that the jukebox can run constantly in the background.

Fixing the Skip To Track Function

To fix this problem, install the old version first - this will take care of a lot of dependencies (Note: in theory, the following install should face those same dependencies - who knows). Then, install a few more things:

 mame@mame-machine:~$ sudo apt-get install subversion python2.4-dev python2.5-dev libao-dev python-sqlite python-pysqlite2

Then, pull the build files (accept the fingerprint):

 mame@mame-machine:~$ svn co https://www.luga.de/svn/PyTone/trunk/

Next, is the build phase:

 mame@mame-machine:~$ cd trunk
 mame@mame-machine:~$ python setup.py build_ext -i

That should work - if it does not, let me know, it means I missed a dependency. Next, is the install phase.

 mame@mame-machine:~$ cd src
 mame@mame-machine:~$ sudo cp -r * /usr/lib/pytone/
 mame@mame-machine:~$ cd ../conf
 mame@mame-machine:~$ sudo cp pytonerc /etc/

Finally, re-do the configuration of /etc/pytonerc (Note: replace the file! It seems counter-intuitive, but a lot has changed, some options throw errors because they do not exist any longer). While you are there, it is advisable to change the keybindings at the bottom to something else (2 instances):

   playselectedsong  = alt-\n alt-KEY_ENTER
   playselectedsong = alt-\n alt-KEY_ENTER

Next, do a quick to check the version (PyTone 3.0.0-pre2 at time of writing):

 mame@mame-machine:~$ pytone -h

That's it!

[edit] Installing MPD

MPD is a multi-faceted program. On it's own, it can't do much of anything - it is a server application. But, with a nice little frontend - oh the fun we'll have.

First, use the package system to install MPD and the dependencies that we will need:

 mame@mame-machine:~$ sudo apt-get install mpd mpc ncurses-term libncurses5-dev libglib1.2-dev libglib2.0-dev

This list probably isn't exhaustive, but it should pick up the other needs as we go. Next, we should configure, and restart MPD (Ubuntu is just smart like that). Edit the file /etc/mpd.conf and change this line:

   music_directory         "/var/lib/mpd/music"

It needs to point to your music collection, and it should be readable by the 'mpd' user. Next, we should enable the ASLA player and mixer - find and uncomment:

   audio_output {
          type            "alsa"
          name            "my ALSA device"
          device          "hw:0,0" # optional
          format          "44100:16:2" #optional
   }
   mixer_type             "alsa"
   mixer_device           "default"
   mixer_control          "PCM"

Then, a simple restart will bring things in line.

 mame@mame-machine:~$ sudo /etc/init.d/mpd stop
 mame@mame-machine:~$ sudo /etc/init.d/mpd start

Next, we need to make sure that mpd finds all of our music. Simple run the command line interface mpc to rescan.

 mame@mame-machine:~$ mpc update

Front-End Configuration

This will take a bit of time, in the meantime, we should install a GUI of sorts. First, the console GUI. Grab NCMPC from http://hem.bredband.net/kaw/ncmpc/download.html

 mame@mame-machine:~$ cd ~/source
 mame@mame-machine:~$ wget http://hem.bredband.net/kaw/ncmpc/files/ncmpc-0.11.1.tar.gz
 mame@mame-machine:~$ tar xzvf ncmpc-0.11.1.tar.gz
 mame@mame-machine:~$ cd ncmpc-0.11.1
 mame@mame-machine:~$ ./configure

Assuming the works, we can build and install the program:

 mame@mame-machine:~$ make
 mame@mame-machine:~$ sudo make install
 

This program can be started with:

 mame@mame-machine:~$ ncmpc -c

We should add it to AdvanceMENU with the following in ~/.advance/advmenu.rc

   emulator "MPD Jukebox" generic "/usr/bin/ncmpc" "-c"
   emulator_roms "MPD Jukebox" "/usr/share/advance/juke/"
   emulator_roms_filter "MPD Jukebox" "*.txt"
   emulator_altss "MPD Jukebox" "/home/mame/.advance/juke-snap/"

Also, be sure the JukeBox 'ROM' exists:

 mame@mame-machine:~$ sudo mkdir /usr/share/advance/juke
 mame@mame-machine:~$ sudo touch /usr/share/advance/juke/Launch\ Jukebox.txt


Web Interface Configuration

If you are a real glutton for punishment, you can install a web interface for MPD so other machines on the network can interact with the jukebox. Try it, really, it's a lot of fun. Once again, the dependancies first:

 mame@mame-machine:~$ sudo apt-get install apache2-utils apache2-common apache2-mpm-prefork php5-common libapache2-mod-php5 php5-cli php-pear

This will install and start the apache server. Then, we want to retrieve a copy of Pitchfork from http://pitchfork.remiss.org/

 mame@mame-machine:~$ cd /var/www
 mame@mame-machine:~$ sudo wget http://pitchfork.remiss.org/files/pitchfork-0.5.0.tar.bz2
 mame@mame-machine:~$ sudo tar xvf pitchfork-0.5.0.tar.gz
 mame@mame-machine:~$ sudo mv ./pitchfork-0.5.0/* ./
 mame@mame-machine:~$ sudo chown -R www-data *
 mame@mame-machine:~$ sudo chmod 777 config

From there, point a web browser at the machine, and follow the prompts. The defaults should be fine.

[edit] Next Step

None - We Are Done!

[edit] Other Steps

   1.)  UbuntuMAME - Overview
   2.)  UbuntuMAME - Base System Install
   3.)  UbuntuMAME - Video Drivers
   4.)  UbuntuMAME - Clean-Up and Networking
   5.)  UbuntuMAME - Build and Install
   6.)  UbuntuMAME - Initial Configuration and Testing
   7.)  UbuntuMAME - Fine Tune Advance Configurations
   8.)  UbuntuMAME - Auto-Login and Auto-Start
   9.)  UbuntuMAME - Adding NES and Atari2600
   10.) UbuntuMAME - Adding a Light Gun
   11.) UbubtuMAME - Adding a Jukebox System
   12.) UbubtuMAME - Support Files for MAME - MESS
Personal tools