Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: [REQ] Which codec for (S32_LE) multichannel lossless RECORDING ? (Read 15515 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[REQ] Which codec for (S32_LE) multichannel lossless RECORDING ?

Hi everyone,
I'm going to record up to 32 channels using a RB Pi 3B+ using this simple (customized) Bash script: hALSAmrec git.

I would like to know your opinions on the possibility of using a compressed format, which must however support S32_LE as input and able to real time encode on a BCM2837 SoC.
Hybrid Multimedia Production Suite will be a platform-indipendent open source suite for advanced audio/video contents production.
Official git: https://forart.it/HyMPS/

Re: [REQ] Which codec for (S32_LE) multichannel lossless RECORDING ?

Reply #1
this would depend on the "real-life problem" this system is being used to solve...
if the data volume and storage capacity/speed can tolerate raw uncompressed data, that's probably the safest bet.
a fan of AutoEq + Meier Crossfeed

Re: [REQ] Which codec for (S32_LE) multichannel lossless RECORDING ?

Reply #2
The only codec that I know of that would work is WavPack. Newer FLAC also supports 32-bit signed integers, but not 32 channels. As was said, you'll want to first investigate whether the compression achieved warrants the effort and overhead.

I have been developing a multi-node synchronous audio WiFi playback system using the Pi 3 Model B+ and so I’m pretty familiar with them. I just did a quick benchmark and I compressed 32-channels of 32-bit integers using about 50% of one core (you don’t mention sampling rate, but I assumed 44,100 Hz). I used the latest version (5.7.0) because it supports multi-threading which would be handy on multi-core Pis, but since we’re well under a core it should not be strictly required (the version provided in the Raspberry Pi OS repo is probably not that new).

I have also used WavPack to compress audio piped directly from arecord, so that that shouldn’t be a problem either.

Let me know if you have more questions or run into trouble.

Re: [REQ] Which codec for (S32_LE) multichannel lossless RECORDING ?

Reply #3
Did you ever find a solution for this?

 

Re: [REQ] Which codec for (S32_LE) multichannel lossless RECORDING ?

Reply #5
Did you ever find a solution for this?
Hi there, I'm still experimenting with:
https://github.com/MarcoRavich/hALSAmrec/

Yeah, I know you're looking at that. You linked to it in your first post also, and I checked it out.

But your question was about the possibility of compression, and that's what I answered then, and was wondering about now.

Re: [REQ] Which codec for (S32_LE) multichannel lossless RECORDING ?

Reply #6
Yeah, I know you're looking at that. You linked to it in your first post also, and I checked it out.

But your question was about the possibility of compression, and that's what I answered then, and was wondering about now.

Hi there,
sorry for double posting...

Well, I'll try to test WavPack but need to deeply understand how to use it in openwrt (the lightest distro for headless ALSA recording using the RbPi3)...

...anyway last saturday I've tested 2 hours x 18 channels x 48Khz x S32_LE live recording: worked flawlessly ! (PM me if you wanna obtain the download link)
Hybrid Multimedia Production Suite will be a platform-indipendent open source suite for advanced audio/video contents production.
Official git: https://forart.it/HyMPS/

Re: [REQ] Which codec for (S32_LE) multichannel lossless RECORDING ?

Reply #7
According to copilot is possible to install WavPack in OpenWRT using these commands:
Code: [Select]
opkg update
opkg install wavpack

...and, then, is also possible to pipe arecord into WP for realtime compression in this way:
Code: [Select]
arecord --device=hw:0,0 --channels=18 --file-type=raw \
        --format=S32_LE --rate=48000 --buffer-time=20000000 \
| wavpack -i -o "${MNT}/${name}.wv" - 2> >(ts -s >&2) &
recorder=$!

@bryant: is the wp syntax il correct under *nix ?

Last but not least, I've also discovered that TinyALSA is also usable in OpenWRT...
Hybrid Multimedia Production Suite will be a platform-indipendent open source suite for advanced audio/video contents production.
Official git: https://forart.it/HyMPS/

Re: [REQ] Which codec for (S32_LE) multichannel lossless RECORDING ?

Reply #8
Okay, that command definitely has some issues. The biggest is it doesn’t specify “raw-pcm” for the format even though the arecord command is definitely outputting raw audio. So it’s going to fail because it won’t get a valid WAV header.

Here is the command I use for my 8-channel recorder (M-Audio FastTrack Ultra 8R):

Code: [Select]
arecord -Dhw:F8R -t raw -r48000 -c8 -fS24_3LE | wavpack - --raw-pcm=48000,24,8 --channel-order=... -hvmo File.wv

This does 24 bit, 8 channel (note that I use the short version of the arecord options). If that format doesn’t work in your setup then you can replace it with “S32_LE” and the 24 in the raw-pcm spec with 32. This will take a little more CPU to encode and I know your data is just 24 bits, but the driver might not do S24_3LE.

I have never needed to specify the buffer size in the arecord command, but maybe someone did. I don’t understand what they’re doing with redirection of stdin and stderr, but I just leave the terminal open during recording. You can add -q in the WavPack line to force error display only. That command uses a mounted output device (probably USB?) because there's no storage (I assume). You'll have to use that.

To terminate the session there are two ways. If you know the time beforehand you can use the -d option in arecord to specify the number of seconds. What I generally do is use “top” to find the PID of the arecord process and then kill it when the recording is done. That terminates the pipe to WavPack which can then properly terminate the file. If you just ^C the terminal then it doesn’t seem to work right (I think maybe WavPack deletes the output file).

One thing you can do is test the arecord and WavPack lines separately using files. In other words add "> temp-file" to the arecord to capture the raw data. Then add "< temp-file" to the WavPack line to test that part (or even better, use cat to pipe the file into WavPack: "cat test-file | wavpack -". This sometimes makes it easier to see where things are messing up.

Let me know if you run into trouble.