Category Archives: Code Samples

Useful code snippets and interesting coding ideas.

Display time as hh:mm:ss

For a shorter display when hours [or hh:mm] are not required, set the ‘short’ parameter to 1. To display hh:mm:ss without milliseconds, set the second parameter [places] to 0. The ’round’ parameter can be set to round up, round down or round to the closest whole number of seconds. For full details of all options, … Continue reading Display time as hh:mm:ss

How to detect a sound in just a few lines of code

The basic detection method is just one short line of code: What this does is to fetch consecutive samples from the sound *track* until a sample is returned with a non-zero value. A word of caution, SND-FETCH is destructive to the audio data. If *track* will be required later in the code, use SND-COPY to … Continue reading How to detect a sound in just a few lines of code