1
0
mirror of https://github.com/NekoX-Dev/NekoX.git synced 2024-12-14 06:19:27 +01:00

Increase voice quality

This commit is contained in:
世界 2020-08-20 08:59:08 +00:00
parent e5fa25c27a
commit b9084db81c
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4

View File

@ -521,7 +521,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
private ArrayList<ByteBuffer> recordBuffers = new ArrayList<>();
private ByteBuffer fileBuffer;
public int recordBufferSize = 1280;
public int sampleRate = 16000;
public int sampleRate = 48000;
private int sendAfterDone;
private boolean sendAfterDoneNotify;
private int sendAfterDoneScheduleDate;
@ -817,7 +817,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
recordQueue.postRunnable(() -> {
try {
sampleRate = 16000;
sampleRate = 48000;
int minBuferSize = AudioRecord.getMinBufferSize(sampleRate, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT);
if (minBuferSize <= 0) {
minBuferSize = 1280;
@ -3075,7 +3075,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
recordingAudioFile = new File(FileLoader.getDirectory(FileLoader.MEDIA_DIR_CACHE), FileLoader.getAttachFileName(recordingAudio));
try {
if (startRecord(recordingAudioFile.getAbsolutePath(), 16000) == 0) {
if (startRecord(recordingAudioFile.getAbsolutePath(), 48000) == 0) {
AndroidUtilities.runOnUIThread(() -> {
recordStartRunnable = null;
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.recordStartError, guid);