# How to convert value ranges to a description?

**URL:** <https://community.mp3tag.de/t/how-to-convert-value-ranges-to-a-description/57790>\
**Category:** Support\
**Created:** [July 1, 2022, 9:15am UTC](https://community.mp3tag.de/t/how-to-convert-value-ranges-to-a-description/57790 "2022-07-01T09:15:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![bascurtiz](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@bascurtiz](https://community.mp3tag.de/u/bascurtiz)\
**Post date:** [July 1, 2022, 9:15am UTC](https://community.mp3tag.de/t/how-to-convert-value-ranges-to-a-description/57790/1 "2022-07-01T09:15:22Z")

</div>

I want to convert values to descriptions.

Example of values:

 ![image](https://community.mp3tag.de/uploads/default/original/2X/9/915550dd7988c75a22ad9c2593ac00670ec2bb60.png)

Example of descriptions:  
 ![image](https://community.mp3tag.de/uploads/default/original/2X/5/550d4bd23e182480c8becf80ff981e4622d3765f.png)

The value range is always `0-100`.  
Right now, the descriptions are based on 1/3's (33%).  
So for example, `0-33` for **1T\_DANCEABILITY** = _#dance-low_  
and `34-66` for for **1T\_ENERGY** = _#energy-med_

What I want to achieve is dividing them into 1/5's (20%) instead.  
So for example, `0-20` for **1T\_DANCEABILITY** = _#dance-lowest_  
and `21-40` for **1T\_DANCEABILITY** = _#dance-lower_

Something like if **1T\_DANCEABILITY** is between `0-20`, then write/add _#dance-lowest_ to `{user-defined tag}`.  
If **1T\_VALENCE** is between `80-100`, then write/add _#happiest_ to `{user-defined tag}`.

This way you end up with the example of the `Album` tag in example screenshot, but instead of thirds, it's more detailed, based on fifths.  
How would I do this in Mp3tag, based on the existing values?

---

<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:** [July 1, 2022, 9:18am UTC](https://community.mp3tag.de/t/how-to-convert-value-ranges-to-a-description/57790/2 "2022-07-01T09:18:08Z")

</div>

How do you achieve it currently with your 1/3's (33%)?

---

<div class="post-metadata">

**Author:** ![bascurtiz](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@bascurtiz](https://community.mp3tag.de/u/bascurtiz)\
**Post date:** [July 1, 2022, 9:19am UTC](https://community.mp3tag.de/t/how-to-convert-value-ranges-to-a-description/57790/3 "2022-07-01T09:19:23Z")

</div>

Using [https://onetagger.github.io](https://onetagger.github.io)

---

<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:** [July 1, 2022, 9:30am UTC](https://community.mp3tag.de/t/how-to-convert-value-ranges-to-a-description/57790/4 "2022-07-01T09:30:37Z")

</div>

You could use the $DIV() and $replace() function:

`$replace($div(%1T_DANCEABILITY%,20),1,#dance-lowest,2,#dance-lower,3,#dance-med,5,#dance-high)`

---

<div class="post-metadata">

**Author:** ![bascurtiz](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@bascurtiz](https://community.mp3tag.de/u/bascurtiz)\
**Post date:** [July 1, 2022, 10:55am UTC](https://community.mp3tag.de/t/how-to-convert-value-ranges-to-a-description/57790/5 "2022-07-01T10:55:19Z")

</div>

Yay! That works, thank you very much 🙂

Example outcome (based on OP values):

 ![image](https://community.mp3tag.de/uploads/default/original/2X/2/2bfc6c6307d850f584d3943c0517fdfd0779e0be.png)

Now how would I add these to one tag, like for ex. the COMMENT tag?  
If I simply use the formula mentioned, it overwrites the existing.

My action:  
 ![image](https://community.mp3tag.de/uploads/default/original/2X/d/dab7ab6166a0af3e524bcf579ed5d3e259adcfcf.png)

**DANCEABILITY**  
`$replace($div(%1T_DANCEABILITY%,20),0,#dance-min,1,#dance-low,2,#dance-med,3,#dance-high,4,#dance-max)`

**ENERGY**  
`$replace($div(%1T_ENERGY%,20),0,#energy-min,1,#energy-low,2,#energy-med,3,#energy-high,4,#energy-max)`

**ACOUSTICNESS**  
`$replace($div(%1T_ACOUSTICNESS%,20),0,#electronic,1,#acoustic-low,2,#acoustic-med,3,#acoustic-high,4,#acoustic-max)`

**INSTRUMENTALNESS**  
`$replace($div(%1T_INSTRUMENTALNESS%,20),0,#vocal-max,1,#vocal-high,2,#vocal-med,3,#vocal-low,4,#instrumental)`

**LIVENESS**  
`$replace($div(%1T_LIVENESS%,20),0,#recorded,1,#live-low,2,#live-med,3,#live-high,4,#live-max)`

**SPEECHINESS**  
`$replace($div(%1T_SPEECHINESS%,20),0,#music,1,#speech-low,2,#speech-med,3,#speech-high,4,#speech-max)`

**VALENCE**  
`$replace($div(%1T_VALENCE%,20),0,#sad-max,1,#sad-low,2,#balanced,3,#happy-high,4,#happy-max)`

**POPULARITY**  
`$replace($div(%1T_POPULARITY%,20),0,#unpopular-max,1,#unpopular-low,2,#popular-med,3,#popular-high,4,#popular-max)`

---

<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:** [July 1, 2022, 11:05am UTC](https://community.mp3tag.de/t/how-to-convert-value-ranges-to-a-description/57790/6 "2022-07-01T11:05:06Z")

</div>

> [@bascurtiz](#):
>
> Now how would I add these to one tag, like for ex. the COMMENT tag?

Action: Format Value  
Field. COMMENT  
Format string: every other field you want to copy the content from, like  
`%COMMENT% - %DANCEABILITY% - %ENERGY%`  
and so on. If you don't want to separate the values with a `-`, just use a space or nothing at all between the field names.

---

<div class="post-metadata">

**Author:** ![bascurtiz](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@bascurtiz](https://community.mp3tag.de/u/bascurtiz)\
**Post date:** [July 1, 2022, 11:22am UTC](https://community.mp3tag.de/t/how-to-convert-value-ranges-to-a-description/57790/7 "2022-07-01T11:22:46Z")

</div>

Works - Thanks! 🙂

I've added the comment itself, so it preserves what was written before:  
`%COMMENT% - %DANCEABILITY% - %ENERGY% - %ACOUSTICNESS% - %INSTRUMENTALNESS% - %LIVENESS% - %SPEECHINESS% - %VALENCE% - %POPULARITY%`

 ![image](https://community.mp3tag.de/uploads/default/original/2X/a/a71f3d30949d2bb8b76187d50ea5ad4f7abb072d.png)

For those who don't want to write the formula from scratch, hereby the action.  
Copy into `C:\Users\YourUserName\AppData\Roaming\Mp3tag\data\actions`  
[Value ranges to 5ths.mta](https://community.mp3tag.de/uploads/short-url/6HAUvaELAjVgTWUt4Hw4se7IFLi.mta) (1.2 KB)

---

<div class="post-metadata">

**Author:** ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)\
**Post date:** [July 31, 2022, 11:22am UTC](https://community.mp3tag.de/t/how-to-convert-value-ranges-to-a-description/57790/8 "2022-07-31T11:22:57Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
