Closed MolchanovDmitry closed 6 years ago
Does this happen with a specific USB audio device only?
Now I have checked with other device. The same result.
Please let me know your phone model, Android version and the USB audio device models.
Mag410(SmartTV), Android 6.0.1. USB audio device - UGM96.
Is USB IO buffer size limited by 512 ? Can I put 1024, for example?
I am having this issue as well. On an LG G4 device, I get crackling when the app goes into the background. Increasing the buffer size did not help.
you need to enable sustained performance mode with the SuperpoweredCPU class
We use it already: void SuperpoweredRenderer::onPlayPause(bool play, bool record) { if (!play) { audioPlayer->pause(); } else { audioPlayer->play(false); }; SuperpoweredCPU::setSustainedPerformanceMode(play); // <-- Important to prevent audio dropouts. }
@MolchanovDmitry I fixed this by setting the samplerate and buffersize dynamically, from the HLSExample:
if (Build.VERSION.SDK_INT >= 17) { AudioManager audioManager = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE); samplerateString = audioManager.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE); buffersizeString = audioManager.getProperty(AudioManager.PROPERTY_OUTPUT_FRAMES_PER_BUFFER); } if (samplerateString == null) samplerateString = "44100"; if (buffersizeString == null) buffersizeString = "512";
See if that works for you.
@DanNi0130 Thanks you. But your code applied with SuperpoweredAndroidAudioIO. But I have crackling with USB IO only.
Oh sorry, good luck with your problem!
Can you test with another Android device, not the smart tv?
Good day. I have some problem with sound quality. Songs sound like from gramophone with specific crackling.
I play sound with code below: SuperpoweredUSBAudio::getBestIO (devID, &inputIOindex, &outputIOindex, 44100, 16, 2, 2, true); SuperpoweredUSBAudio::startIO(devID, inputIOindex, outputIOindex, SuperpoweredUSBLatency_High, this, audioProcessingUsb);
Also tried with: SuperpoweredUSBAudio::easyIO(deviceID, 44100, 16, 0, 256, SuperpoweredUSBLatency_Low, this, audioProcessing)
There is no reason for crackling: processUsb(float *output, unsigned int numberOfSamples) {
audioRecorder->process(output, NULL, numberOfSamples);
bool silence = audioPlayer->process(output, false, numberOfSamples);
return silence;}
By the way I route sound throught USB and standard android music players play songs clearly. Also tried to play with arguments, but without result.
Can I get some advice? Thanks you!