Importing timestamp information with Python
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
-
guenterrote
- Posts: 0
- Joined: Tue Mar 09, 2010 9:36 pm
- Operating System: Please select
Re: Importing timestamp information with Python
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.
Re: Importing timestamp information with Python
Hi, Gale,
I appreciate your help.
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,
Hawsun.
I appreciate your help.
I posted one of my file that I'm looking at now; http://goo.gl/hVYns.Gale Andrews wrote:... 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. ...
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,
Hawsun.
-
Gale Andrews
- Quality Assurance
- Posts: 41761
- Joined: Fri Jul 27, 2007 12:02 am
- Operating System: Windows 10
Re: Importing timestamp information with Python
That's OK, but the link gives an error. Can you check it?Hawsun wrote:I posted one of my file that I'm looking at now; http://goo.gl/hVYns.
It's 18 minutes long and not a small one. But I wondered if I cut the file, I may lost the timestamp.
Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual
-
Gale Andrews
- Quality Assurance
- Posts: 41761
- Joined: Fri Jul 27, 2007 12:02 am
- Operating System: Windows 10
Re: Importing timestamp information with Python
Thanks for replying, Guenterrote.
Gale
Here is one without: http://gaclrecords.org.uk/files/jazz_noise.wav . But you can generate any tone in Audacity and export as WAV if you want more WAV's without timestamps.guenterrote wrote: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.
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.guenterrote wrote:I was hoping that someone from the audacity developer community would pick up my program and integrate it into audacity.
Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual
-
guenterrote
- Posts: 0
- Joined: Tue Mar 09, 2010 9:36 pm
- Operating System: Please select
Re: Importing timestamp information with Python
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.Gale Andrews wrote: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.guenterrote wrote:I was hoping that someone from the audacity developer community would pick up my program and integrate it into audacity.
Gale
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 chunks.py 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 chunks.py 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
26ED7B100000
999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
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.
3) I have added a friendly error message to my program.
Re: Importing timestamp information with Python
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,
Hawsun.
I appreciate your help. Now I understand the structure of my files and what is my next step.
Best Regards,
Hawsun.
-
Gale Andrews
- Quality Assurance
- Posts: 41761
- Joined: Fri Jul 27, 2007 12:02 am
- Operating System: Windows 10
Re: Importing timestamp information with Python
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).guenterrote wrote: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.Gale Andrews wrote: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.guenterrote wrote:I was hoping that someone from the audacity developer community would pick up my program and integrate it into audacity.
Gale
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 http://forum.audacityteam.org/viewtopic ... 43#p140743 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.guenterrote wrote: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.
The recordings of this underwater device seem to occur at intervals as set by the user in the configuration software.guenterrote wrote:Some devices can also be set up to generate a cue every 5 minutes or so.
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 http://multi-electronique.com/files/AUR ... _GUIDE.pdf .
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 findcues.py that guenterrote posted at http://wiki.audacityteam.org/wiki/Impor ... nformation has syntax errors in python 3.3, but I've written to guenterrote about that.
Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual