[gmpi] Re: Topic 6: Time representation

  • From: Tim Hockin <thockin@xxxxxxxxxx>
  • To: gmpi@xxxxxxxxxxxxx
  • Date: Tue, 29 Apr 2003 10:10:08 -0700 (PDT)

> Agreed. So we have an absolute linear stream clock in samples (we'll need
> a 64-bit integer word for that) and an optional periodic sync pulse in the

32 bits is sufficient: it doesn't matter if we wrap, so long as the wrap
window is not too small (i.e. larger than one processing block).  Comparisons 
of unsigned numbers will always yield a valid difference in time.  And
processing 32 bits is MUCH faster on current processors than 64 bits.

> Unless anyone can come up with a good reason to the contrary, I propose
> that all events be timestamped primarily with the absolute sample clock.

I'm going to paste some stuff we wrote for XAP - we explored this topic to
some degree, and came up with what I feel is a nice solution.

> The one potential problem with this scheme is that it is not good for
> dealing with plugins that want to have knowledge of "future" events beyond
> the end of the current process block. Some have suggested that this is

According to my above rules, and general consensus on XAP - there is no
future.  A plugin can buffer things internally for later delivery, but later
may never come.

The following pre-suppositions apply from other XAP discussion/docs:
1) All XAP hosts have a 32 bit counter of samples that is always running
2) All communication is sent as timestamped 'Events' to 'Controls'
3) All Events are timestamped with the free-running sample time
4) The host measures musical time in 'Ticks' since some point


Tempo and Meter
----
  XAP uses Controls for transmitting tempo and meter information.  If a
  Plugin defines a TEMPO control, it can expect to receive tempo Events on
  that control.  The Host must define some unit of musical-time measurement
  (Tick), which represents the smallest granularity the host wants to work
  with.  This is the basis for tempo and meter.  The host publishes the
  current count of Ticks/Beat via the host struct.  A suggested value for
  ticks/beat is 2520 (divisible by 2,3,4,5,6,7,8,9,10,12,14,15,18,20..).

  Control: TEMPO
  Type: double
  Units: ticks/sec
  Range: [-inf, inf]
  Events: Hosts must send a TEMPO Event at Plugin init and when tempo
          changes.

  Control: METER
  Type: double
  Units: ticks/measure
  Range: [0.0, inf]
  Events: Hosts must send a METER Event at Plugin init and when meter
          changes.  Hosts should send a METER Event periodically, such as
          every measure or once per second.

  Control: METERBASE
  Type: double
  Units: beats/whole-note
  Range: [1.0, inf]
  Events: Hosts must send a METERBASE Event at Plugin init and when meter
          changes.

  This mechanism gives Plugins the ability to be aware of tempo and meter
  changes, without forcing information into plugins that don't care.  A
  Plugin can sync to various timeline events, easily.

  The Host struct also provides a mechanism to query the timestamp of the
  next Beat or Bar, and to convert timestamps into the following time formats:
    * Ticks
    * Seconds
    * SMPTE frames

Sequencer Control
----
  XAP plugins may be aware of certain sequencer events, such as transport
  changes and positional jumps.  These data are received on Controls.

  Control: POSITION
  Type: double
  Units: ticks
  Range: [0.0, inf]
  Events: Hosts must send a POSITION Event at Plugin init, when transport
          starts, and when transport jumps.  Hosts should send a POSITION
          Event periodically, such as every beat, every measure or once per
          second.

  Control: TRANSPORT
  Type: bool
  Units: on/off
  Events: Hosts must send a TRANSPORT Event at Plugin init and when
          transport state changes.

----------------------------------------------------------------------
Generalized Music Plugin Interface (GMPI) public discussion list
Participation in this list is contingent upon your abiding by the
following rules:  Please stay on topic.  You are responsible for your own
words.  Please respect your fellow subscribers.  Please do not
redistribute anyone else's words without their permission.

Archive: //www.freelists.org/archives/gmpi
Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe" to unsubscribe

Other related posts: