I experimenting with sound measuring with Raspberry pi 4 and hifiberry adc + dac pro. I am not able to play wav files shorter then 25 ms. Does not matter which frequency I choose. Would that be the Raspberry or the Hifiberry? I have a RTI kernel and the cpu clock is 1.8gHz.
4 comments
-
HiFiBerry team My best guess would be your player application. However, it doesn't matter if it can't play shorter files.You can easily pad your data with zeros in an WAV editor.
Usual buffer sizes range start at 128 samples, but can be much higher. Therefore you probably won't be able to play someting that's smaller.
BTW: The RTI kernel often creates more problems than it solves if you don't exactly understand the internals. -
Rolf Haugen Thank you for tips, that worked fine :-) I used Audacity to generate "silence" in the beginning of the file. Now I am able to play 1ms pulses, and that´s great. I use a piece of Python code as player. May be I could experiment with the buffer size.
I am aware of the complexity of RTI. I am struggling with timing issues as well. I send out a pulse which I record at the same time. Of course there is a delay in the recording,
but the problem is that the delay varies from time to time. A fixed delay is fine to deal with, but not when it varies. I gave myself RTI priorities, experimentet with taskset, also gave the Python application priority. I would be very grateful if you had a tip. -
HiFiBerry team Do you do the playback and recording in the same program? I'm not sure if there is some python code that can do full-duplex operation, but that would be my recommendation. Run playback and recording in the same program synchronized full-duplex.
On the DAC+ ADC , DAC and ADC part already run fully duplex. However, input and output on the Pi (DMA from the ring buffers in the SOC) and on the ALSA layer can create problems if buffer sizes are different. -
Rolf Haugen I do playback and recording in the same program. I suspected the Python not to handle this, and your info is very interesting. May be I should consider writing a program in c or c++ and write to the Alsa directly. I am aware that the Hifiberry run full duplex, and that is why I love it :-)