所以,我想通过分解成样本和存储阵列的样品处理Java中的声音文件。然后我循环遍历数组,更改每个样本。我意识到java中已经有了一个回声过滤器,但是我需要通过让声音以不同的间隔在整个声音剪辑中以减小的音量重复来设计自己的声音。我目前有一种方法可以控制音量,但是在获取声音重复开始时,当前声音文件的延迟时间很难。这是我到目前为止有:创建Java回声音效
public void echoEffect(int delay){
SoundSample[] sampleArray = this.getSamples(); // get array
SoundSample sample = null; // current sample obj
int value = 0; // value at sample
// loop through SoundSample objects
for(int i = 0, index = 0; index < sampleArray.length; i++,index++)
{
sample = sampleArray[index]; // get current obj
value = sample.getValue(); // get the value
sample.setValue(value*2); // set the value
}
}
我认为我需要做的是改变从虚空方法声音和返回延迟的声音文件。可能返回类似值+值[I +延迟] *(一些分数降低声音)
新的更新,而不是职位:
反正这是我到目前为止,我只是不能似乎让代码正常工作,我知道我很接近,但我需要该方法在声音文件上输出回声效果。以下是我在当前点:
public void echo(int delay){
SoundSample[] sampleArray = this.getSamples(); // get array
//Sound target = new Sound(sampleArray.length);
SoundSample sampleDelay = null;
SoundSample sample = null; // current sample obj
int value = 0; // value at sample
int index = 0;
double value2 = 0;
// loop through SoundSample objects
while (index < sampleArray.length)
{
sample = sampleArray[index]; // get current obj
value = sample.getValue(); // get the value
sampleDelay = (sampleArray[delay-index]);
value2 = (sampleDelay.getValue()*.6);
sample.setValue(value + (int) value2); // set the value
index++; // increment index
}
}
让我知道你们觉得这一切似乎做的是发布一个SSCCE移幅度出于某种原因... 的问题是,这是使用一些在java中不经常使用的类,我相信并且因此我只是在寻找某个人来帮助理解逻辑。我试图循环播放一个声音文件的样本,然后将延迟点处的值设置为声音的开始,但音量变暗。 IDK,如果我解释这个权利,但我希望这将是一个简单的修复。
同样的问题:http://stackoverflow.com/questions/11793310/how-to-add-echo-effect-on-audio-file-using -objective-c – 2013-03-18 16:20:47
为了更快地获得更好的帮助,请发布[SSCCE](http://sscce.org/)。 – 2013-03-20 03:15:53
这是什么问题? – Siddharth 2013-03-20 03:18:10