comparison doc/Buzzer-melodies @ 831:2f401860e9ad

documentation update for buzzer melodies
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 31 May 2021 04:24:22 +0000
parents
children 2b5f4736079c
comparison
equal deleted inserted replaced
830:07105f244424 831:2f401860e9ad
1 The Calypso chip includes a built-in hardware provision for driving
2 old-fashioned cellphone ringing buzzers. Not all Calypso phones use a buzzer
3 as their ringing noise generator - many of the higher-end Calypso phones like
4 Mot C155/156 and Pirelli DP-L10 use a loudspeaker driven by a MIDI player chip
5 instead, and it appears that the legendary TSM30 phone may have used TI's
6 Melody E1 mechanism as its ringer. However, Motorola C11x/12x and C139/140
7 phones do use an old-fashioned buzzer, and in FreeCalypso we also work with some
8 development boards that include one. Having thus established the relevance of
9 the buzzer feature for FreeCalypso, we have done a bit of work toward exercising
10 the buzzer and playing melodies through it. This article describes the
11 available support for buzzer melodies in FC host tools.
12
13 Buzzer hardware capabilities
14 ============================
15
16 The actual noise-making element in phones like Mot C1xx appears to be a magnetic
17 buzzer - I previously assumed that it was a piezoelectic buzzer, but this
18 assumption now appears to be incorrect. However, the relevant capabilities of
19 this old-fashioned cellphone ringing buzzer are determined not so much by the
20 physics of the actual noise-making element, but by the circuit with which it is
21 driven. The buzzer is controlled by a single-bit digital output from the
22 Calypso chip, different tone frequencies are generated by Calypso as digital
23 square wave outputs, and different power control levels (for louder or softer
24 ringing sound volume) are produced by applying PWM to the "on" phase of the tone
25 square wave.
26
27 The Calypso chip allows its buzzer output to be driven with one of two different
28 internal logic blocks: either BU or PWT. We don't have any authoritative
29 documentation for TI's earlier DBB chips prior to Calypso, but it appears that
30 LT and BU functions for light and buzzer control came first, built into the
31 ARMIO block which appears to precede the GSM Skunkworks business altogether, and
32 then at some later point the alternative PWL and PWT implementations were added.
33
34 When driven as BU, Calypso buzzer output can produce 255 different frequencies
35 ranging from 99 Hz to 12.7 kHz, produced by taking the 13 MHz master clock,
36 dividing it by 512, and then dividing it again by a programmable integer factor
37 in the range [2,256]. This mode of driving the buzzer works ideally when
38 non-musical output frequencies are needed, i.e., frequencies that are expressed
39 in absolute Hz rather than musical notes.
40
41 PWT appears to have been added specifically to facilitate playing of ringtones
42 that are composed of musical notes. Compared to the range of 255 possible
43 frequencies that can be produced by BU, PWT can only produce 48 different tone
44 frequencies, but these 48 possible PWT frequencies are special in that they
45 closely approximate the 48 musical notes ranging from F4 to E8 in the scientific
46 pitch notation. These 48 musical notes of PWT range cannot be reproduced as
47 distinct frequencies in BU mode: at the upper range beginning with A6, two or
48 three different notes collapse to the same BU tone frequency, as the possible
49 frequencies that can be produced from 13 MHz by the simple division implemented
50 in BU get farther apart than successive notes of the chromatic scale. Thus if
51 you are seeking to play ringtones that are composed of musical notes, use of PWT
52 should be considered mandatory rather than optional. OTOH, if you are playing
53 non-musical tones like SIT that are defined in absolute Hz, then BU will often
54 work better.
55
56 Concept of buzzer melodies
57 ==========================
58
59 The Calypso buzzer (either BU or PWT) is monophonic, meaning that it can only
60 play one note at a time. Given this constraint, a playable buzzer melody can be
61 defined as a list of {tone, volume, duration} tuples, where <tone> is the
62 frequency to be played (BU or PWT), <volume> is the relative volume for this
63 note (PWM volume control), and <duration> is how long this note should sound.
64
65 The definitions for <tone> and <volume> are straightforward - they are numbers
66 going directly into hardware registers - but in what units should the duration
67 of notes be reckoned? In FreeCalypso we have adopted TDMA frames of 4.615 ms
68 (or more precisely 60/13 ms) as our unit of duration for buzzer melodies, based
69 on this reasoning: if playing of buzzer melodies is to be incorporated into
70 operational phone handset firmware, then TDMA frames will be the only time unit
71 that is available natively and directly, whereas any other measurement such as
72 milliseconds would have to be converted to TDMA frames by the firmware code.
73 Therefore, it makes the best sense to reckon all note durations in our buzzer
74 melodies in TDMA frames to begin with.
75
76 FC host tools support for buzzer melodies
77 =========================================
78
79 We have a target utility (running on Calypso devices out of RAM) called
80 buzplayer, and a front end host program called fc-buzplay. If you load and run
81 buzplayer manually via fc-iram, you can use it to exercise the buzzer manually,
82 playing any tone at any volume, in either BU or PWT mode. fc-buzplay is a
83 higher-level tool that reads buzzer melodies from ASCII text files (our own
84 simple ad hoc format), feeds them to buzplayer on the target, and commands
85 buzplayer to play the uploaded melody.
86
87 Further documentation will be written if and when a more actual need arises for
88 this functionality - right now the primary direction within FreeCalypso is
89 toward our own handset hardware, and the Mother's intent for our FreeCalypso
90 Libre Dumbphone handset is to use a loudspeaker and Melody E1 for ringtone
91 generation, as opposed to the buzzer output.