如何使用均衡器更改每个音频波段的音量? [英] How to change each audio band's volume using Equalizer?

查看:186
本文介绍了如何使用均衡器更改每个音频波段的音量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看不到任何东西可以让我具体控制audiofx.Equalizer库中每个音频波段的音量.不可能吗 任何意见和建议将不胜感激.谢谢.

I don't see anything allow me to specific control each audio band's volume in audiofx.Equalizer library. Is it impossible? Any advice and suggestions will be greatly appreciated. Thank you.

推荐答案

您需要调用方法Equalizer对象的实例上.

由于不同的Android设备具有不同数量的可用频带(具有不同的属性(增益,带宽,中心频率...)),因此您还需要知道可用的最大频带数和增益范围(至少)给你.

Since different Android devices have different number of frequency bands with different properties (gain, bandwidth, center frequency...) available to them, you will also need to know the maximum number of bands and gain range (at least) available to you.

// New instance of equalizer (add it as a member of your class rather than a scoped instance like this)
Equalizer mEqualizer = new Equalizer(0, mMediaPlayer.getAudioSessionId());

// Get the number of bands available on your device
short bands = mEqualizer.getNumberOfBands();

// Get the gain level available for the bands
final short minEQLevel = mEqualizer.getBandLevelRange()[0];
final short maxEQLevel = mEqualizer.getBandLevelRange()[1];

然后可以通过将EQ级别划分为百分比来调用setBandLevel方法.

You can then call your setBandLevel method by dividing your EQ levels into a percentage.

有关更多信息,请参见均衡器常规文档-还有更多内容参数信息均衡器的中心频率和频带宽度等特定信息的获取方法.

For more information consult the Equalizer general documentation - there's more methods for getting specific information such as center frequency and frequency band width of the parametric EQ.

Here is a full example of someone using an equalizer and visualizer in an Android project.

这篇关于如何使用均衡器更改每个音频波段的音量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆