JAVA RECORDING PROBLEMS with 8 16 24 and 48k

Moderator: flatmax

Post Reply
makaf
Posts: 4
Joined: Tue Aug 29, 2017 11:31 am

JAVA RECORDING PROBLEMS with 8 16 24 and 48k

Post by makaf » Tue Aug 29, 2017 11:27 pm

Dear Matt,

i am struggeling when recording with a JAVA-application at different rates.

first i checked with aplay and arecord and it worked fine.

when trying the same through a JAVA application only 24k works, all other rates do not start and show same error (pls see attachement #1).
if i use the anyrate-alsa-setup (described in other post) there is no error but sound is distorted.

i attached small java-routine where you can make out the audioinjector is recognized correctly by JAVA but if you start sending the errors come up.

it would be great if you could suggest a workaround for this situation

best regards
markus

p.s. alsa test-setup

#!/bin/bash
sudo arecord -v -d10 -Dplughw:0,0 -fS16_LE -r 8000 -c2 test8k.wav
sudo arecord -v -d10 -Dplughw:0,0 -fS16_LE -r 16000 -c2 test16k.wav
sudo arecord -v -d10 -Dplughw:0,0 -fS16_LE -r 24000 -c2 test24k.wav
sudo arecord -v -d10 -Dplughw:0,0 -fS16_LE -r 48000 -c2 test48k.wav
aplay -v -Dplughw:0,0 test8k.wav
aplay -v -Dplughw:0,0 test16k.wav
aplay -v -Dplughw:0,0 test32k.wav
aplay -v -Dplughw:0,0 test48k.wav

#/etc/asound.conf
#pcm.!default {
# type asym
# playback.pcm "dmixplug"
# capture.pcm "dsnoopplug"
# }
# pcm.dmixplug {
# type plug slave.pcm "dmix"
# }
# pcm.dsnoopplug {
# type plug slave.pcm "dsnoop"
# }
Attachments
lineapp-soundcheck.jar.zip
(7.87 KiB) Downloaded 115 times
Screen Shot 2017-08-29 at 09.52.10.png
Screen Shot 2017-08-29 at 09.52.10.png (63.12 KiB) Viewed 4230 times
Screen Shot 2017-08-28 at 13.41.11.png
Screen Shot 2017-08-28 at 13.41.11.png (103.31 KiB) Viewed 4230 times

flatmax
Posts: 609
Joined: Sat Jul 23, 2016 11:39 pm

Re: JAVA RECORDING PROBLEMS with 8 16 24 and 48k

Post by flatmax » Sat Sep 02, 2017 12:56 pm

ok - it seems that the plughw is working, which suggests it is a problem to do with the specific hw formats you are requesting.
Can you please try equivalent hw formats as wav files. You can use sox to generate them.

sox inputFile -r rate -c channels -b .... and so on ... outputFile

Then aplay to test.

Matt
Check out our audiophile quality crossovers : https://bit.ly/2kb1nzZ
Please review the Zero sound card on Amazon USA : https://www.amazon.com/dp/B075V1VNDD
---
Check out our new forum on github : https://github.com/Audio-Injector

makaf
Posts: 4
Joined: Tue Aug 29, 2017 11:31 am

Re: JAVA RECORDING PROBLEMS with 8 16 24 and 48k

Post by makaf » Wed Sep 06, 2017 6:26 pm

hi Matt,

pls see results with sox where only the 24k is dropping to 22050.
i will chk with ffmpeg and different java-runtime versions next.

best regards
markus


SOX RECORD MP3
Sample Rate : 16000 Precision : 16-bit Sample Encoding: 16-bit Signed Integer PCM
sox WARN formats: can't set sample rate 24000; using 22050
Sample Rate : 22050 Precision : 16-bit Sample Encoding: 16-bit Signed Integer PCM
Sample Rate : 32000 Precision : 16-bit Sample Encoding: 16-bit Signed Integer PCM
Sample Rate : 48000 Precision : 16-bit Sample Encoding: 16-bit Signed Integer PCM
SOX PLAY MP3
sox_16k.mp3: Samplerate: 16000Hz
sox_24k.mp3: Samplerate: 22050Hz
sox_32k.mp3: Samplerate: 32000Hz
sox_48k.mp3: Samplerate: 48000Hz
SOX RECORD FLAC
Channels : 2 Sample Rate : 16000 Precision : 16-bit Sample Encoding: 16-bit Signed Integer PCM
sox WARN formats: can't set sample rate 24000; using 22050
Channels : 2 Sample Rate : 22050 Precision : 16-bit Sample Encoding: 16-bit Signed Integer PCM
Channels : 2 Sample Rate : 32000 Precision : 16-bit Signed Integer PCM
Channels : 2 Sample Rate : 48000 Precision : 16-bit Sample Encoding: 16-bit Signed Integer PCM
SOX PLAY FLAC
sox_16k.flac: Encoding: FLAC Info: Processed by SoX Channels: 2 @ 16-bit Samplerate: 16000Hz
sox_24k.flac: Encoding: FLAC Info: Processed by SoX Channels: 2 @ 16-bit Samplerate: 22050Hz
sox_32k.flac: Encoding: FLAC Info: Processed by SoX Channels: 2 @ 16-bit Samplerate: 32000Hz
sox_48k.flac: Encoding: FLAC Info: Processed by SoX Channels: 2 @ 16-bit Samplerate: 48000Hz

flatmax wrote:
Sat Sep 02, 2017 12:56 pm
ok - it seems that the plughw is working, which suggests it is a problem to do with the specific hw formats you are requesting.
Can you please try equivalent hw formats as wav files. You can use sox to generate them.

sox inputFile -r rate -c channels -b .... and so on ... outputFile

Then aplay to test.

Matt

makaf
Posts: 4
Joined: Tue Aug 29, 2017 11:31 am

Re: JAVA RECORDING PROBLEMS with 8 16 24 and 48k

Post by makaf » Wed Sep 06, 2017 9:51 pm

dear Matt,

pls see the results with ffmpeg are the same as with sox before.

do not get confused because i had to continue testing with your OCTO-soundcard, so the channels are different.

br
markus


# ffmpeg -t 15 -f alsa -ac 8 -ar 16000 -i hw:0,0 -f flac ffmpeg16k.flac
Stream #0:0: Audio: pcm_s16le, 16000 Hz, 7.1, s16, 2048 kb/s Stream mapping: Stream #0:0 -> #0:0 (pcm_s16le (native) -> flac (native))
Stream #0:0: Audio: pcm_s16le, 22050 Hz, 7.1, s16, 2822 kb/s Stream mapping: Stream #0:0 -> #0:0 (pcm_s16le (native) -> flac (native))
Stream #0:0: Audio: pcm_s16le, 32000 Hz, 7.1, s16, 4096 kb/s Stream mapping: Stream #0:0 -> #0:0 (pcm_s16le (native) -> flac (native))
Stream #0:0: Audio: pcm_s16le, 48000 Hz, 7.1, s16, 6144 kb/s Stream mapping: Stream #0:0 -> #0:0 (pcm_s16le (native) -> flac (native))

play ffmpeg*.flac
ffmpeg16k.flac: Encoding: FLAC Channels: 8 @ 16-bit Samplerate: 16000Hz
ffmpeg24k.flac: Encoding: FLAC Channels: 8 @ 16-bit Samplerate: 22050Hz
ffmpeg32k.flac: Encoding: FLAC Channels: 8 @ 16-bit Samplerate: 32000Hz
ffmpeg48k.flac: Encoding: FLAC Channels: 8 @ 16-bit Samplerate: 48000Hz

flatmax
Posts: 609
Joined: Sat Jul 23, 2016 11:39 pm

Re: JAVA RECORDING PROBLEMS with 8 16 24 and 48k

Post by flatmax » Sat Sep 16, 2017 1:47 pm

Regarding 24kHz on the stereo card, I think it only supports these rates :
8000, 16000, 32000, 44100, 48000, 96000, 88200,

due to recent changes with the i2s driver in the kernel, I need to update the machine driver to get 8kHz back.

Matt
Check out our audiophile quality crossovers : https://bit.ly/2kb1nzZ
Please review the Zero sound card on Amazon USA : https://www.amazon.com/dp/B075V1VNDD
---
Check out our new forum on github : https://github.com/Audio-Injector

makaf
Posts: 4
Joined: Tue Aug 29, 2017 11:31 am

Re: JAVA RECORDING PROBLEMS with 8 16 24 and 48k

Post by makaf » Wed Sep 27, 2017 10:08 am

dear Matt,

case closed

we found wrong settings in octave which caused the issues.

24 and 48k are tested and working fine

thank you

best regards
markus

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests