Skip to main content
Version: 2.4.0

Sound

There is one piezoelectric speaker in the cube that plays sound. This piezoelectric speaker can play sound effects or melodies using MIDI note numbers within the cube using the following characteristic.

PropertyValue
Characteristic UUID10B20104-5B3B-4571-9508-CF3EFCD7BBAE
PropertiesWrite
DescriptorSound Control

Write operations

Playing sound effects

Sound effects on the cube can be played by writing the following configuration data. In the example, the "Mat in" sound effect is played.

Data locationTypeContentExample
0UInt8Control type0x02 (Play sound effect)
1UInt8Sound effect ID0x04 (Mat in)
2UInt8Volume0xFF (Max)

Sound effect ID

The sound effect ID is specified with values ranging between 0 and 10, and the correlation between the ID and the type of sound effect is as follows.

Sound effect IDType of sound effect
0Enter
1Selected
2Cancel
3Cursor
4Mat in
5Mat out
6Get 1
7Get 2
8Get 3
9Effect 1
10Effect 2

Volume

The volume can be specified with values ranging between 0 and 255, where 0 is volume 0 (off) and all the other values are the maximum volume.

Playing the MIDI note numbers

A melody can be played with a MIDI note number by writing the following configuration data. In the example "C5-D5-E5" is played on repeat.

Data locationTypeContentExample
0UInt8Control type0x03 (Play MIDI note number)
1UInt8Number of repetitions0x00 (Infinite)
2UInt8Number of operations0x03 (Three)
3UInt8Duration played0x1E (300 milliseconds)
4UInt8MIDI note number0x3C (C5)
5UInt8Volume0x1E (Max)
6UInt8Duration played0x1E (300 milliseconds)
7UInt8MIDI note number0x3E (D5)
8UInt8Volume0xFF (Max)
9UInt8Duration played0x1E (300 milliseconds)
10UInt8MIDI note number0x40 (E5)
11UInt8Volume0xFF (Max)

Data Structure and Operation

The data for this write operation has structure with a variable length as shown in the figure below.

Sound Sequence Data Structure

Operation is made up of the following three elements.

  • Duration played
  • MIDI note number
  • Volume

Number of iterations

Specifies the number of times Operation is repeated in the range from 0 to 255. 0 means "infinite times", and Operation repetition will not end until the next write operation is performed. In the range of 1 to 255, the indicator will turn off after repeating the specified number of times.

Number of Operation

Specifies the number of operations with values ranging between 1 and 59. If the value specified is smaller than the number of operations that follow, only the number of operations specified are repeated. If the value specified is greater than the number of operations that follow, an error occurs and the write operation is discarded.

Duration played

Specifies the length of time a MIDI note number is played, with values ranging between 1 and 255. The MIDI note number is played for 10 times the specified value in milliseconds.

MIDI note number

Specifies the MIDI note number that is played, with values ranging between 0 and 128. See MIDI note number and note name for the correlation with the note names.

Stop playing

[Playing sound effects] (#Playing-sound-effects) and [Playing MIDI note number] (#Playing-MIDI-note-number) can be stopped by writing the following configuration data.

Data locationTypeContentExample
0UInt8Control type0x01 (Stop playing)

Additional information

MIDI note number and note name

The correlation between the MIDI note numbers and note names is as follows: MIDI note number = 57 creates a 440 Hz sound, and MIDI note number = 128 creates no sound.

OctaveNote name
CC#DD#EFF#GG#AA#B
001234567891011
1121314151617181920212223
2242526272829303132333435
3363738394041424344454647
4484950515253545556575859
5606162636465666768697071
6727374757677787980818283
7848586878889909192939495
896979899100101102103104105106107
9108109110111112113114115116117118119
10120121122123124125126127