Configuring Applications for GBD - andy3471/GBD GitHub Wiki

IMPORTANT

To avoid disappointment:

  • Do not proceed with this material if you haven't successfully completed the instructions in chapter ALSA Configuration.

  • Follow the instructions pertaining to audio player (vs. system) volume settings religiously.

  • If testing against .mp3, .flac (,etc) tracks rather than the original studio CD uncompressed PCM .wav versions, make an effort to use files that were encoded by an industry-standard file format converter. Transcoded formats or poor encodings (such as pirated .mp3 downloads from the Internet) and/or amateur recordings will only yield disappointing results.

Audio Player vs. System Volume Settings

To allow for predictive and realtime beat detection, the calibration used in the beat detection algorithm is inherently dependent on certain amplitude threshold levels in the PCM signals. To work generically across the variety of music genres, the calibration used in the beat detection algorithm assumes the standard studio volume settings for CD quality sound.

In this respect:

  • The volume settings for the audio player (e.g. mpv(1), mplayer(1), mixxx(1), etc) must be set to MAXIMUM. Shown below is a screenshot of smplayer(1)'s volume settings set to maximum:

  • The volume setting of the hardware mixer of the soundcard is what may be adjusted. Shown below are screenshots of Ubuntu's Unity Sound settings dialog:

    and the venerable ncurses interface for alsamixer(1):

Audio Player Config for GBD Client (ALSA PCM Plugin)

NOTE: For makers or GBD users on an OS other than GNU/Linux or wishing to use a standalone audio application setup (i.e. rather than the ALSA external PCM plugin interface), see Notes for GBD Client PCM Plugin Writers.

Examples with mpv(1) and mplayer(1)

The following command lines are used to specify the gbd virtual PCM device discussed in section Controlling ALSA Period Sizes via DMIX PCM Plugin. The -v (i.e. verbose) switch can be used to verify that mpv(1) or mplayer(1) is actually writing 1024 ALSA period sizes to the ALSA PCM pipeline, e.g.:

  • mpv(1)

      $ mpv -audio-device=alsa/gbd foo.mp3 -v [--no-audio-display]
      ...
      [ao] Trying audio driver 'alsa'
      [ao] Using preferred device 'gbd'
      ...
      [ao/alsa] Going to set final HW params:
      [ao/alsa] ---
      [ao/alsa] ACCESS:  RW_INTERLEAVED
      [ao/alsa] FORMAT:  S16_LE
      	...
      [ao/alsa] CHANNELS: 2
      [ao/alsa] RATE: 44100
      [ao/alsa] PERIOD_TIME: (23219 23220)
      [ao/alsa] PERIOD_SIZE: 1024
      [ao/alsa] PERIOD_BYTES: 4096
      ...
      [ao/alsa] period size: 1024 samples
      ...
      [cplayer] AO: [alsa] 44100Hz stereo 2ch s16
      [cplayer] AO: Description: ALSA audio output
    

    The optional --no-audio-display or --audio-display=no switch prevents the CLI mode MPV from popping up the cover art image (if available) of the audio file.

    • NOTE: For older versions of MPV, i.e. mpv --version less than v0.23.0:

      $ mpv -ao alsa:device=gbd foo.mp3 -v
      

      To upgrade MPV on Ubuntu, see for example Ubuntu Handbook, MPV Upgrade.

  • mplayer(1)

    $ mplayer -ao alsa:device=gbd bar.mp3 -v
    MPlayer 1.2.1 (Debian), built with gcc-5.3.1 (C) 2000-2016 MPlayer Team
    ...
    Trying preferred audio driver 'alsa', options 'device=gbd'
    alsa-init: requested format: 44100 Hz, 2 channels, 9
    alsa-init: using ALSA 1.1.0
    alsa-init: setup for 1/2 channel(s)
    alsa-init: using device gbd
    alsa-init: opening device in blocking mode
    alsa-init: device reopened in blocking mode
    alsa-init: got buffersize=12288
    alsa-init: got period size 1024
    alsa: 44100 Hz/2 channels/4 bpf/12288 bytes buffer/Signed 16 bit Little Endian
    AO: [alsa] 44100Hz 2ch s16le (2 bytes per sample)
    

Example with smplayer(1)

smplayer(1) is one of the many GUI frontends for the mpv(1) or mplayer(1) CLI utility. Once you are convinced that mpv(1)/mplayer(1) is actually writing 1024 ALSA period frames to the ALSA PCM pipeline, try the following configuration for smplayer(1):

  • Goto (Menu)Options >> Preferences or simply CTRL+P

  • Select Advanced. Then select the Options for MPlayer/mpv tab. Then, in the Options: edit box, specify the same -ao alsa:device=gbd audio output options used by the mplayer(1) CLI utility:

Example with mixxx(1)

Todo.

Example with audacity(1)

Todo.