squti/Android-Wave-Recorder

Recording playback is buzzing sound, not detecting any audio data i think

Closed this issue · 6 comments

I'm sure this program works completely fine, I am trying to use it for an audio recording app for sound engineers. I know it is probably one small thing that I am missing but I am not sure, the code looks fine and all I did was use the classes so. I have a github repo of the project if you want to skim the code. I'm really thankful to have this since I'm not really an audio programmer but I've learned so much. If you could help me that would be awesome. The playback is just a buzzing sound like an aux cord when it's not plugged in.

Could you please provide the waveConfig parameters you pass to WaveRecorder?

data class WaveConfig(
    var sampleRate: Int = 44100,
    var channels: Int = AudioFormat.CHANNEL_IN_MONO,
    var audioEncoding: Int = AudioFormat.ENCODING_PCM_16BIT
)

internal fun bitPerSample(audioEncoding: Int) = when (audioEncoding) {
    AudioFormat.ENCODING_PCM_8BIT -> 8
    AudioFormat.ENCODING_PCM_16BIT -> 16
    AudioFormat.ENCODING_PCM_32BIT -> 32
    else -> 16
} 

I am also thinking it could be in emulator issue, I believe emulators do not have direct access to computer/laptop recording hardware such as in-built mics, or USB mics. So I am going to test on a android device.

Please let me know if you tested on a physical device. If it does not work, change the sample rate to 16000 instead of 44100 and try again on a real device. Android Emulator supports laptop microphones but sometimes does not work properly.

Please let me know if you tested on a physical device. If it does not work, change the sample rate to 16000 instead of 44100 and try again on a real device. Android Emulator supports laptop microphones but sometimes does not work properly.

Hey again man, after a testing some different configs, I was able to get it working, honestly this is an amazing library. I am not sure why, but 44.1k sample rate and 16 BPS and mono channel only gave me ticking sounds. I changed to channel in stereo (2 channels), 48k sample rate, and 32 BPS, and now i am getting super clear sound. The files are much bigger but it is fine since the purpose of this app is for sound analysis so i need the clearest sound. Anyways, thank you so much because your contribution literally saved me since this is a project i have to do for work. Good luck programming!

I'm glad your problem is solved, so I close this issue.