Access to the BPM Counting Algorithm
Werner Van Belle


There are three routes to hapiness. The first relies on the data streaming library we use. The second uses the BpmDj specific object to represent a song and te last one offers a commandline tool that processes .wav files.

Reading .idx files

The dataformat on disk is actually through a library I wrote for general purpose object streaming. It is documented at http://bpmdj.yellowcouch.org/doxy/group__data.html

The good thing with this library is that it contains a serializer to pretty print the binary content in ascii.

#include "data.h"
#include "data-io.h"

int main(int argc, char* argv[])
{
  Data t=DataBinner::read_file(argv[1]);
  DataTexter::write(t,stdout);
}

To link the demo program:

idx2txt: idx2txt.o data.a
    @echo " [link] "$@
    @$(LINK)  $^ -o idx2txt

shows how the library can be used. As a result on a binary index file it would print

0x00000002
{albums              : []
 author              : 'Moloko'
 composition         : []
 cue                 : +0l
 cuec                : +0l
 cuev                : +0l
 cuex                : +0l
 cuez                : +0l
 disabled_capacities : 0w
 file                : 'Moloko/TheOnlyOnes[Moloko].mp3'
 histogram           : []
 max                 : <1:signed4>
                          [+65536i +65536i]
 md5sum              : ''
 mean                : <1:signed4>
                          [+65536i +65536i]
 min                 : <1:signed4>
                          [+65536i +65536i]
 next                : []
 number              : ''
 period              : -1i
 power               : <1:float4>
                          [-1f -1f]
 prev                : []
 remix               : ''
 rythm               : []
 tag                 : 'New'
 time                : ''
 title               : 'TheOnlyOnes'
 version             : 'BpmDj v4.0'}

Through the Index object

The second route to hapiness is through an object called 'Index'. Documented at http://bpmdj.yellowcouch.org/doxy/classIndex.html. A demo on how to use this class follows:

#include "index.h"
#include "types.h"

int main(int argc, char* argv[])
{
  Index a(argv[1]);
  printf("Tempo: %s\n",a.get_tempo().get_charstr());
  printf("Cue x: %lld\n",a.get_cue_x());
}

To link:

index-demo: index-demo.o index.o spectrum-type.o sample4-type.o power-type.o \
    memory.o data.a types.o common.o song-information.o capacity.o \
    song-information.moc.o
    @echo " [link] "$@
    @$(LINK)  $^ -o $@

Using the command line tool

BpmDj contains a commandline tool called 'bpmcount' which takes a list of files as argument and which will produce a tab seperated output of tempo with the filename analyzed.


Copyright © 2000-2011 - Werner Van Belle - werner@yellowcouch.org - http://bpmdj.yellowcouch.org/