ExifTool Forum

ExifTool => Newbies => Topic started by: mpriff on April 16, 2021, 09:21:26 AM

Title: Extract cue points from WAV
Post by: mpriff on April 16, 2021, 09:21:26 AM
Hi,

I need to extract cue points from some audio WAV files.

-cuePoints -b

seems to extract all the cue points in binary:


D..~.data.~.....data....@..data@.....data.....data......data.......data..[snip]


Is there a way to have exiftools interpret this chunk and format the output so it returns a readable series of timestamps (in seconds)?

Thanks!

Title: Re: Extract cue points from WAV
Post by: Phil Harvey on April 16, 2021, 10:13:06 AM
Currently, there is no way to do this.  If you send me a sample file I'll take a look and see if I can add this ability.  My email is philharvey66 at gmail.com

- Phil
Title: Re: Extract cue points from WAV
Post by: mpriff on April 16, 2021, 01:08:08 PM
Thank you Phil! I've just sent you an email with a sample WAV containing a couple of cue points.
Title: Re: Extract cue points from WAV
Post by: Phil Harvey on April 16, 2021, 02:05:35 PM
This will require some testing, but here you go.

You should get what you want with this command and the attached config file:

exiftool -config cuepoints.config -mycuepoints -b FILE

Here is what I get for the test file you sent, but it still needs testing on a wider variety of input files.

> exiftool -config cuepoints.config -mycuepoints -b cuepoints.wav
1.000 1.000
3.000 3.000 markerNameAKAlabel
3.500 3.500


- Phil

Edit: I just noticed it doesn't report the end of your region properly (the last 3.5 should be 3.8).  I think I need a couple more samples with more than one different region to figure out how to decode this.

Edit2: This command and config file only work for ExifTool 12.24 and earlier.  See below for the command and config file for use with ExifTool 12.25 and later.
Title: Re: Extract cue points from WAV
Post by: mpriff on April 16, 2021, 02:36:28 PM
Brilliant! Thank you so much, Phil. I emailed another couple sample files.
Title: Re: Extract cue points from WAV
Post by: Phil Harvey on April 16, 2021, 03:23:04 PM
Done.  I've updated the cuepoints.config file in my previous post to fix the problem.

This version now decodes the cuepoints, labels and regions properly from all the files you sent.

With the next release (ExifTool 12.25) I will likely rename the "Unknown_LIST_adtl" tag, which will require a change to the config file, but in that case I'll post back here with an updated config file.

- Phil
Title: Re: Extract cue points from WAV
Post by: mpriff on April 16, 2021, 03:35:02 PM
Perfect! Excellent, thank you so much! I just tried it on my original WAVs, and another sample where I used Adobe Audition (v.14.1.0.43) to add cue points (instead of Sound Forge v.15), equally successfully. (I'm still downloading another trial, will post back if there's any issues.)
Title: Re: Extract cue points from WAV
Post by: Phil Harvey on April 20, 2021, 01:50:40 PM
With ExifTool 12.25 and later, this use this command and the attached config file:

exiftool -config cuepointlist.config -cuepointlist -b FILE

the output is improved with this new config file:

> exiftool -config config_files/cuepointlist.config -cuepointlist -b cuepoints.wav
Cue Start End Label Purpose Text Notes
1 1.000 1.000
2 3.000 3.000 markerNameAKAlabel
3 3.500 3.830 rgn


The advantage is that it now extracts all region types (not just ranges), and will show region text and cue point notes if they exist.

(ExifTool 12.25 should be available within a couple of days.)

- Phil
Title: Re: Extract cue points from WAV
Post by: mpriff on April 20, 2021, 01:55:56 PM
 Thanks! :)
Title: Re: Extract cue points from WAV
Post by: Phil Harvey on April 20, 2021, 02:21:52 PM
Actually, I realized I should be breaking the other fields out into separate columns, so I've edited the config file and updated my previous post with the new version.

- Phil
Title: Re: Extract cue points from WAV
Post by: mpriff on April 20, 2021, 02:26:35 PM
Even better! I'll give it a try when the version updates. Many thanks again.
Title: Re: Extract cue points from WAV
Post by: Phil Harvey on April 22, 2021, 03:02:02 PM
ExifTool 12.25 is now available.

- Phil
Title: Re: Extract cue points from WAV
Post by: horstdeworst on December 10, 2022, 01:55:41 PM
Excited thanks from someone who realized that Audacity can't extract the Cue Points set in their WAV file. Now onwards to level 2: I wonder whether I can script those Cue Points into labels in an Audacity project.

Thanks again!
Title: Re: Extract cue points from WAV
Post by: olivier8064 on May 17, 2023, 04:40:20 AM
So great job Phil ! Thanks a lot.
As I would like to obtain a csv file of all my wav files (more than 10 000 !) with names of cue,
I wrote this line :
exiftool -config cuepointlist.config -cuepointlist -b -csv *.wav > out.csv
But as you can see in the attachment,Screenshot - 17_05_2023 , 10_35_42.png  there is something wrong for the second file (I only used 3 wav file for the example). What can i do to obtain clean out.csv file with complete tabulate list?
REgards



Title: Re: Extract cue points from WAV
Post by: StarGeek on May 18, 2023, 11:52:08 AM
Can you share the actual output?
Title: Re: Extract cue points from WAV
Post by: olivier8064 on May 19, 2023, 03:54:18 PM
Hello,
Yes, for sure. See attachment file.
Thanks
out.csv
Title: Re: Extract cue points from WAV
Post by: StarGeek on May 20, 2023, 12:16:13 PM
This is how LibreOffice opens that file, which would be correct as CuePointList is a single tag with a bunch of data.


When you load the file, see if there are options to make sure that the separator is only a comma.  This is the CSV load window for LibreOffice.


If you need the individual cue points to be separated in some way, that would require editing of the CSV file or there might be a way to do so in the spreadsheet.
Title: Re: Extract cue points from WAV
Post by: olivier8064 on May 24, 2023, 03:24:28 PM
Thank you so much stargeek.
This solution is very good :)
Title: Re: Extract cue points from WAV
Post by: Skipperoo on June 01, 2023, 05:41:42 AM
Hi all,

New user here. I am a bioacoustician studying animal vocalisations, and Exiftool and the solutions in this thread are going to save me and my lab group literally weeks of very tedious labour this year - thank you!

I am having two small issues:

1)
The command line provided by Phil and Olivier do a great job of outputting all of the markers from a folder full of .wav files to the command window, as below:

perl exiftool -config config_files/cuepointlist.config -cuepointlist -b C:\Exif/*.wav



However, as soon as I try to save the output to a .csv, it breaks down and all I get in "out.csv" is this:

perl exiftool -config config_files/cuepointlist.config -cuepointlist -b C:\Exif/*.wav > output.csv -csv >out.csv



So, it is creating a column with all the filenames but no other details or markers.

This is not a huge issue as I can also simply copy and paste from the command window to a .csv file, but if anyone can think of a solution it would save me a step in my pipeline.

UPDATE: I have solved Issue 1 by simply saving output to a .txt file instead of .csv, which works perfectly for some reason.

2)
 Because I am extracting markers from many files at once, I would like to include an additional column in the output that includes the source filename for each row. e.g., in the command window image above, there would be an extra column which simply pastes "VAZ.wav" for each row, until the next .wav file is accessed.

Is there an easy way to do this using exiftool? I suspect it's something to do with tags, but I don't understand the syntax well enough to figure it out.
Title: Re: Extract cue points from WAV
Post by: StarGeek on June 04, 2023, 12:04:32 AM
Just add -Filename to the command at the appropriate point.  If you want it to appear before cuepointlist, you would use
exiftool -config config_files/cuepointlist.config -Filename -cuepointlist -b C:\Exif/*.wav

If you want it after, place it after.