Importing timestamp information with Python


I want to see a timestamp with Audacity and found a workaround on the Audacity Wiki (

I installed Python 3.3 and ran “”. Then the program says as follows;


Traceback (most recent call last):
File “<pyshell#0>”, line 1, in
File “”, line 13
print s
SyntaxError: invalid syntax

I am a fool about the Phython and languages.

Would you help me?
Thank you in Advance.

Perhaps you are not in a python window or you want:

import findcues

instead. Are you doing exactly as is it says on the Wiki?



In my opinion it’s a problem of version. “print” is a keyword in python 2.xx, but it is a function in python 3.xx. It should be used like this: print (param0, param1… , …)



That’s believable, but I don’t think many people on this Forum have extensive knowledge of python.

I suggest you test this theory by downloading v2.4.6 which was current when the Wiki article was written. You can get it from . If you cannot compile python and need binaries you may have to go a few releases back from there.

When you have some information on whether the version is the problem or not, I can try to contact “Guenterrote” through the Wiki, but there is no guarantee of reaching him or her.


Thank you, pfeuh.

I am going to change the syntax or the version of Python.




Thank you, Gale.

I am going to try with Python v2.4.6 or modify the syntax.



Python is a script language, there is nothing to compile. I haven’t unfortunatly the knowledge to do what you want me to. I can just say that the “print” problem is a classic one in using script from one version in another one. Python 3.xx comes with a tool to convert scripts from 2.xx to 3.xx

I understood you had to compile python, if you don’t have the version of python you want and they have not made a binary of that version.


Download the release […] Unpack the archive with tar -zxvf Python-2.4.6.tgz (or bzcat Python-2.4.6.tar.bz2 | tar -xf -). Change to the Python-2.4.6 directory and run the “./configure”, “make”, “make install” commands to compile and install Python.

Thanks for that input. I guess this is what you mean ?



Thank you Gale and pfeuh.

I installed Cygwin and compiled Python 2.4.6.

Then I ran the “” and received the message below.

I am disappointed with the results.

Would give me another advice?

Best Wishes,


I get the same errors in Python 2.7.3, but I don’t claim to know anything about python scripts.

Can you post a short WAV file on the web somewhere such as or or dropbox that has the timestamp information you want to be labelled. I may have a tool that can export the information as a CSV file, which would be a step in the right direction, but I’m not sure.

Meantime I e-mailed “Guenterrote”.


It has been a long time since I wrote this program and since it has been useful to me. Unfortunately I no longer have these wave files (or the recorder) around. If somebody would post or send me a wav file WITH cues and another one WITHOUT, I could try to figure out what is happening. I primarily wrote the program for my own use, and therefore did not care to insert error handling. I even wrote: “the Python program crashes when I try it on a wav file without cues.” I was hoping that someone from the audacity developer community would pick up my program and integrate it into audacity.

Hi, Gale,

I appreciate your help.

I posted one of my file that I’m looking at now;

It’s 18 minutes long and not a small one. But I wondered if I cut the file, I may lost the timestamp.

Best wishes,


That’s OK, but the link gives an error. Can you check it?


Thanks for replying, Guenterrote.

Here is one without: . But you can generate any tone in Audacity and export as WAV if you want more WAV’s without timestamps.

You would need to attract the developer’s attention by subscribing and posting to audacity-devel mailing list . But the script has to work first, ideally with dual versions for Python 2 and Python 3 if needed.


My program was just a work-around. I guess they would not use this code directly but use it as an inspiration; audacity must already be able to read the WAVE file format anyway (in C, or whatever language audacity is written in); so they would incorporate this bit of analysis.

  1. I downloaded the two test files. Both of them gave the same error message with findcues as reported by Hawsun.

  2. I tried to analyze both files with the second program that I posted; it seems that none of them contain cues:

$ python DE620095.WAV
analyze chunk structure from WAV-file DE620095.WAV
RIFF len-8 =35393528 start of chunk = 0 bytes
WAVE recursive sublist
fmt len-8 = 16 start of chunk = 12 bytes
MTE2 len-8 = 456 start of chunk = 36 bytes
data len-8 =35393028 start of chunk = 500 bytes
$ python jazz_noise.wav
analyze chunk structure from WAV-file jazz_noise.wav
RIFF len-8 = 798288 start of chunk = 0 bytes
WAVE recursive sublist
fmt len-8 = 16 start of chunk = 12 bytes
data len-8 = 798252 start of chunk = 36 bytes

DE620095.WAV contains an “MTE2” chunk of 456 bytes, which I cannot identify, and nothing else beside the data.
The MTE2 chunk contains some strings like these
V.N.: 04.0.1MTE AURAL M2 Note…Aural-M2data
and some binary data.

Apparently this is some private data format by the recording device.
If I believe what I still remember from three years ago when I wrote this program, I would say that the file contains no cues.
Anyway, this device “MTE AURAL M2” is apparently for unattended underwater operations, so who would press the button to record cues?
Usually, in a long recording session for a concert or similar, someone presses a button between the pieces, and this is how cues are generated and stored in the file.
Later, when replaying, you can jump to the next cue position. Some devices can also be set up to generate a cue every 5 minutes or so.

  1. I have added a friendly error message to my program.

Thank you, guenterrote and Gale,

I appreciate your help. Now I understand the structure of my files and what is my next step.

Best Regards,


There are different timestamp issues. The one we’re addressing here is I think the cue chunk (but your program as far as I know doesn’t look for the smpl chunk).

Basically we are in the hands of the libsndile PCM import/export library that we use as regards chunk issues (unless we modify that library ourselves).

I found a very old forum post here where someone had got Audacity to handle up to 15 loop points and 10 cue points in one WAV by modifying Audacity and libsndfile. No one else seems to have rebuilt Audacity with that code, and libsndfile itself still does not seem to support cue chunks (sndfile-convert discards the cue chunk at the end of a WAV, so obviously current Audacity does that too when exporting).

So you should not export from Audacity over the original WAV if you want to keep cue points.

Then as I understand it there is the bext chunk which has timestamp-related metadata and is specified in the BWF standard . Libsndfile 1.0.24 (the version Audacity currently uses) and 1.0.25 retain the bext chunk (but don’t seem to understand it), but Audacity discards it. So the same moral applies, don’t export over the original WAV if you want to retain the bext chunk.

There is no Cue chunk, unquestionably. They use a proprietary MTE2 chunk to store the timestamp information.

The recordings of this underwater device seem to occur at intervals as set by the user in the configuration software.

Anyway I have looked on the site of the manufacturer of the equipment and found their InfoWav software which will give you the timestamp and other information in that MTE2 chunk. For more explanation see .

If you open the WAV file in InfoWav, you’ll see that there are four recordings of 4.5 minutes each and you can see the start date and time and end date and time of each recording. You can save the information to a text file if you wish. You could create your own Audacity labels manually from that file as there are only four start points.

The latest version of that guenterrote posted at has syntax errors in python 3.3, but I’ve written to guenterrote about that.