最近在做一个erricsson,nokia铃声的编辑程序,程序中主要麻烦的是发送和试听,试听我是先把文本格式转化成midi,再实现播放。现将其中我收集的铃声格式和midi格式发布如下:
ericsson:
有2种,早期的都是emelody,据我所知,现在只有i68i支持imelody,不过我不知道其余型号
的手机可不可以通过升级软件来支持imelody.
-------------------------------------------------------------------------------------------
eMelody Object
.
eMelody Format
Description: This is a definition of the eMelody object. This object is used when a user-defined
melody is exchanged
Syntax: <emelody-object>
ieBEGIN:EMELODYle<CR><LF>
ieNAME:lE<name><CR><LF>
ilCOMPOSER:l> <composer><CR><LF>
ieVERSION:l> <version><CR><LF>
ivMELODY:lC<melody><CR><LF>
ivEND:EMELODYll
File extension: emy
Example filename mymelody.emy
Parameters:
<version>: "1.0"
<name>: Alphanumeric string
<composer>: Alphanumeric string
<melody>: {<pause>|<tone>}
<pause>: "p"
<tone>: {[<octave_prefix>]<basic_tone>}
<basic_short_tone>: "c"|"d"|"e"|"f"|"g"|"a"|"b"
<ess_short_tone>: "(b)d"|"(b)e"|"(b)g"|"(b)a"|"(b)b"
<iss_short_tone>: "#d"|"#e"|'"#g"|"#a"|"#b"
<basic_long_tone>: "C"|"D"|"E"|"F"|"G"|"A"|"B"
<ess_long_tone>: "(b)D"|"(b)E"|"(b)G"|"(b)A"|"(b)B"
<iss_long_tone>: "#D"|"#E"|"#G"|"#A"|"#B"
<basic_tone>: <basic_short_tone>|<ess_short_tone>|<iss_short_tone>|<basic_long_tone>
|<ess_long_tone>|<iss_long_tone>
<octave_high_prefix>: "+"
Maximum number of
tones:
40
Maximum numbers of
characters in melody:
120
Example: BEGIN:EMELODY
VERSION:1.0
NAME:Test melody 1
COMPOSER:John Smith
MELODY:
+f+a+fa(b)bdcC+GA+d+#c+dfg+daea+d+#c+e+f+e+fa(b)bdC+EA+
d+#c+dfgba+d+#C
END:EMELODY
-------------------------------------------------------------------------------------------
iMelody V1.2 Approved
1. Overview
The iMelody format is a minimal set of tones that can be used to transfer melodies between devices. The definition can
be extended by defining new formats for MIDI/WAV, DTMF, polyphonic etc. The FORMAT field is mandatory, as it is
used to specify the format of the following data.
In all cases, a letter designating a note, style, volume, etc will precede a number.
Example applications include ring tones, alarm tones and power-on melodies.
2. BNF Definition
<imelody -object>::=
"BEGIN:IMELODY"<cr><line- feed>
"VERSION:"<version><cr><line- feed>
"FORMAT:"<format><cr><line- feed>
["NAME:"<characters-not - lf><cr><line- feed>]
["COMPOSER:"<characters-not - lf><cr><line-feed>]
["BEAT:"<beat><cr><line-feed>]
["STYLE:"<style><cr><line- feed>]
["VOLUME:"<volume><cr><line-feed>]
"MELODY:"<melody><cr><line- feed>
"END:IMELODY"<cr><line-feed>
<version>::="1.2"
<format>::"CLASS1.0" | “ CLASS2.0”
<beat>::="25" | "26" | "27" | ... | "899" | "900"
<style>::= "S0" | "S1" | "S2"
<volume- modifier>::=”V+”|”V-“ (changes volume + or – from current volume)
<volume>::="V0" | "V1" | ... | "V15" |<volume- modifier>
<basic- note>::="c" | "d" | "e" | "f" | "g" | "a" | "b"
<ess-note >::="&d" | "&e" | "&g" | "&a" | "&b" (flat notes)
<iss-note >::="#c" | "#d" | "#f" | "#g" | "#a" (sharp notes)
<basic- ess-iss- note >::=<basic-note> | <ess- note> | <iss- note>
<octave-prefix>::=”*0” | "*1" | … | "*8" (A=55Hz) | (A=110Hz) | … | (A=14080 Hz)
<duration>::="0" | "1" | "2" | "3" | "4" | "5"
<duration- specifier>::="." | ":" | “;”
<rest>::="r"
<led>::="ledoff" | "ledon"
<vibe>::="vibeon" | "vibeoff"
<backlight>::=”backon” | “backoff”
<note>::=[<octave-prefix>]<basic-ess- iss-note><duration>[<duration-specifier ]
<silence>::=<rest ><duration>[<duration-specifier]
<repeat>::= “(“{<silence>|<note>|<led>|<vib>|volume>|<backlight>}+ “@”<repeat - count>[<volume- modifier>]”)”
<repeat -count>::="0" | "1" | "2" | … (0 is repeat forever)
<melody>::={<silence>|<note>|<led>|<vib>|<repeat>|<volume>|<backlight>}+
<characters- not -lf >::= 'Any character in the ASCII character-set except <line-feed>.'
Note : no <repeat> block within <repeat> block!(The repeat blocks cannot be nested in this simple CLASS1.0 definition)
Default octave-prefix is *4. I,e, A=880Hz
The volume can optionally be adjusted up, or down, within a repeat block, by including a V+/V- character anywhere
within the repeat block. i.e (#d1r3d2e2@3V+).
The volume changes within a repeat loop continue after the loop is exited.
The default character set is UTF-8.
The file extension is imy. For example “ringring.imy”
The field name (text before the colon) is not case sensitive.
The field value (text after the colon) is case sensitive.
iMelody V1.2 Approved
A maximum length for the melody has not been defined. For interoperability, the length should be kept as short as
possible. Receiving devices must be able to truncate iMelody messages longer than the device's allocated receiving
buffer.
The beat is a decimal representation of the tempo in beats per minute. i.e. a bpm of 63 gives a length of a [$frac14] note as 0.95
sec. The beat rate has been restricted to values between 25bpm and 900bpm, to place realistic requirements on the
receiving device. A default value of 120 bpm should be used if a beat is not specified.
Lines of text in the iMelody, SHOULD NOT be longer than 75 octets, excluding the line break. Long content lines
SHOULD be split into a multiple line representations, using a line folding technique. That is, a long line can be split
between any two characters, by inserting a CRLF immediately followed by a single linear white space character (i.e.,
SPACE, US-ASCII decimal 32 or HTAB, US-ASCII decimal 9).
Duration
Value Duration
0 Full-note
1 1/2-note
2 1/4-note
3 1/8-note
4 1/16- note
5 1/32- note
Duration Specifier
Symbol Duration
No special duration
. Dotted note
: Double dotted note
; 2/3 length
Style
Value Style Ratio of note to rest period
S0 Natural Style (rest between notes), default 20:1
S1 Continuous Style (no rest between notes) No rest
S2 Staccato Style (shorter notes and longer rest period) 1:1
Volume
iMelody V1.2 Approved
Value Volume
V0 tone- off
V1 level-1
V2 level-2
V3 level-3
V4 level-4
V5 level-5
V6 level-6
V7 level-7, default
V8 level-8
V9 level-9
V10 level-10
V11 level-11
V12 level-12
V13 level-13
V14 level-14
V15 level-15
3. Example of a “CLASS1.0” iMelody object
BEGIN:IMELODY
VERSION:1.2
FORMAT:CLASS1.0
Required Header Info
NAME:Melody1
COMPOSER:Moz art
Optional Header info
BEAT:120
STYLE:S1
VOLUME:V7
Optional iMelody modifiers
MELODY:V7&b2#c3V- c2*4g3d3V+#d1r3d2e2:d1V+f2f3. Required iMelody
END:IMELODY Required footer info
Note that in the V1.0 of the iMelody specification, the example omitted the letter V in the VOLUME modifier and S in
the STYLE. Implementations should be capable of receiving the volume with, and without the letter V.
Implementations should transmit with the letter V. Similarly implementations should be capable of receiving the style
with, and without the letter S, but always send with an S.
nokia用的是rttttl格式
Spezifikation des RTTTL-Formats
An RTX file is a text file, containing the ringtone name, a control section and a section containing a comma
separated sequence of ring tone commands. The RTX ringtone description format is designed to be
backward compatible with RTTTL, but offers extensions in line with the Nokia Smart Messaging standard.
White space must be ignored by any reader application.
Example:
Alert:B715:32C,32P,32D,32P,32E,32P,32F,32P,32G,32P
This file describes a ringtone whose name is 'Alert'. The control section sets the beats per second at 715,
and the note definitions describe a series of 5 notes and 5 pauses of length 1/32 of a full note.
<RTX file> := <name> ":" [<control section>] ":" <tone-commands>
<name> := <char>+ ; maximum name length 10 characters
<control-section> := <control-pair> ["," <control-section>]
<control-pair> := <control-name> ["="] <control-value>
<control-name> := "o" | "d" | "b" | "s"
; Valid in control section: o=default scale, d=default duration, b=default beats per minute, s=style
; Valid in tone section: o, b, s
<control-value> := <char>+ ; dependent on control-name
; if not specified, defaults are 4=duration, 6=scale, 63=beats-per-minute
; styles are S=Staccato, N=Natural, C=Continuous
; any unknown control-names must be ignored
<tone-commands> := <tone-command> ["," <tone-commands>]
<tone-command> :=<note> | <control-pair>
<note> := [<duration>] <note> [<scale>] [<special-duration>] <delimiter>
<duration> := "1" | "2" | "4" | "8" | "16" | "32" ; duration is divider of full note duration,
eg. 4 represents a quarter note
<note> := "P" | "C" | "C#" | "D" | "D#" | "E" | "F" | "F#" | "G" | "G#" | "A" | "A#" | "H"
<scale> :="4" | "5" | "6" | "7"
; Note that octave 4: A=440Hz, 5: A=880Hz, 6: A=1.76 kHz, 7: A=3.52 kHz
; The lowest note on the Nokia 61xx is A4, the highest is B7
<special-duration> := "." ; Dotted note
; End of specification
参考资料:
"MIDI Systems and Control" Francis Rumsey 1990 Focal Press
"MIDI and Sound Book for the Atari ST" Bernd Enders and Wolfgang Klem 1989 M&T Publishing, Inc.
MIDI file specs and general MIDI specs were a"o obtained by sending e-mail to LISTSERV@AUVM.AMERICAN.EDU with the phrase GET MIDISPEC PACKAGE in the message.
**** table 1 - general midi instrument patch map ****
(groups sounds into sixteen families, w/8 instruments in each family)
prog# instrument prog# instrument
(1-8 piano) (9-16 chrom percussion)
1 acoustic grand 9 celesta
2 bright acoustic 10 glockenspiel
3 electric grand 11 music box
4 honky-tonk 12 vibraphone
5 electric piano 1 13 marimba
6 electric piano 2 14 xylophone
7 harpsichord 15 tubular bel"
8 clav 16 dulcimer
(17-24 organ) (25-32 guitar)
17 drawbar organ 25 acoustic guitar(nylon)
18 percussive organ 26 acoustic guitar(steel)
19 rock organ 27 electric guitar(jazz)
20 church organ 28 electric guitar(clean)
21 reed organ 29 electric guitar(muted)
22 accoridan 30 overdriven guitar
23 harmonica 31 distortion guitar
24 tango accordian 32 guitar harmonics
(81-88 synth lead) (89-96 synth pad)
81 lead 1 (square) 89 pad 1 (new age)
82 lead 2 (sawtooth) 90 pad 2 (warm)
83 lead 3 (calliope) 91 pad 3 (polysynth)
84 lead 4 (chiff) 92 pad 4 (choir)
85 lead 5 (charang) 93 pad 5 (bowed)
86 lead 6 (voice) 94 pad 6 (metallic)
87 lead 7 (fifths) 95 pad 7 (halo)
88 lead 8 (bass+lead) 96 pad 8 (sweep)
(97-104 synth effects) (105-112 ethnic)
97 fx 1 (rain) 105 sitar
98 fx 2 (soundtrack) 106 banjo
99 fx 3 (crystal) 107 shamisen
100 fx 4 (atmosphere) 108 koto
101 fx 5 (brightness) 109 kalimba
102 fx 6 (goblins) 110 bagpipe
103 fx 7 (echoes) 111 fiddle
104 fx 8 (sci-fi) 112 shanai
voices:
a minimum of either 24 fully dynamically allocated voices
available simultaneously for both melodic and percussive sounds or 16
dynamically allocated voices for melody plus eight for percussion.
channe":
general midi mode supports all sixteen midi channe". each channel can
play a variable number of voices (polyphony). each channel can play a
different instrument (timbre). keybased percussion is always on
channel 10.
instruments:
a minimum of sixteen different timbres playing various instrument
sounds. a minimum of 128 preset for intruments (midi program numbers).
note on/note off:
octabe registration: middle c(c3) = midi key 60. all voices including
percussion respond to velocity.
controllers:
controller # description
1 modulation
7 main volume
10 pan
11 expression
64 sustain
121 reset all controllers
123 all notes off
registered description
parameter #
0 pitch bend sensitivity
1 fine tuning
2 coarse tuning
additional channel messages:
channel pressure (aftertouch)
pitch bend
power-up defaults:
pitch bend amount = 0
pitch bend sensitivity = +-2 semitones
volume = 90
all other controllers = reset
printf("\n Syntax: dec binary_file_name\n\n");
printf("by Dustin Caldwell (dustin@gse.utah.edu)\n\n");
printf("This is a filter program that reads a binary file\n");
printf("and prints the decimal equivalent of each byte\n");
printf("tab-separated. This is mostly useful when piped \n");
printf("into another file to be edited manually. eg:\n\n");
printf("c:\>dec sonata3.mid > son3.txt\n\n");
printf("This will create a file called son3.txt which can\n");
printf("be edited with any ascii editor. \n\n");
printf("(rec.exe may a"o be useful, as it reencodes the \n");
printf("ascii text file).\n\n");
printf("Have Fun!!\n");
}
while(!feof(rfp)) /* loop for whole file */
{
if(isalnum(ch)) /* only 'see' valid ascii chars */
{
c=0;
while(isdigit(ch)) /* only use decimal digits (0-9) */
{
s[c]=ch; /* build a string containing the number */
c++;
ch=fgetc(rfp);
}
s[c]=NULL; /* must have NULL terminator */
fputc(atoi(s), wfp);/* write the binary equivalent to file */
printf("by Dustin Caldwell (dustin@gse.utah.edu)\n\n");
printf("This is a program that reads an ascii tab-\n");
printf("delimited file and builds a binary file where\n");
printf("each byte of the binary file is one of the decimal\n");
printf("digits in the text file.\n");
printf(" eg:\n\n");
printf("c:\>rec son3.txt son3.mid\n\n");
printf("(This will create a file called son3.mid which is\n");
printf("a valid binary file)\n\n");
printf("(dec.exe may a"o be useful, as it decodes binary files)\n\n");
printf("Have Fun!!\n");
}作者: 怕怕。。 时间: 2003-10-12 17:58 标题: 回复: 【资料分享】手机铃声格式规范,midi格式规范 天啊~``