Rather than mucking about with Python or R you can easily batch-add the serial numbers to the filenames using "Advanced Renamer" (free from www.advancedrenamer.com).
The serial number is saved in the "Artist" tag prefixed with "AudioMoth "
So to add this use the "Add method"...
Add: <ExifTool:Artist>_
At index: 0
Alternatively, Advanced Renamer can read text directly from the file - so to add the serial number without the prefix you can use...
The device serial name is included in the WAV file header so you could also write a small Python or R script that annotates the serial number to the filename if you need to automate this process.
The new Config App has some tools for expanding T.WAV files and for splitting normal WAV files. You can use the splitting tool to copy the files from an SD card to another location (or to the source destination) and also add a prefix to the files. If you set the maximum file length greater than the actual length of the files then you will get the whole file.
With last firmware, AudioMoth are currently saving files in "YYYMMDD_HHMMSS" format. But there are 15 recorders recording at the same time, so all files have same name. Is there any way of adding a prefix (with name of recorder) at the begining of multiple audiofiles?
Try replacing datetime.utcfromtimestamp with datetime.fromtimestamp in Alex's script.
I believe that should return local time as set on your PC.
You can also convert filenames directly using "Advanced Renamer" from: www.advancedrenamer.com
I have a script for Advanced Renamer that will convert Unix datestamp filenames to either local or UTC that I can post if you need it
.
If you have already converted the filenames and just want to convert UTC to local time you can use the Renumber method in Advanced Renamer to add or subtract the requisite number of hours.
# Python3 code to rename multiple # AudioMoth files in a directory import os from datetime import datetimedef main(): files = [file for file in os.listdir('.') if file.endswith('.WAV')] for file in files: timestamp = int(file.replace('.WAV', ''), 16) destination = datetime.utcfromtimestamp(timestamp).strftime('%Y%m%d_%H%M%S.WAV') os.rename(file, destination)if __name__ == '__main__': main()
This Spring I installed AudioMoth firmware on my computer. The file names are formatted in hexadecimal. Where can I find firmware with the updated naming ( YYYYMMDD_HHMMSS.WAV ) ? Thanks!
Alex, that would be extremely useful thank you so much! Should we need to buy new devices that supports that new firmware or the new firmware will be good to go with the old audiomoths?
Hi, The file names are the time that the recording was made in UTC presented as a 32-bit hexadecimal UNIX timestamp (which is the number of seconds since 00:00:00 01/01/1970). This is because the simple filesystem that the AudioMoth supports only allows 8 character filenames. It is very easy to convert these to regular timestamps in software or to double check online - https://www.epochconverter.com/hex.
The full timestamp in available in human readable form inside the comment field of the WAV file. On a Mac this is real automatically and is visible if you do 'Get Info' on the file.
We have an updated version of the firmware coming out in a couple of weeks that fixes the restriction on the filename length so that we can use the full timestamp as the file name (as above). The new format is YYYYMMDD_HHMMSS.WAV which is readable in lots of standard acoustic analysis software. We also support local time zones in the firmware and configuration app which makes it easier to keep track of when recordings were made (e.g. the recording above used the UTC +1 timezone - UK summer time).
@AdrienGelle
Rather than mucking about with Python or R you can easily batch-add the serial numbers to the filenames using "Advanced Renamer" (free from www.advancedrenamer.com).
The serial number is saved in the "Artist" tag prefixed with "AudioMoth "
So to add this use the "Add method"...
Add: <ExifTool:Artist>_
At index: 0
Alternatively, Advanced Renamer can read text directly from the file - so to add the serial number without the prefix you can use...
Add: <File Content:107:16>_
At index: 0
The device serial name is included in the WAV file header so you could also write a small Python or R script that annotates the serial number to the filename if you need to automate this process.
The new Config App has some tools for expanding T.WAV files and for splitting normal WAV files. You can use the splitting tool to copy the files from an SD card to another location (or to the source destination) and also add a prefix to the files. If you set the maximum file length greater than the actual length of the files then you will get the whole file.
Hi,
With last firmware, AudioMoth are currently saving files in "YYYMMDD_HHMMSS" format. But there are 15 recorders recording at the same time, so all files have same name. Is there any way of adding a prefix (with name of recorder) at the begining of multiple audiofiles?
Try replacing datetime.utcfromtimestamp with datetime.fromtimestamp in Alex's script.
I believe that should return local time as set on your PC.
You can also convert filenames directly using "Advanced Renamer" from: www.advancedrenamer.com
I have a script for Advanced Renamer that will convert Unix datestamp filenames to either local or UTC that I can post if you need it
.
If you have already converted the filenames and just want to convert UTC to local time you can use the Renumber method in Advanced Renamer to add or subtract the requisite number of hours.
Code is here also:
# Python3 code to rename multiple # AudioMoth files in a directory import os from datetime import datetime def main(): files = [file for file in os.listdir('.') if file.endswith('.WAV')] for file in files: timestamp = int(file.replace('.WAV', ''), 16) destination = datetime.utcfromtimestamp(timestamp).strftime('%Y%m%d_%H%M%S.WAV') os.rename(file, destination) if __name__ == '__main__': main()
Hi, If you are using the most up to date firmware, all the file names are in human readable form. There is a Python3 script here -
https://www.dropbox.com/s/eh6cpk6jy6aintq/rename.py?dl=0
- that you can use to rename the AudioMoth recordings in any directory. Alex
This Spring I installed AudioMoth firmware on my computer. The file names are formatted in hexadecimal. Where can I find firmware with the updated naming ( YYYYMMDD_HHMMSS.WAV ) ? Thanks!
Alex, that would be extremely useful thank you so much! Should we need to buy new devices that supports that new firmware or the new firmware will be good to go with the old audiomoths?
Hi, The file names are the time that the recording was made in UTC presented as a 32-bit hexadecimal UNIX timestamp (which is the number of seconds since 00:00:00 01/01/1970). This is because the simple filesystem that the AudioMoth supports only allows 8 character filenames. It is very easy to convert these to regular timestamps in software or to double check online - https://www.epochconverter.com/hex.
The full timestamp in available in human readable form inside the comment field of the WAV file. On a Mac this is real automatically and is visible if you do 'Get Info' on the file.
We have an updated version of the firmware coming out in a couple of weeks that fixes the restriction on the filename length so that we can use the full timestamp as the file name (as above). The new format is YYYYMMDD_HHMMSS.WAV which is readable in lots of standard acoustic analysis software. We also support local time zones in the firmware and configuration app which makes it easier to keep track of when recordings were made (e.g. the recording above used the UTC +1 timezone - UK summer time).