# Regarding new Bit-Depth Information field

**URL:** <https://community.mp3tag.de/t/regarding-new-bit-depth-information-field/17484>\
**Category:** Support\
**Created:** [December 21, 2015, 7:24pm UTC](https://community.mp3tag.de/t/regarding-new-bit-depth-information-field/17484 "2015-12-21T19:24:31Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![deckard](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/bbce88/32.png) [@deckard](https://community.mp3tag.de/u/deckard)\
**Post date:** [December 30, 2015, 8:31pm UTC](https://community.mp3tag.de/t/regarding-new-bit-depth-information-field/17484/21 "2015-12-30T20:31:15Z")

</div>

> [@d2b](#):
>
> I prefer to add it as part of an Action Item that post-proccesses the files after ripping and tagging. What i don't know is the text of the full string, as I indicated in my last post.
> 
> I had it working earlier without the Hz or kHz suffix. I copied and pasted exactly from DetlevD's post at 19:50 CET with the same failed result.
> 
> Dennis, aka "d2b"

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.

---

<div class="post-metadata">

**Author:** ![d2b](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/2bfe46/32.png) [@d2b](https://community.mp3tag.de/u/d2b)\
**Post date:** [December 30, 2015, 8:59pm UTC](https://community.mp3tag.de/t/regarding-new-bit-depth-information-field/17484/22 "2015-12-30T20:59:55Z")

</div>

> [@DetlevD](#):
>
> Dennis, please have a closer look into your example string, at the right side of 'kHz', there is one closing square bracket ] too much, how got it there?
> 
> DD.20151230.2147.CET

The "extra" square bracket ] came from copying your string in your DD.20151230.2057.CET post.

---

<div class="post-metadata">

**Author:** ![d2b](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/2bfe46/32.png) [@d2b](https://community.mp3tag.de/u/d2b)\
**Post date:** [December 30, 2015, 9:09pm UTC](https://community.mp3tag.de/t/regarding-new-bit-depth-information-field/17484/23 "2015-12-30T21:09:16Z")

</div>

> [@d2b](#):
>
> 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

---

<div class="post-metadata">

**Author:** ![d2b](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/2bfe46/32.png) [@d2b](https://community.mp3tag.de/u/d2b)\
**Post date:** [December 30, 2015, 9:20pm UTC](https://community.mp3tag.de/t/regarding-new-bit-depth-information-field/17484/24 "2015-12-30T21:20:08Z")

</div>

> [@deckard](#):
>
> 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 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

---

<div class="post-metadata">

**Author:** ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)\
**Post date:** [December 31, 2015, 7:42am UTC](https://community.mp3tag.de/t/regarding-new-bit-depth-information-field/17484/25 "2015-12-31T07:42:51Z")

</div>

> [@d2b](#):
>
> ... I still wish to add ' bits' to the bit depth (word length) portion of the FORMAT tag, e.g. W=16 bits ...

**Format \<== ['A='$regexp(%\_codec%,'[\U\D]',)]['; F='$cutRight(%\_samplerate%,3)$trimRight('.'$right(%\_samplerate%,3),'.0')' kHz']['; W='%\_bitspersample%' bits']['; M='%\_mode%]**

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

---

<div class="post-metadata">

**Author:** ![d2b](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/2bfe46/32.png) [@d2b](https://community.mp3tag.de/u/d2b)\
**Post date:** [December 31, 2015, 8:52am UTC](https://community.mp3tag.de/t/regarding-new-bit-depth-information-field/17484/26 "2015-12-31T08:52:24Z")

</div>

> [@DetlevD](#):
>
> **Format \<== ['A='$regexp(%\_codec%,'[\U\D]',)]['; F='$cutRight(%\_samplerate%,3)$trimRight('.'$right(%\_samplerate%,3),'.0')' kHz']['; W='%\_bitspersample%' bits']['; M='%\_mode%]**
> 
> 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...

---

<div class="post-metadata">

**Author:** ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)\
**Post date:** [December 31, 2015, 9:24am UTC](https://community.mp3tag.de/t/regarding-new-bit-depth-information-field/17484/27 "2015-12-31T09:24:26Z")

</div>

> [@d2b](#):
>
> ... What do the red brackets mean? ...

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

---

<div class="post-metadata">

**Author:** ![d2b](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/2bfe46/32.png) [@d2b](https://community.mp3tag.de/u/d2b)\
**Post date:** [January 5, 2016, 5:49am UTC](https://community.mp3tag.de/t/regarding-new-bit-depth-information-field/17484/28 "2016-01-05T05:49:53Z")

</div>

> [@DetlevD](#):
>
> 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!!!

---

<div class="post-metadata">

**Author:** ![kimosabe](https://community.mp3tag.de/user_avatar/community.mp3tag.de/kimosabe/32/9504_2.png) [@kimosabe](https://community.mp3tag.de/u/kimosabe)\
**Post date:** [November 26, 2023, 2:14am UTC](https://community.mp3tag.de/t/regarding-new-bit-depth-information-field/17484/29 "2023-11-26T02:14:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![d2b](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/2bfe46/32.png) [@d2b](https://community.mp3tag.de/u/d2b)\
**Post date:** [November 26, 2023, 3:28am UTC](https://community.mp3tag.de/t/regarding-new-bit-depth-information-field/17484/30 "2023-11-26T03:28:18Z")

</div>

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:

```auto
'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

---

<div class="post-metadata">

**Author:** ![kimosabe](https://community.mp3tag.de/user_avatar/community.mp3tag.de/kimosabe/32/9504_2.png) [@kimosabe](https://community.mp3tag.de/u/kimosabe)\
**Post date:** [November 26, 2023, 4:21am UTC](https://community.mp3tag.de/t/regarding-new-bit-depth-information-field/17484/31 "2023-11-26T04:21:51Z")

</div>

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)

 ![MP3Tag](https://community.mp3tag.de/uploads/default/original/2X/6/6c2a7c220159caaba6aa55d08661e96b55377710.jpeg)

---

<div class="post-metadata">

**Author:** ![d2b](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/2bfe46/32.png) [@d2b](https://community.mp3tag.de/u/d2b)\
**Post date:** [November 26, 2023, 7:38am UTC](https://community.mp3tag.de/t/regarding-new-bit-depth-information-field/17484/32 "2023-11-26T07:38:55Z")

</div>

I'm sorry to say that I cannot help you with your specialized requirement beyond what I have already shared.

D2B ...

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [November 26, 2023, 8:02am UTC](https://community.mp3tag.de/t/regarding-new-bit-depth-information-field/17484/33 "2023-11-26T08:02:37Z")

</div>

> [@kimosabe](#):
>
> At the very least, to add each field as a tab on the left. (

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.

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [November 26, 2023, 8:14am UTC](https://community.mp3tag.de/t/regarding-new-bit-depth-information-field/17484/34 "2023-11-26T08:14:46Z")

</div>

> [@kimosabe](#):
>
> 16Bit, but for depths at 24 it displays as: 24Bit [Hi-Res].

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.

---

<div class="post-metadata">

**Author:** ![poster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/poster/32/4881_2.png) [@poster](https://community.mp3tag.de/u/poster)\
**Post date:** [November 26, 2023, 8:18am UTC](https://community.mp3tag.de/t/regarding-new-bit-depth-information-field/17484/35 "2023-11-26T08:18:32Z")

</div>

> [@kimosabe](#):
>
> For extra points, can it be setup as an action to add this same info to the "Comments" field?

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.

---

<div class="post-metadata">

**Author:** ![kimosabe](https://community.mp3tag.de/user_avatar/community.mp3tag.de/kimosabe/32/9504_2.png) [@kimosabe](https://community.mp3tag.de/u/kimosabe)\
**Post date:** [November 26, 2023, 10:23am UTC](https://community.mp3tag.de/t/regarding-new-bit-depth-information-field/17484/36 "2023-11-26T10:23:37Z")

</div>

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%

---

<div class="post-metadata">

**Author:** ![MotleyG](https://community.mp3tag.de/user_avatar/community.mp3tag.de/motleyg/32/440_2.png) [@MotleyG](https://community.mp3tag.de/u/MotleyG)\
**Post date:** [November 26, 2023, 12:53pm UTC](https://community.mp3tag.de/t/regarding-new-bit-depth-information-field/17484/37 "2023-11-26T12:53:51Z")

</div>

> [@kimosabe](#):
>
> Update  
> I got it to work with the folowing:

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%`

---

<div class="post-metadata">

**Author:** ![kimosabe](https://community.mp3tag.de/user_avatar/community.mp3tag.de/kimosabe/32/9504_2.png) [@kimosabe](https://community.mp3tag.de/u/kimosabe)\
**Post date:** [November 29, 2023, 11:38am UTC](https://community.mp3tag.de/t/regarding-new-bit-depth-information-field/17484/38 "2023-11-29T11:38:43Z")

</div>

MotleyG, thats awesome. I never would have known to do that. I'll definitely use it thank you.

---

<div class="post-metadata">

**Author:** ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)\
**Post date:** [November 29, 2023, 12:30pm UTC](https://community.mp3tag.de/t/regarding-new-bit-depth-information-field/17484/39 "2023-11-29T12:30:16Z")

</div>

> [@kimosabe](#):
>
> 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`

---

<div class="post-metadata">

**Author:** ![kimosabe](https://community.mp3tag.de/user_avatar/community.mp3tag.de/kimosabe/32/9504_2.png) [@kimosabe](https://community.mp3tag.de/u/kimosabe)\
**Post date:** [December 3, 2023, 10:29am UTC](https://community.mp3tag.de/t/regarding-new-bit-depth-information-field/17484/40 "2023-12-03T10:29:33Z")

</div>

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.

[Previous page](https://community.mp3tag.de/t/regarding-new-bit-depth-information-field/17484.md?page=1)

[Next page](https://community.mp3tag.de/t/regarding-new-bit-depth-information-field/17484.md?page=3)
