HARK-MUSIC Tutorial 1

Detection of a tempo and beat-times

Main Sheet Configuration

  • Required nodes
    • LOOP0 (This appears after you create an iterator sheet.)

 

LOOP0

  • Property settings (This appears after you set Iterator Sheet Configuration)

 

Name Type Value Explanation
LENGTH int 512 Number of samples for each frame
ADVANCE int 160 Shift length
SAMPLING_RATE int 44100 Sampling frequency of audio waveform data.
WINDOW_LENGTH int 512 Window length for FFT

 

  • Terminal Role settings (This appears after you set Iterator Sheet Configuration)
    • Right-click a TEMPO terminal, select Set as Output.

 

Iterator Sheet Configuration

  • Required nodes
    • AudioStreamFromMic
    • MultiFFT
    • BeatTracker

 

AudioStreamFromMic

  • Node Description

This node takes in a multichannel speech waveform data from a microphone array.
For more detail, see HARK Documentation.

  • Node Location
Node list > HARK:AudioIO > AudioStreamFromMic
  • Property settings
Name Type Value Explanation
LENGTH subnet_param LENGTH Number of samples in one frame
ADVANCE subnet_param ADVANCE Shift length
CHANNEL_COUNT int 2 Microphone input channel number of a device to use.
SAMPLINGRATE subnet_param SAMPLING_RATE Sampling frequency of audio waveform data loaded.
DEVICETYPE string ALSA Type of device to be used.
DEVICE string plughw:0,0 Character string necessary to access to device. Device name such as plughw:0,1 or IP address when RASP is used

 

  • Terminal Role settings

Right-click a NOT_EOF terminal, select Set as Condition.

 

MultiFFT

  • Node Description

Calculate FFT of input source stream.

For more detail, see HARK Documentation.

  • Node Location
Node list > HARK:MISC > MultiFFT
  • Property settings
Name Type Value Explanation
LENGTH subnet_param LENGTH Number of samples in one frame
WINDOW string HAMMING Window type for FFT
WINDOW_LENGTH subnet_param WINDOW_LENGTH Window length for FFT

 

BeatTracker

  • Node Description

This node detects tempo and beat-time from input music.

  • Node Location
Node list > HARK:MUSIC > BeatTracker
  • Property settings
Name Type Value Explanation
RELIABILITY-THRESHOLD float 0.1 When the reliability of a beat is higher than this value, this node updates tempo.
ADVANCE subnet_param ADVANCE Shift length.
SAMPLING_RATE subnet_param SAMPLING_RATE Sampling frequency of audio waveform data loaded.
MAX_BPM int 120 The maximum value of tempo to be output.
MIN_BPM int 60 The minimum value of tempo to be output.
VECTOR_FLAG bool false Whether the node outputs vectors or not.
LOG_FLAG bool false Whether the node output the log or not.

 

The value of ADVANCE and SAMPLING_RATE should be same as AudioStreamFromMic.
MIN_BPM is recommended to be a half of MAX_BPM.

  • Terminal Role settings

Right-click a TEMPO terminal, select Set as Output, and give the name as TEMPO.

 

 Examining the network file

1. Click Save button and save the network file, e.g. beattracker.n
2. Click Execute button to run the network.
3. Wait for a moment and click Stop button. You will see Stopped see more on Colsole.
4. Click see more link, then you will see a log like the following

UINodeRepository::Scan()
Scanning def /usr/lib/flowdesigner/toolbox
done loading def files
loading XML document from memory
done!
Building network  :MAIN
BeatTracker::BeatTracker
BeatTracker::count0Initialize
BeatTracker::realTimeBeatTrackerInitialize
beat_tracking initialize ended
Discard : 0.065
Discard : 0.495
Beat detected at time: 546
Rely!!! : 0.735 tempo: 73.8281
  • Log description
    • Discard means that a beat is detected but discarded because of its low reliability. The reliability value is shown after the colon.
    • Beat detected at time means that a beat is detected. The frame index is shown after the colon.
    • Rely!!! and tempo are connected to the detected beat the line above. The values after the colons show its reliability and the tempo in bpm, respectively.

Back to Top