Java: Quickly fade in and out the gain of a javax.sound.sampled.Clip

I want to smoothly transition between two audio clips that are loaded into an array of `javax.sound.sampled.Clips` in my Java applet. At the moment I stop one clip and start the next but this produces audible clicking noises due to the audio stopping and starting abruptly. I need to use the Clip interface so that I can do looping and transition between clips keeping the same track position. I have tried turning the gain down before stopping one clip and then ramping the gain back up when I start the next using the `FloatControl.Type.MASTER_GAIN`. This requires flushing the buffer if I want to change the gain quickly and even then I get clicking and stuttering if I try to change the gain too quickly. Plus flushing the buffer requires that I stop and restart the clip to get back the buffer that was flushed (so I don't jump forward over the flushed portion) and this introduces the same clicking that I am trying to get rid of. Does anyone have experience changing gain quickly (within 200ms), say from 0dB to -60dB. I'm thinking I may have to get down to the buffer level and start manipulating the bits directly but I don't know how to get to this from the Clip interface. Any suggestions?

以上就是Java: Quickly fade in and out the gain of a javax.sound.sampled.Clip的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准