Problem with getting timestamp data using pyliblo



I’ve found the only mentioning about timestamps here. But still I can’t understand how to grep them.

Could anyone explain me how to get timestamp data using pyliblo?


If you use the --osc-timestamp flag with MuseIO, timestamp information will be appended to the /muse/eeg messages. From the developer site (

If the --osc_timestamp option is used, there are 2 extra fields appended to these messages:

  • integer: Number of seconds since 1970 when this event occurred
  • integer: Number of microseconds within that second

Then, in pyliblo, it’s a matter of parsing that message. So, working from the dev site’s Getting Started example:

from liblo import *
  import sys 
  import time
  class MuseServer(ServerThread):
      #listen for messages on port 5001
      def __init__(self):
          ServerThread.__init__(self, 5001)
      #receive EEG data with timestamp info
      @make_method('/muse/eeg', 'ffffii')
      def eeg_callback(self, path, args):
          l_ear, l_forehead, r_forehead, r_ear, seconds, microseconds = args
          print "%s %f %f %f %f %i %i" \
                % (path, l_ear, l_forehead, r_forehead, r_ear, seconds, microseconds)
      #handle unexpected messages
      @make_method(None, None)
      def fallback(self, path, args, types, src):
          print "Unknown message \
	 Source: '%s' \
	 Address: '%s' \
	 Types: '%s ' \
	 Payload: '%s'" \
          % (src.url, path, types, args)
      server = MuseServer()
  except ServerError, err:
      print str(err)
  if __name__ == "__main__":
      while 1:


Thanks a lot!