Ah, sorry wasn't following. Are you using this for making custom tags?
I thought you were only trying to display the audio info from the files in the main window of Mp3tag.
The "extra" square bracket ] came from copying your string in your DD.20151230.2057.CET post.
Removing that bracket solved the problem. Last question:
How should the appropriate portion of the script be modified to read like this: W=24 bits
The main purpose was to add the FORMAT tag to the music file, so that it is there for search or file management purposes by ordinary people. The same string can be used as a 'format value' action item.
Seems to be working fine now, though I still wish to add ' bits' to the bit depth (word length) portion of the FORMAT tag, e.g. W=16 bits
Well, with a humorous smile in my eyes, I have to say again, Mp3tag scripting is a rather hard nut, ...
seems to be much harder than to earn a Bachelor's degree in Physics or a Master's degree in Electronics Engineering. ![]()
Dennis, you are always welcome, happy new year!
DD.20151231.0942.CET
Well, as nuts go, this one is indeed rather hard for me to crack. I took my degrees many years ago and never delved into much in the way of writing code or scripting...as you can tell. I find myself confused when trying to understand your script when you write it out the way you do. What do the red brackets mean? Am I supposed to copy and paste the entire string including them? The last time I did that, I ended up with the scripting error due to an extra bracket.
By the way, happy new year to you too....and thanks for your patience.
Dennis...
See Mp3tag help manual, "Characters with special functionality"
[...] The contents of brackets are displayed only if at least one of the placeholders used inside the brackets has been found.
A square bracket expression works the same like a lengthy $if-clause.
DD.20151231.1124.CET
Thanks for all of your help!!!
Just discovered this thread and would love some help with trying to implement "bit depth". I was hoping to set it up so that, for bit depths lower than 24 it shows for example: 16Bit, but for depths at 24 it displays as: 24Bit [Hi-Res].
For extra points, can it be setup as an action to add this same info to the "Comments" field?
Any help would be greatly appreciated. Thank you in advance.
Not sure about your application and what else you might need. We work only with FLAC audio files, but I don't think this makes any difference. Here's the Action Item that I use to document each audio file's format:
'A='$regexp(%_codec%,'[\U\D]',)', F='$cutRight(%_samplerate%,3)$trimRight('.'$right(%_samplerate%,3),'.0')' kHz'[', W='%_bitspersample%' bits']', M='%_mode%
This typically yields the following Vorbis comment result, where FORMAT is the field name and the text to the right of the first "=" sign is the field's value.
FORMAT=A=FLAC, F=44.1 kHz, W=16 bits, M=Stereo
I hope this is helpful, but I'm afraid I cannot be considered an expert in this area. This string was given to me by another established member of the forum's valuable support staff as a result of a request for help similar to yours.
D2B
Hi d2b,
Thanks for getting back to me. The entries you sent me I have seen before up in the thread. I have them working to show me colums with the relevant info but, I want to try to combine all this info into a single entry in the comment tab on the left of the main screen. At the very least, to add each field as a tab on the left. (See pictured)
I'm sorry to say that I cannot help you with your specialized requirement beyond what I have already shared.
D2B ...
You may notice that most of the properties are referenced with variables, starting with an underscore. Such properties cannot be displayed in the tag panel at the moment.
You could try as column definition for
Value: $ifgreater(%_bitspersample%,16,%_bitspersample% Hi-Res,%_bitspersample%)
The same expression can be used in a action of the type "Format value" for COMMENT to write that data.
Do you really want to write this technical informations to the tagfield COMMENT?
This could be done with an action of the type format value for the field COMMENT.
d2b Thank you for you help.
'ohrenkino' and 'poster', thank you for your suggestions. I will have a play with them and see what I can make of them. You've all been awesome...
![]()
Update
I got it to work with the folowing:
Field:COMMENT
Format String:$ifgreater(%_bitspersample%,16,'[Hi-Res] '%_bitspersample%'Bit:',%_bitspersample%'Bit:')$cutRight(%_samplerate%,3)$trimRight('.'$right(%_samplerate%,3),'.0')'kHz' %_mode%
One small note, using the above solution will replace any existing comment with this change, losing any of that data. You may want to consider adding the leading comment (and trailing space) in front of this to keep the current comments if they exist, enclosed in square brackets means it is only looked at if there is something there to begin with.
field:COMMENT
Format String:[%comment% ]$ifgreater(%_bitspersample%,16,'[Hi-Res] '%_bitspersample%'Bit:',%_bitspersample%'Bit:')$cutRight(%_samplerate%,3)$trimRight('.'$right(%_samplerate%,3),'.0')'kHz' %_mode%
MotleyG, thats awesome. I never would have known to do that. I'll definitely use it thank you.
Please don't forget that you get added this bit-depth informations every time you run the Action or Convert Tag -> Tag.
After the first run it looks like
Bit:44.1kHz Joint Stereo
After the second run:
Bit:44.1kHz Joint Stereo Bit:44.1kHz Joint Stereo
Thanks for the tip. I now have it running as a standalone action so I can add it at my choosing, which is usually the last action.
