# Limiting leading zeroes in BPM

**URL:** <https://community.mp3tag.de/t/limiting-leading-zeroes-in-bpm/59608>\
**Category:** Support\
**Created:** [January 3, 2023, 5:56pm UTC](https://community.mp3tag.de/t/limiting-leading-zeroes-in-bpm/59608 "2023-01-03T17:56:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ianwat](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/i/7993a0/32.png) [@ianwat](https://community.mp3tag.de/u/ianwat)\
**Post date:** [January 3, 2023, 5:56pm UTC](https://community.mp3tag.de/t/limiting-leading-zeroes-in-bpm/59608/1 "2023-01-03T17:56:16Z")

</div>

Hi Guys, happy new year and hope you are all well.

I'm finally getting into the swing of MP3tag, but encountered a strange one.

The file "D:\1D\OneDrive\N\PO\2023-01\24kGoldn & Bandmanrill - Checkers (Explicit) - 8B - 00144 BPM 2023.m4a" already exists.  
File "D:\1D\OneDrive\N\PO\2023-01\24kGoldn & Bandmanrill - Checkers (Explicit) - 8B - 00144 BPM 2023.m4a" has not been renamed.

The BPM has 2 leading zeroes in it, which I'd like to remove on the rename.

Would I be correct in thinking that.

$num(%BPM%,3) would get me a 080 or 123 BPM, but it's not quite what I want as I'd prefer 80 than 080.

It also removes the BPM from the field, but I can fix that with the rename, but I guess I'd like to do it "properly"

Again many thanks for the help in advance.

---

<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:** [January 3, 2023, 6:05pm UTC](https://community.mp3tag.de/t/limiting-leading-zeroes-in-bpm/59608/2 "2023-01-03T18:05:01Z")

</div>

Do you have this BPM-Value in the filename only or do you have it in a tag called "tBPM"?  
(Or is this only a typo and its real name in ALT + T is shown as `BPM`?)

---

<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:** [January 3, 2023, 6:16pm UTC](https://community.mp3tag.de/t/limiting-leading-zeroes-in-bpm/59608/3 "2023-01-03T18:16:58Z")

</div>

> [@ianwat](#):
>
> $num(%tBPM%,3)

Try `$num(%bpm%,1)` to remove any leading zeros.  
(Edit: took the wrong field)

---

<div class="post-metadata">

**Author:** ![ianwat](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/i/7993a0/32.png) [@ianwat](https://community.mp3tag.de/u/ianwat)\
**Post date:** [January 3, 2023, 6:20pm UTC](https://community.mp3tag.de/t/limiting-leading-zeroes-in-bpm/59608/4 "2023-01-03T18:20:25Z")

</div>

Typo, corrected it's in BPM (or tempo as shown in files / properties )

---

<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:** [January 3, 2023, 6:25pm UTC](https://community.mp3tag.de/t/limiting-leading-zeroes-in-bpm/59608/5 "2023-01-03T18:25:12Z")

</div>

Then @ohrenkino's advice  
`$num(%bpm%,1)`  
will work for you.

I just learned that this `$num` returns string **x** interpreted as decimal number, padded with leading zeros from the left up to **y** digits. So if you only use 1 for **y** , it can't be filled with additional/leading zeroes.

From the [help](https://docs.mp3tag.de/scripting/#string-functions):

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

---

<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:** [January 3, 2023, 9:28pm UTC](https://community.mp3tag.de/t/limiting-leading-zeroes-in-bpm/59608/7 "2023-01-03T21:28:08Z")

</div>

The $num() function serves 2 purposes:

1. transform the given string to a number
2. format it to a given number of digits, if necessary with padding zeros. If the formatting parameter is "1" then the number stays as it is.

So, no, this means to output only the numeric part. That is why you also loose the "BPM" string.

---

<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:** [February 2, 2023, 9:28pm UTC](https://community.mp3tag.de/t/limiting-leading-zeroes-in-bpm/59608/8 "2023-02-02T21:28:10Z")

</div>

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