From bfbb896f628c5841517f7fb4d314bff2a5d5ee13 Mon Sep 17 00:00:00 2001 From: Louis Date: Tue, 16 Apr 2024 16:33:07 +0000 Subject: [PATCH] fix audio --- amt/assets/mel_filters.npz | Bin 27910 -> 0 bytes amt/audio.py | 28 ++++++++++++++++++++++++++++ amt/data.py | 23 ++++++++++++----------- 3 files changed, 40 insertions(+), 11 deletions(-) delete mode 100644 amt/assets/mel_filters.npz diff --git a/amt/assets/mel_filters.npz b/amt/assets/mel_filters.npz deleted file mode 100644 index c57535f0a2466d2b612d5fcd5259a2b77aac3bd8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 27910 zcmZ6zbyQT{`vbaxCxHv`hl&@gmJ$I#u}_lo%Y z-h0+!@yFgz?9Y>XpMB<&EXrf12M-=R`|pq9!HwO3(e2;o#e>%mY)x(Sd0Cn596TOA zc=@2^;gkPnJ$SJ5=Fh(e+q37|Vb+)2d#bs;nI_$uoNuD)!>+}8Ub36~3=z-hC5(Fg ziaIs}JpmSh{)*bz#3BJM=+Dk%l4|ZVet7d__i{FMtxSFQ=6nUZgXG_}6@XlJ`3Qt9 zg=`N&yja4q`A1y75_w(9kuA(?ZgQzpYI9YWjJq#CzNNd-TMCfhJ3ToczgEyQroFrZ z`W;w60)_p2>=zA;bs<0GWd+cXp1+Q7G|*jc*qso*Av!DRPBfB*%_XsJNZC!BoKUNF zQ+746&;bb*WzniSPvx*CPiDVOwz;Si-| zHx1uY;lMkJ_4!>red{v}7VubZ*rzN%>UX*oIzZ1$ivL(wmh;c3H^BxZ&OY00yX{8* z6>@VOHT@&=2tFl4^=Vt6O#Ya@vB2!APIh)6G0O-5$oDZ{niPF6_UBQRn?)vl#dydR zJHO|U)BHv>Wy@QQ3*4-g;Fp{}M@wAzwwa>$$zR4n8J~Y!8ZEn_*aCG&Z#rewcF80W zM||e0H|YqgjQRJm^dhD0Wt`3r-~M?rjoz(=P()3~eyYjx&mU$P&lhWRhHdV>sxmoW z^h^1W{-~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ni@v%ItiM;_g1dK8vSH%mhQ(&$ooNw{JLS@t(Jyb5H|y9W8rV1?7vY_ za--2<8vC`nIr%?ja5L{WKqzGJ2`GHXHJM;+pvJZISgU`XuX>{l-Ca z$Lq%E!F0zD&v>!yWnLw(gC4TZYaiTT=$DG*yJw`L-x@c(gx!R%&vYNUpk;1XEhWs? z`Dy4ie5RWYqh%NV8vW|3ZDN!uY$e}FYSxqj)8+$T2g{-2@&IU>p=kSX^r~3fCm=F= z@Km=hnZ-r-bM67#NxL9!`H8o?VY3Cp_Aro2tSi%bRtPs9s6HFLp5zcvrk})Oz`<{$ z9<|cGtbCk`W-DrE-3?9eLsK5ii+{ZLee}>Kd6M5tPvGkEr^M-ZhO2ctN>dY$7{z{9 z!j|s27FAX(0^^he+#bU#fOI2{Yc(QxRE57NYc?jmKrnw4AnxT_GjIPl7g0|v;R>T$ zSFt~F)g@oL8b(G7p4N90`_D3X1;K3Cx1hj12wp`t<7Q!NIB1 zmD8&l$`>y3Uixnv{ogKv^c}Ia`+uB$F^sgZo*D8-;8|SxpRbDj?|%QiRqMZ3X8rg2 zEYcY!r61RWKhC~JMt;ZE|L*u-<=}s1fq}nE1pohz0ly>re+tQUgc{11uly(T((ixp M-+$#D{`=qm1unl!)&Kwi diff --git a/amt/audio.py b/amt/audio.py index 7038d17..599885c 100644 --- a/amt/audio.py +++ b/amt/audio.py @@ -4,7 +4,9 @@ import random import torch import torchaudio +import torch.nn.functional as F import torchaudio.functional as AF +import numpy as np from amt.config import load_config from amt.tokenizer import AmtTokenizer @@ -21,6 +23,32 @@ FRAMES_PER_SECOND = SAMPLE_RATE // HOP_LENGTH # 10ms per audio frame TOKENS_PER_SECOND = SAMPLE_RATE // N_SAMPLES_PER_TOKEN # 20ms per audio token +def pad_or_trim(array, length: int = N_SAMPLES, *, axis: int = -1): + """ + Pad or trim the audio array to N_SAMPLES, as expected by the encoder. + """ + if torch.is_tensor(array): + if array.shape[axis] > length: + array = array.index_select( + dim=axis, index=torch.arange(length, device=array.device) + ) + + if array.shape[axis] < length: + pad_widths = [(0, 0)] * array.ndim + pad_widths[axis] = (0, length - array.shape[axis]) + array = F.pad( + array, [pad for sizes in pad_widths[::-1] for pad in sizes] + ) + else: + if array.shape[axis] > length: + array = array.take(indices=range(length), axis=axis) + + if array.shape[axis] < length: + pad_widths = [(0, 0)] * array.ndim + pad_widths[axis] = (0, length - array.shape[axis]) + array = np.pad(array, pad_widths) + + return array # Refactor default params are stored in config.json class AudioTransform(torch.nn.Module): diff --git a/amt/data.py b/amt/data.py index f4103ae..cde420a 100644 --- a/amt/data.py +++ b/amt/data.py @@ -106,15 +106,18 @@ def get_wav_mid_segments( def pianoteq_cmd_fn(mid_path: str, wav_path: str): presets = [ - "C. Bechstein", - "C. Bechstein Close Mic", - "C. Bechstein Under Lid", - "C. Bechstein 440", - "C. Bechstein Recording", - "C. Bechstein Werckmeister III", - "C. Bechstein Neidhardt III", - "C. Bechstein mesotonic", - "C. Bechstein well tempered", + "C. Bechstein DG Prelude", + "C. Bechstein DG Sweet", + "C. Bechstein DG Felt I", + "C. Bechstein DG Felt II", + "C. Bechstein DG D 282", + "C. Bechstein DG Recording 1", + "C. Bechstein DG Recording 2", + "C. Bechstein DG Recording 3", + "C. Bechstein DG Cinematic", + "C. Bechstein DG Snappy", + "C. Bechstein DG Venue", + "C. Bechstein DG Player", "HB Steinway D Blues", "HB Steinway D Pop", "HB Steinway D New Age", @@ -137,8 +140,6 @@ def pianoteq_cmd_fn(mid_path: str, wav_path: str): "HB Steinway D Cabaret", "HB Steinway D Bright", "HB Steinway D Hyper Bright", - "HB Steinway D Prepared", - "HB Steinway D Honky Tonk", ] preset = random.choice(presets)