From WikiChip
mirc/identifiers/$sound
< mirc‎ | identifiers
Revision as of 18:33, 23 June 2014 by Zmodem (talk | contribs) (See Also)

Note: This command is also a part of the playing music section.


$sound is a powerful identifier that can be used to retrieve various information about sound files, including: directories which contain specific sounds file types, as well as ID3 tags associated with sound files which support them.

Synopsis

$sound(<type|filename>)[.property]

Properties

Note: Only mp3, ogg, and wma files currently support the following properties. Keep in mind that not all properties may have been set. Each property returns the Id3v1 values. For id3v2, use the .tag, and .tags properties.

albumRetrieves the specified album name sound file.

titleReturns the song title for the file.

artistReturns the artist name for the file.

yearReturns the year associated with the song release.

commentReturns any comments made by the file creator.

genreGrabs the genre for the file, if set.

trackRetrieves the track number associated with the song.

lengthReturns the full length of the song in milliseconds.

versionGets the version number of the song, or track.

bitrateReturns the bitrate for the file.

vbrGets the variable bit rate for the file.

sampleReturns the sampling frequency.

modeReturns the mode: mono, stereo, etc.

copyrightReturns any copyright information.

privateReturns $true or $false for the private tag.

crcReturns $true or $false if crc is found.

.id3Returns the id3 tag information.

.tagUsed to retrieve id3v2 information.

.tagsUsed to retrieve id3v2 information.

Examples

Echo the artist name of the currently playing mp3 file to the active window

//echo -a $sound($insong.fname).artist

Create a small alias that will open a window, @id3info, and echo some basic info about the currently playing song to it

alias id3info {
 
  ; First, we check to make sure we currently have an mp3, ogg, or wma file playing
  if ($insong) {
 
    ; If the @id3info window is open, clear it, otherwise create it.
    $iif($window(@id3info),clear @id3info,window @id3info)
 
    echo @id3info Artist: $sound($insong.fname).artist
    echo @id3info Track: $sound($insong.fname).track
    echo @id3info Title: $sound($insong.fname).title
    echo @id3info Album: $sound($insong.fname).album
 
    ; The below calculation converts the milliseconds for the sound
    ; file length into the format mm:ss, or minutes:seconds. Note that
    ; this does not properly support lengths over 59 minutes and 59
    ; seconds long.
    echo @id3info Length: $replace($round($calc($sound($insong.fname).length / 1000 / 60),2),.,:)
    echo @id3info Year: $sound($insong.fname).year
  }
}

Compatibility

Added: mIRC v6.0

Added On: 03/02/2002

See Also

ON MIDIEND Event

ON SONGEND Event

ON WAVEEND Event

/splay

/vol

$inmidi

$insong

$inwave

$vol