当前位置:网站首页>Audiotrack record of a problem in playing a wav file

Audiotrack record of a problem in playing a wav file

2022-06-10 05:31:00 lucky_ tom

Project scenario :

Project scenario : Use AudioTrack Instead of SoundPool Play wav file , See... For the reason

This blog


Problem description :

The customer has updated a wav After sound effect , I found that the sound playback speed has increased several times , There is a funny effect similar to the fast forward of entertainment programs , I don't laugh unless I can't hold back !!!.

// The system goes through Api Can you adjust the playback rate , however AudioTrack There is no interface to provide playback speed .
AudioTrack  mAudioTrack = new AudioTrack(AudioManager.STREAM_MUSIC,
                        44100, AudioFormat.CHANNEL_OUT_MONO,
                        AudioFormat.ENCODING_PCM_16BIT,
                        mMinBufferSize, AudioTrack.MODE_STREAM);


Cause analysis :

Since there is a problem with the replacement audio , So I focused on analyzing the new audio file , Use GoldWave Operate a wave , Use sampling rate before discovery 44100Hz, New file use 16000Hz, The code is normal after changing the sampling rate .


Solution :

If the project is to use wav Finally, determine and unify the sampling rate in advance , Prevent unnecessary problems and extra workload .

原网站

版权声明
本文为[lucky_ tom]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/160/202206091033562489.html