---
title: 'How To: Generate an Audio Fingerprinting Data Set With Sox Audio Effects'
canonical: https://0110.be/posts/How_To%3A_Generate_an_Audio_Fingerprinting_Data_Set_With_Sox_Audio_Effects
markdown_url: https://0110.be/posts/How_To%3A_Generate_an_Audio_Fingerprinting_Data_Set_With_Sox_Audio_Effects.md
id: 391
published_at: '2011-12-07T09:42:13Z'
updated_at: '2013-12-05T18:19:15Z'
author: Joren
tags:
- name: Code
  markdown_url: https://0110.be/tags/Code.md
- name: HoGent
  markdown_url: https://0110.be/tags/HoGent.md
---

# How To: Generate an Audio Fingerprinting Data Set With Sox Audio Effects

A small part of Tarsos has been turned into a [audio fingerprinting application](https://0110.be/artikels/lees/Robust_Audio_Fingerprinting_with_Tarsos_and_Pitch_Class_Histograms). The idea of audio fingerprinting is to create a condensed representation of an audio file. A perceptually similar audio file should generate similar fingerprints. To test how robust a fingerprinting technique is, a data set with audio files that are alike in some way is practical.

[SoX - Sound eXchange](http://sox.sourceforge.net/) is a command line utility for sound processing. It can apply audio effects to a sound. Using these effects and a set of unmodified songs an audio fingerprinting data set can be created. To generate such a data set SoX can be used to:

-   Trim the first x seconds of a file

-   Speed-up or slow-down the audio

-   Change the pitch of a file without modifying the tempo

-   Generate background noise (white noise is used)

-   Reverse the audio stream

\`\`\`ruby\
#Trim the first 10 seconds\
sox input.wav output.wav trim 10

#speed-up of 10%\
sox input.wav output.wav speed 1.10

#change the pitch upwards 100 cents (one semitone)\
#without changing the tempo\
sox input.wav output.wav pitch 100

#generate white noise with the length of input.wav\
sox input.wav noise.wav synth whitenoise\
#mix the white noise with the input to generate noisy output\
#-v defines how loud the white noise is\
sox -m input.wav -v 0.1 noise.wav output.wav

#reverse the audio\
sox input.wav output.wav reverse\
\`\`\`

A ruby script to generate a lot of these files can be found "attached":\[audio_fingerprinting_dataset_generator.rb.txt\].


- [audio\_fingerprinting\_dataset\_generator.rb.txt](https://0110.be/files/attachments/391/audio_fingerprinting_dataset_generator.rb.txt)
