Fancy ringtones for the Yocto-Buzzer

Fancy ringtones for the Yocto-Buzzer

The Yocto-Buzzer is a small module enabling you to provide an acoustic ack to the user, which is particularly useful when you work with a mini-computer without a soundcard or when you work remotely through the network. To ease the use of the Yocto-Buzzer, today we present a simplified method to generate short jingles.

The Yocto-Buzzer is designed to produce simple beep-beeps, so don't expect symphonic polyphony. Nevertheless, as the module can play short series of notes, you can make it produce typical short acoustic sequences, suggesting an alarm, a confirmation, a failure, and so on.

The new method, that you can find in the version of the Yoctopuce library that we publish today, is called playNotes(string notes). It takes as argument a character string describing the notes to be played. It converts the notes into frequency sequences and plays the sequence once. Here is a short example:

To know how to write your own sequences, read the following section. If you don't have time, you can also skip directly to the section after that one, where we provide you with some ready-made sequences that you can use directly in your applications.

Coding note sequences

If you have some musical knowledge, you may have recognized the usual note letters: A, B, C, D, E, F, G. You can add a sharp (#) or a flat (b), and change the octave by prefixing the note with one or several single quotes (to go up) or with one or several commas (to go down). Without any other indication, its the octave closest to the preceding note that is selected:

You can modify the note duration by adding a numerical suffix, indicating a divisor with regards to a whole note. 1=whole note, 2=half note, 4=quarter note, 8= eighth note, 12=triplet, 16=sixteenth note, and so on. You can also add a dot as a suffix, with the usual musical meaning (increasing the duration by 50%). Without any other indication, the duration of a note is the same as that of the preceding note.

You can modify the overall tempo with the % indication. Without specific indication, the notes are played a with a speed of 100 quarter notes per minute (100%).

The R code allows you to introduce a rest. Its duration is coded in the same manner as the notes. You can also change the notes dynamic with the following suffixes:

  • ! for a staccatissimo note
  • ^ for a staccato note
  • _ for a legato note

Finally, you can make a glissando by prefixing a note with a dash (-):

If you don't yet have your own Yocto-Buzzer, you can perform some tests below to try the playNotes function:

Some examples

Here are a few sequences selected depending on the message you want to send:


Not okay...







And a few well-known themes ...

Can you recognize them ?

Add a comment No comment yet Back to blog

Yoctopuce, get your stuff connected.