Search code examples
pythonaudiolibrosa

Confused about Librosa.load Offset parameter


I am doing signal processing, and using librosa.load to load audio (librosa). But I am confused about the parameters in librosa.load(path, *, sr=22050, mono=True, offset=0.0, duration=None).

My question is the offset parameter, the offset in this reference means starting N seconds into the audio. However, does it actually call onset? Normally, the onset refers to the beginning of a musical note or the sound, and offset means the ending of a musical note.

Or perhaps I misunderstanding it?


Solution

  • You are correct that the offset is just a number of seconds into the clip from which to begin the load. The use of the word "offset" as an argument here is disconnected from the other meaning you are talking about. I think that is just a symptom of "term overloading" in different contexts (I think the true name for this is "semantic overloading").

    To detect where a musical note is beginning or ending automatically would require more work than the load method is doing: it is just simply loading the data of the sound file into an array of values. If you set offset to 2.0 (2 seconds) it would just skip the first sample_rate * 2 samples of the sound you are importing.