Skip to content

Commit 0d271a7

Browse files
committed
media: vidtv: fix some notes at the tone generator
The sheet music used to generate the tones had a few polyphonic notes. Due to that, its conversion to a tones sequence had a few errors. Also, due to a bug at the tone generator, it was missing the pause at the initial compass. Fix them. While here, reduce the compass to 100bpm. The music was converted from a Music XML file using this small script: <snip> my $count = 0; my $silent = 0; my $note; my $octave; print "\t"; while (<>) { $note = $1 if (m,\<step\>(.*)\</step\>,); $octave = "_$1" if (m,\<octave\>(.*)\</octave\>,); if (m,\<alter\>1\</alter\>,) { $note .= "S"; $sharp = 1; } if (m,\<rest/\>,) { $note = "SILENT"; $silent = 1; } if (m,\<duration\>(.*)\</duration\>,) { printf "{ NOTE_${note}${octave}, %d},", $1 * 128 / 480; $count++; if ($silent || $count >= 3) { print "\n\t"; $count = 0; $silent = 0; } else { print " "; print " " if (!$sharp); } $sharp = 0; $note = ""; $octave = ""; }; }; print "\n"; </snip> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
1 parent ab6bad0 commit 0d271a7

1 file changed

Lines changed: 20 additions & 18 deletions

File tree

drivers/media/test-drivers/vidtv/vidtv_s302m.c

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,9 @@ struct tone_duration {
7878
int duration;
7979
};
8080

81-
#define COMPASS 120 /* beats per minute (Allegro) */
81+
#define COMPASS 100 /* beats per minute */
8282
static const struct tone_duration beethoven_fur_elise[] = {
83+
{ NOTE_SILENT, 512},
8384
{ NOTE_E_6, 128}, { NOTE_DS_6, 128}, { NOTE_E_6, 128},
8485
{ NOTE_DS_6, 128}, { NOTE_E_6, 128}, { NOTE_B_5, 128},
8586
{ NOTE_D_6, 128}, { NOTE_C_6, 128}, { NOTE_A_3, 128},
@@ -120,26 +121,27 @@ static const struct tone_duration beethoven_fur_elise[] = {
120121
{ NOTE_E_5, 128}, { NOTE_D_5, 128}, { NOTE_A_3, 128},
121122
{ NOTE_E_4, 128}, { NOTE_A_4, 128}, { NOTE_E_4, 128},
122123
{ NOTE_D_5, 128}, { NOTE_C_5, 128}, { NOTE_E_3, 128},
123-
{ NOTE_E_4, 128}, { NOTE_E_5, 255}, { NOTE_E_6, 128},
124-
{ NOTE_E_5, 128}, { NOTE_E_6, 128}, { NOTE_E_5, 255},
124+
{ NOTE_E_4, 128}, { NOTE_E_5, 128}, { NOTE_E_5, 128},
125+
{ NOTE_E_6, 128}, { NOTE_E_5, 128}, { NOTE_E_6, 128},
126+
{ NOTE_E_5, 128}, { NOTE_E_5, 128}, { NOTE_DS_5, 128},
127+
{ NOTE_E_5, 128}, { NOTE_DS_6, 128}, { NOTE_E_6, 128},
125128
{ NOTE_DS_5, 128}, { NOTE_E_5, 128}, { NOTE_DS_6, 128},
126-
{ NOTE_E_6, 128}, { NOTE_DS_5, 128}, { NOTE_E_5, 128},
127-
{ NOTE_DS_6, 128}, { NOTE_E_6, 128}, { NOTE_DS_6, 128},
128129
{ NOTE_E_6, 128}, { NOTE_DS_6, 128}, { NOTE_E_6, 128},
129-
{ NOTE_B_5, 128}, { NOTE_D_6, 128}, { NOTE_C_6, 128},
130-
{ NOTE_A_3, 128}, { NOTE_E_4, 128}, { NOTE_A_4, 128},
131-
{ NOTE_C_5, 128}, { NOTE_E_5, 128}, { NOTE_A_5, 128},
132-
{ NOTE_E_3, 128}, { NOTE_E_4, 128}, { NOTE_GS_4, 128},
133-
{ NOTE_E_5, 128}, { NOTE_GS_5, 128}, { NOTE_B_5, 128},
134-
{ NOTE_A_3, 128}, { NOTE_E_4, 128}, { NOTE_A_4, 128},
135-
{ NOTE_E_5, 128}, { NOTE_E_6, 128}, { NOTE_DS_6, 128},
130+
{ NOTE_DS_6, 128}, { NOTE_E_6, 128}, { NOTE_B_5, 128},
131+
{ NOTE_D_6, 128}, { NOTE_C_6, 128}, { NOTE_A_3, 128},
132+
{ NOTE_E_4, 128}, { NOTE_A_4, 128}, { NOTE_C_5, 128},
133+
{ NOTE_E_5, 128}, { NOTE_A_5, 128}, { NOTE_E_3, 128},
134+
{ NOTE_E_4, 128}, { NOTE_GS_4, 128}, { NOTE_E_5, 128},
135+
{ NOTE_GS_5, 128}, { NOTE_B_5, 128}, { NOTE_A_3, 128},
136+
{ NOTE_E_4, 128}, { NOTE_A_4, 128}, { NOTE_E_5, 128},
136137
{ NOTE_E_6, 128}, { NOTE_DS_6, 128}, { NOTE_E_6, 128},
137-
{ NOTE_B_5, 128}, { NOTE_D_6, 128}, { NOTE_C_6, 128},
138-
{ NOTE_A_3, 128}, { NOTE_E_4, 128}, { NOTE_A_4, 128},
139-
{ NOTE_C_5, 128}, { NOTE_E_5, 128}, { NOTE_A_5, 128},
140-
{ NOTE_E_3, 128}, { NOTE_E_4, 128}, { NOTE_GS_4, 128},
141-
{ NOTE_E_5, 128}, { NOTE_C_6, 128}, { NOTE_B_5, 128},
142-
{ NOTE_C_5, 255}, { NOTE_C_5, 255}, { NOTE_SILENT, 512},
138+
{ NOTE_DS_6, 128}, { NOTE_E_6, 128}, { NOTE_B_5, 128},
139+
{ NOTE_D_6, 128}, { NOTE_C_6, 128}, { NOTE_A_3, 128},
140+
{ NOTE_E_4, 128}, { NOTE_A_4, 128}, { NOTE_C_5, 128},
141+
{ NOTE_E_5, 128}, { NOTE_A_5, 128}, { NOTE_E_3, 128},
142+
{ NOTE_E_4, 128}, { NOTE_GS_4, 128}, { NOTE_E_5, 128},
143+
{ NOTE_C_6, 128}, { NOTE_B_5, 128}, { NOTE_A_5, 512},
144+
{ NOTE_SILENT, 256},
143145
};
144146

145147
static struct vidtv_access_unit *vidtv_s302m_access_unit_init(struct vidtv_access_unit *head)

0 commit comments

Comments
 (0)