[英]Matlab - Double duration of .wav
我正在使用wavread
函數讀取的單個便箋創建單個便箋。
我正在使用resample
功能來創建這些注釋。 例如:
f5 = resample(a,440,698); %creates note.
f5_short = f5(dur:Hz); %creates duration of note (ie 1 sec)
f5_hf = f5_short(dur:Hz/2); %creates note of half duration
上面的代碼似乎運行良好。 不幸的是,我在創建“雙音符”時遇到麻煩...我不想只演奏同一音符兩次,而我嘗試了以下操作:
f5_db = f5_short(dur*2:Hz); %exceeds size of matrix
f5_db = f5_short(dur:Hz*2); %exceeds size of matrix
f5_db = resample(f5_short,Hz*2,330); %tried upSampling it and although lengths it, note becomes deeper.
在不更改音符的情況下,為什么不加波浪線長度加倍的最簡單的方法是什么? (舒展,但保持正確的音符?)謝謝。
您需要將f5_short
的大小f5_short
,而不是對其進行索引:
f5_db = repmat(f5_short, 2, 1);
要不就
f5_db = [f5_short; f5_short];
如果在f5_short
的開頭和結尾都有暫停,但是中間序列是恆定的,則可以重現中間以獲取雙音。 像這樣:
f5_short_len = length(f5_short);
f5_short_mid = floor(f5_short_len/2);
f5_db = [f5_short(1:f5_short_mid,:); ...
repmat(f5_short(f5_short_mid,:),f5_short_len,1); ...
f5_short(f5_short_mid+1:f5_short_len,:)];
如果要刪除暫停;
f5_short = repmat(f5_short(f5_short_mid),f5_short_len,1);
f5_db = repmat(f5_short, 2, 1);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.