Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid environmentalreverb doesn't do anything
    primarykey
    data
    text
    <p>I'm trying to apply a reverb effect to a sine wave that I'm generating using AudioTrack. I tried presetReverb and applied it to audiosession 0 like the docs said, since doing the getAudioSessionId() method brought an error, but that didn't apply a reverb at all. So I tried EnvironmentalReverb and tried audiosession 0, and also using getAudioSessionId(), both of which didn't create a reverb.</p> <p>Here's my code:</p> <pre><code>t = new Thread() { public void run() { setPriority(Thread.MAX_PRIORITY); int buffsize = AudioTrack.getMinBufferSize(sr, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT); AudioTrack audioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, sr, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT, buffsize, AudioTrack.MODE_STREAM); EnvironmentalReverb reverb = new EnvironmentalReverb(1,0); audioTrack.attachAuxEffect(reverb.getId()); reverb.setDiffusion((short) 1000); reverb.setReverbLevel((short) 1000); reverb.setDecayTime(10000); reverb.setReverbDelay(100); reverb.setDensity((short) 1000); audioTrack.setAuxEffectSendLevel(1.0f); reverb.setEnabled(true); short samples[] = new short[buffsize]; int amp = 32767; double twopi = 2*Math.PI; double fr = 262.f; double ph = 0.0; audioTrack.play(); while(isRunning) { fr = 262; for(int i=0; i &lt; buffsize; i++) { samples[i] = (short) (amp*Math.sin(ph)); ph += twopi*fr/sr; } audioTrack.write(samples, 0, buffsize); } audioTrack.stop(); audioTrack.release(); } }; t.start(); </code></pre> <p>I have the modify audio settings permission in my manifest, so why doesn't this create the reverb effect?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload