annotate doc/Buzzer-melodies @ 837:724a6bc2a4b8

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