所以在下面的程序中,它的速度的音頻文件,並使它聽起來好像人有「氦聲音」。這是通過改變索引值來完成的,而當你增加索引值時,文件的音高和速度會更快。我想知道是否有辦法做相反的事情,並且讓音頻播放更慢,聲音更深。放慢聲音速度
public void helium(String sourceFile, String targetFile)
{
Sound sourceObj = new Sound(sourceFile);
Sound target = new Sound(targetFile);
int sampleValue = 0;
int targetIndex = 0;
for(int index = 0; index < sourceObj.getLength(); index+=2)
{
sampleValue = sourceObj.getSampleValueAt(index);
target.setSampleValueAt(targetIndex,sampleValue);
targetIndex++;
}
target.play();
}
使用負值? – Tavo
如果你把索引的負值,它只會導致錯誤 –
如果你增加1並使用'索引/ 2'會怎麼樣? – shmosel