所以在下面的程序中,它的速度的音频文件,并使它听起来好像人有“氦声音”。这是通过改变索引值来完成的,而当你增加索引值时,文件的音高和速度会更快。我想知道是否有办法做相反的事情,并且让音频播放更慢,声音更深。放慢声音速度
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