---
name: "Xmms::SongChange"
section: "3pm"
platform: "linux"
package: "libxmms-perl"
version: "0.12-5.1"
release: "Debian 4.0 (Etch)"
platforms: ["linux"]
url: "https://new.carta.tech/Xmms::SongChange"
---

# Xmms::SongChange(3pm)

Take actions based on song track/time change

## NAME

Xmms::SongChange - Take actions based on song track/time change

## SYNOPSIS

```
 xmms> change on
```

## DESCRIPTION

This module creates a thread to poll *xmms* for song track and time changes.  The thread is started via the *Xmms::shell* command *change on* and stopped via *change off*.

## CAVEATS

This module is considered very **EXPERIMENTAL**.  During testing, it caused *xmms* to freeze sometimes.  However, this freezing occured with *xmms* version **0.9**, I have seen no freezing with version **0.9.1**.

The module decides if a song has changed based on track number or track length.  So, when only one track is in the playlist, this logic is broken.

Since the thread is constantly polling *xmms* via the remote protocol, xmms is consuming more cpu time than normal.

## FEATURES

Current features include:

- jtime

  When *Xmms::SongChange* is running, it will auto jump to the current  track's *jtime*, if any.

- repeat

  The *Xmms::shell* *repeat* command can be used with 2 additional arguments, to repeat a track in the playlist *n* number of times before advancing.  Example:

  ```
   xmms> repeat 1 3
  ```

  This command will cause track *1* to be repeated *3* times before advancing.

- crop

  *Xmms::SongChange* adds a new *crop* command, which is similar in concept to *jtime*, but advances to the next track in the playlist when the current track *crop* time is reached.  Example:

  ```
   xmms> crop 2 4:30
  ```

  This command will cause playlist advance when track *2* reaches the output time of *4:30*.

  With no arguments, the current output time is set as the *crop* time for the current track.  The *M-c* key binding has the same effect.

- clear

  When the *SongChange* thread is running, the *Xmms::shell* *clear* command will also clear all *SongChange* watch points.

## TIPS

The *Xmms::shell* *history* command can be used to run a "script". For example, consider a file such as:

```
 change on
 clear
 add /usr/local/mp3/prodigy/live/speedway.mp3
 add /usr/local/mp3/prodigy/live/rock_n_roll_98.mp3
 jtime 1 1:19
 crop 1 2:17
 repeat 1 3
 jtime 2 1:00
 crop 2 4:20
 play
```

Which can be run in the shell like so:

```
 xmms> history < ~/mp3/example.sc
```

## FUTURE

I plan to implement the following features in the future:

- fade

  start to fade the volume at a given time.

- splice

  similar to using *jtime* and *crop*, but in the middle of a song. of course, this can already be done by adding the same file to the playlist multiple times and setting different *jtime* and *crop* times for each.

- ???

  ## AUTHOR

Doug MacEachern
