Quote:
Originally Posted by bezusheist
thanks !
i was not aware that sample "0" was actually a sample, i assumed it started at 1.
|
It can be numbered however you like so long as it is consistent.
Some languages seem "most naturally" zero-based, and other languages seemed to attract more programmers who like to start numbering array elements at 1. Some languages you can define arrays starting and ending at any number you like. I'm not a scholar on computer languages, especially newer ones. I usually tried to always use zero-based indexing just to help avoid errors. Trying to avoid accidentally handling a 1-based array as an 0-based array or vice versa.
At 44100 samplerate-- With 0-based indexing the first trigger is at sample 0 and the second trigger is at sample 44100. With 1-based indexing the first trigger is at sample 1 and the second trigger is at sample 44101.
Such issues ought to be very simple but it is easy to get confused and make mistakes.
One argument I favor for starting to number samples at sample 0-- I think it most logical to number seconds or milli, micro, or nanoseconds starting at 0. The song starts at time = 0 and then 1 nanosecond later the song is at 1 nanosecond, etc. Song starts at 0 and then 1 second later it is at 1 second. It would seem weird to me for song start to be at 1 second, or 1 millisecond, or 1 nanosecond.
But someone else might prefer to number the song start at 1 nanosecond or 1 second or whatever.
If going for 0-based time then it would be confusing to me to start counting samples from 1. Conversions between 0-based time and 1-based samples would make me confused and encourage me to make even more dumb mistakes than usual!