I am trying to record audio in Java using my RaspBerry Pi 3 and Raspbian Jessie. My app works on my Mac both with internal and external USB micro. On the Raspberry Pi, with whatever format I use, I always get:
javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 16000.0 Hz, 16 bit, mono, 2 bytes/frame, big-endian not supported.
javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 8000.0 Hz, 8 bit, mono, 1 bytes/frame, not supported.
...
Any idea what the problem may be?
Edited: 8000Hz and 16 bits (a combination I hadn't tried) throws no exception, but I need 16000Hz/16 bits for my app. The problem is rephrased to ask how to record at that rate with Java in my Raspberry. Thanks.
Second edit: I am using Kinobo USB mic. I just noticed that the problem maybe that as if I try to record using the native arecord command I get:
pi@raspberrypi:~ $ arecord -r 16000 -f S16_LE output2.wav -d 5
Recording WAVE 'output2.wav' : Signed 16 bit Little Endian, Rate 16000 Hz, Mono
Warning: rate is not accurate (requested = 16000Hz, got = 11025Hz)
please, try the plug plugin (-Dplug:default)
With -Dplug plugin suggested I get it to work, but with a extremely low signal level and a lot of noise. May be the problem is that Java cannot record more than 11025 with this Mic?