Compiling/Setting Up BpmDj


BpmDj can work with two soundcards or with one soundcard. These soundcards can be either located local or remote. In case two soundcards are used an external mixing desk is required, otherwise the bpmdj mini mixing desk will help you out. Below we will go through the different steps. Be sure to read everything carefully because some important program designs are explained.

Installing

Download The Software

First download one of the packages in the download section.

Requirements

To compile the software you need certain development tools. These are
  • the linux soundcard headers, either the OSS headers or the ALSA headers or both.
  • If you plan to use the ALSA driver, you will need alsalib
  • gcc
  • qt-designer (called designer),
  • qt header files
  • qt3.3
  • fftw3.0
  • To use the software you need mplayer

    Compiling

    To compile the source, you need to know certain things of your operating system. You need to know where the meta-object compiler is located (moc) and which version should be used. Yoiu need to know where the qt libraries are located and where the headers are located and these three pieces of information need to be comptaible. For instance the meta-object compiler (moc) needs to match the QT library you will use. Likewise, the qt header files need also to match the library you will use. In general it is very difficult to create a script that detects these things fully automatically. Therefore I've left these configuration things to the person who compiles the software.
    The locations of different programs, libraries and headers must be place in a file called 'defines'. Examples of defines file are provided. (defines.debian and defines.gentoo)

    Andreas Böhler reports that on SoL-Linux FFTW 3.0 needs to be compiled from scratch. When compiling fftw3 from source, only the static library is built. Since BpmDJ relies on the shared one, --enable-shared has to be passed to ./configure to build the shared library.
    Once this information is correct, the programs can be compiled using the make command.
    From version 2.1 on, there are different sound drivers. You can select which one to compile by using -D COMPILE_OSS or using -D COMPILE_ALSA. If you want to use the alsa driver, please include the correct headers and libraries (-lasound).

    Installing

    After compiling the software, you can install it system wide by using make install. This will install the software in /usr/local/bpmdj/. If you choose not to 'install' it make sure to extend your PATH environment variable with the directory that contains bpmplay and bpmdj-raw. If you only did a make, then you might need to add
    export PATH=.:$PATH
    before you start the program.

    Setting Up

    The Directory Structure

    BpmDj requires extra information (meta-information) to be present for every song. This information includes title, author, tempo, sound color and other information that might be useful. Normally, ID3 tags can be used for this. However, because not all mp3's can be modified (because they are on cdrom or are located on a shared medium), BpmDj will store this extra information in separate files. These files are stored in a directory ./index. The music files must be stored in a directory ./music.  Once a song has been indexed and a meta-file exists in the index directory, then the song must not move any more within the music directory. Of course the music directory can contain soft links to other locations within the filesystem. Also, when a meta-description of a song is available that is not within the music directory, the program will silently ignore the index file. At the moment the song is again available, it can be used again.

    To summarise, create at some place in your filesystem two directories.

    ./music
    ./index

    A First Start

    Find some Mp3's

    The program is centered around the use of Mp3's, hence without Mp3's there is nothing too demonstrate. Therefore, find some songs and move them to the music directory.  Beware, once a song is known to bpmdj, it should not move anymore within the music directory. Thus, if you have multiple cdrom filled with songs, you might use a convention to create cd<xyz> directories within the music directory:
    music/cd001
    music/cd002
    music/cd003

    Start The Program

    Now, go to the directory where the music and index directories are located. Start bpmdj by typing
    bpmdj
    The program will open and verify that all necessary components are available. (this should go smooth). Now, the file selector will pop up and we can start with importing the unknown songs.

    Import Mp3's

    To import new mp3's go to the SongManagement|Import MP3's. Now a box will pop up which will scan all the directories within the music directory. For every unknown mp3 file a  new index file will be created and the song will pop up in the main listbox.

    Configuring

    In order to play music, BpmDj will start a different process for every song. This process is called bpmplay. This allows you to configure every player seperately. E.g, it is possible to start a player on the first soundcard or on the second soundcard. It is also possible to start a player on a remote machine, or to start a player and send the output to a special 'local mixing' device. Below we will first discuss how a DSP device can be set up. Afterward we will ellaborate on how remote playing works and how Local playing to the same soundcard works.  Finally we wrap up the configuration by covering the decoder programs used.

    Setup the DSP Devices

    Depending on how you compiled the program, the player will be able to work with either ALSA devices or OSS devices.   To inform the player which driver and device to use go to Program|Preferences and modify the parameters of the first two players. To do so click on the configure button and select an appropriate device. The different devices are:

    1. Oss - Will use the OSS driver code to play sound. If you have an OSS driver select this an fill in the correct device in the OSS Tab. Please be aware that the OSS driver of ALSA will not work very well.
    2. Alsa - Will us the ALSA driver. This driver is quite good in the sense that it has accurate timing. If you select this device you must also select the correct hardware output in the Alsa Tab.
    3. None - In case, you only want to test the analyzing algorithms on a soundcard-lmess computer, choose this.
    4. BpmDj Local - If you only have one soundcard and one computer, then you might need to mix two players to one device. If you want to do this, select this option and choose an appropriate local channel in the Bpm tab. This option should only be used when you also start the bpmmix program.
    5. Xmms - will simply add the select song to the xmms queue.

    The decoder software

    During configuration of  the bpmplayer (reached through bpmdj Program|Preferences, the analyzers or players tabs, then the configure button), make sure to also click on the 'Decoder' image. There you need to select which decoder programs you don't want to use. If you don't the prorgam will fail with a 'one of the enabled capacities could not be found' kind of error.

    Once, the parameters are correct, the player should start playing the selected song.

    Local Playing: two cards, one machine

    In case you want to play at two different cards, make sure that you can play every card independently. Afterwards test whether you can play simultaniously. 

    Troubleshooting Tips:

  • Check the permissions of the dsp device
  • Check the permissions of the mixing device
  • If it really doesn't work, check whether the song can be played by mplayer, alsaplayer and/or xmms
  • Check whether there is enough free disk space
  • Go to the bpmdj root  and remove any left over raw files by doing 'rm *.raw'
  • If your working on one machine and are using ALSA drivers, make sure you can play two songs over the two DSP devices simultaneously. alsa-config is your friend.
  • Remote Playing: two cards, two machines

    In order to play remote, bpmplay will use ssh and scp. Nervertheless, quite a number of requirements should be satisfied. However once all the requirements are satisfied, playing itself is straightforward, just as if you were playing locally. In the checklist below we will assume that the remote host is called 'remote' and that the account under which we will work is called 'user'. The machine that will run the bpmdj main program is called the 'master'

    1- Install sshd on the remote machine.

    Configure it such that it allows public key or RSA key identification.
    The configuration file is probably located in /etc/ssh/sshd_config. The two options are

    RSAAuthentication yes
    PubkeyAAuthentication yes

    Also make sure that the sshd allows forwarding of X11 requests

    X11Forwarding yes

    2- Install ssh on the master machine.

    Create a local key for the user under which you run bpmdj. (ssh-keygen)
    Put the master public key in the  remote user .ssh/authorized_keys file.
    This can be done simply by concatinating the master key to it.
    Once this is done the following should immediatelly log in the master user on the remote machine without asking for a password.

    bpmdj@master:~$ ssh user@remote
    user@remote:~$

    3- Install the necessary binaries on the remote machine

    Install bpmdj on the remote machine, or copy the necessary binaries to it. These are (only for playing) bpmplay and bpmdj-raw.

    scp bpmplay user@remote:
    scp bpmdj-raw user@remote:

    Make sure to make them executable (chmod 755 ...) and
    directly accessible from a ssh (put export PATH=<wherever they are located>:$PATH) in your .bash_rc at the remote site. It seems that recent versions of bash are shipped with an 'interactive' shell test. If the shel is non interactive all other commands are ignored. As such it is importatnt to place the PATH directives in the beginning of the .bash_rc script.

    After this step, the following command (at the master side) should work

    ssh -X user@remote bpmplay

    should give an error box. If the display cannot be opened issue an

    xhost +

    command at the master.

    4- Test the Remote Player

    Now, everything should work for the remote player. However, before we do so, you must understand how the program works because it might remove files which you do not want to remove !

    When the player works remote it will
    Now that you understand this, you can test the remote player by doing:

    ./bpmplay --alsa --remote user@remote index/<somemusicindex>.idx

    5- Inform BpmDj of the setup

    Go to the preferences box, select players, and create a new player command. The device you should select is the device at the remote site. So if your remote machine uses alsa or oss, then you must select this as a driver. Afterward, fill in the remote box by putting user@remote in it.

    Local Playing: one card, one machines

    This setup requires the program ./bpmmix to run. This program takes similar parameters as ./bpmplay. It will form the 'stream merger' for the one sound card. It can do this by simply combining the input stream from the different players, or it can do this by putting a 'main' stream out to the left channel and a 'monitor' stream to the right channel. Once you get bpmmix to work, you can select the 'BpmDj local mix' driver in the 'preferences create player command' dialog box. One player should select channel 0, the other must select channel 1. This device has some pecularities which are explained in detail the BpmDj Mixer section.

    Decoder Configurations

    The BpmDj Player (bpmplay) is responsible for decoding a sound file before playing it. To achieve this the program relies on different decoders, including mpg123, mpg321, ogg123, mplayer and eventually others. This of course brings a problem with it. First - not all files are playable by the same decoder. E.g; some mpg3 files can be played by mpg123 but nog by mpg321, or other files can be played with mplayer but not with ogg123 and so on. Secondly - since multiple machines can be used, it might be possible that not all decoder programs are available at every host. To fix these problems bpmdj will asign a 'prohibited decoder' list to every song as well as remember which decoders can not be used on which host. The per-file prohibited decoders can be reached through Song|Info. The unavailable decoders on a per/player basis can be found in each player its setup section.


    Copyright (c) Werner Van Belle 2001-2007
    e-mail: werner@yellowcouch.org
    http://bpmdj.yellowcouch.org/