Module Mp3tag


module Mp3tag: sig  end
Interface for editing mp3 tags and getting information.

module Id3v1: sig  end
Reading and writing id3 v1.1 tags.
module Id3v2: sig  end
Reading and writing id3 v2.3 tags.


Reading and writing both versions of tags


val read_both_as_v1 : string -> Id3v1.tag
Get a v1 tag from the v1 and v2 tags of the given file. The returned tag is the result of merge v2 v1.
val read_both_as_v2 : string -> Id3v2.tag
Get a v2 tag from the v1 and v2 tags of the given file. The returned tag is the result of merge v2 v1.
val write_both_v1 : Id3v1.tag -> ?src:string -> string -> unit
Write the given v1 tag to the v1 and v2 tags of the given file.

src : the optional source filename, if it is different from the filename.
val write_both_v2 : Id3v2.tag -> ?src:string -> string -> unit
Write the given v2 tag to the v1 and v2 tags of the given file.

src : the optional source filename, if it is different from the filename.


Tag conversions


val v2_of_v1 : Id3v1.tag -> Id3v2.tag
val v1_of_v2 : Id3v2.tag -> Id3v1.tag


Genres


val string_of_genre : int -> string
Get the genre string from the given genre id.
val genre_of_string : string -> int
Get the genre id from the given genre string.
val genres : string list
The list of genre names.


Getting information on a MP3 file



type channel_mode =
| Stereo
| Joint_stereo
| Dual_channel_stereo
| Mono

type mp3_encoding =
| CBR (*Constant Bit Rate*)
| VBR (*Variable Bit Rate*)

type info = {
   duration : int; (*in seconds*)
   samplerate : int; (*in kilobits per second*)
   mode : channel_mode; (*stereo, mono, etc*)
   bitrate : int; (*in kilobits per second*)
   encoding : mp3_encoding; (*variable or constant bit rate*)
   filesize : int; (*in bytes*)
}
val info : string -> info
Return information on the given MP3 file.