# Bose Chaudhuri Hocquenghem (BCH) vs Reed Solomon (RS) Error correcting codes and sound transmission channel modeling

I've implemented an acoustic based information transmission system using a bandwidth of 2 kHz and the band between 18.5 and 20.5 kHz. I'm trying to find the best error correcting code for it, in the sense that I could get the same error correction capability with the lowest redundancy added (I want to get the best speed possible). I have been able to transmit data between 2 smartphones at low rate (400 bps) and short distances (5-10 cm). At the moment I've design a package that I send between peers and I'm using 4 BCH(63,39,4) blocks there. I have also added some parity check bits (just for error detection) in case BCH fixed the incoming package in the wrong way (could happen if more that 4 errors occur in any of my 4 BCH blocks). I interleave the BCH coded bits before I modulate them trying to equally distribute the error burst among the 4 BCH blocks. Right now I'm capable of implementing both RS and BCH coding schemes, but I was wondering if there was some criteria I could follow in advance for choosing which one might perform better, would it be worth the time implementing RS. I read this document which says that for a Rayleigh Fading Channel being simulated in Matlab, BCH outperformed binary RS for a specific N,K,T selection. But they mention that this has a strong channel model dependency. My questions are:

1. What channel model fits data transmission over air best, I guess distortion generated by speakers should also be take under account, specially at the frequencies at which I'm working?
2. Is there a general study comparing BCH vs RS in different channels?
3. Is RS theoretically better than BCH for the same code rate n/k. Non binary RS may be considered, I'm just interested in same error correcting capability with greatest bit-rate ?

Independent answers to any of these questions are most welcome

Note: At this low bitrate CPU is not a bottleneck. Anyway the most time consuming task of my system is FFT based matched filter demodulation (specially if I use high order modulations), not BCH error decoding with such small code length.

What channel model fits data transmission over air best, I guess distortion generated by speakers should also be take under account?

Disclaimer: I'm really not an Audio person. There's a lot of audio DSP engineers on here that probably have a far better idea of what's happening on an acoustic channel. But:

1. Frequency selectiveness will be pretty important. It's unlikely your phone speakers can go below 40 Hz, or far above 12 kHz.
2. Audio typically might experience a bad case of multipath
3. prepare yourself for what would be a relatively solid amount of Doppler if your communication partners, or significant reflectors, or the medium, are moving

Is there a general study comparing BCH vs RS in different channels?

probably, hundreds. But: it's really a thing that needs to be compared under specific channel models, and since there are freely available implementations of both, as soon as you have a realistic channel model for your specific use case down, simulation should give you more application-specific results than any study might ever give you.

I'd really go for channel sounding, in your case; send a known signal of suitable bandwidth, record the raw reception, try to extract a transfer function from that (assume LTI, and verify that assumption). Change the environment/channel, and do it again. Do that ten times (and write a paper), and come up with a stochastic channel model (e.g. "we have this general amplitude response for the ideal single channel, we have x~(PDF) multipath components, and their delays and weights follow the XYZ distribution", and write a paper).

Then write a channel simulator (at this point, I might, again, recommend GNU Radio, for which several channel sounders and channel simulators exist, but mainly for RF channels – but that's not inherent to its design, just to most of its userbase; obviously, write a paper), and test a few codes on that (and write a paper :))!

• I have updated my question with extra technical info in case you need it, for this short distance multipath is not so bad.
– VMMF
Nov 17 '16 at 3:18

A few ideas to complement Marcus' answer:

It is relatively easy to find an approximation to the channel's impulse response: send audio consisting of a single positive sample surrounded by zeros, and record the result. If the channel response is not flat, you can either transmit slowly over a narrow frequency band (so that the channel looks flat), or implement an equalizer in the receiver.

The main strength of RS codes is in correcting error bursts. Most codes assume the errors are independent. When that cannot be guaranteed (for instance because of a deep fade that lasts over several symbols), RS can be useful.

I suspect (but don't know for sure) that the mobile's CPU and battery will be your bottleneck, more than a code's correcting power. Large BCH and RS codes are computationally expensive to decode.

• Actually measuring impulse response with an impulse works,but of course is a bit hard considering the little energy that this signal contains. Re computational load: considering Shannon doesn't allow overly many bit/s at all over an audio channel,probably, the bitrate going through the coder probably will be relatively modest. Yes, BCH codes are pretty hard on CPUs (and the RS subclass generally isn't easy, either),but don't underestimate the power of optimized code and modern smart phones;for example, it's possible to decode megabits per s for DVB-T on x86 CPU;might scale down to kb/s on ARM. Nov 16 '16 at 9:57
• @MarcusMüller I agree. Regarding computational complexity, I was thinking more along the lines of "decoding BCH will decrease your battery life by a non-negligible amount" more than "the CPU will not be able to decode it in real-time". However, I have tried to do real-time processing with GnuRadio on an ARM core; in my experience, I wouldn't be completely unconcerned about the CPU load on a mobile.
– MBaz
Nov 16 '16 at 14:49
• @MBaz I have updated my question with extra technical info in case you need it. Right now either CPU nor battery is a bottleneck for my app. A single sample is not detected by the receiver. Besides you have to consider that the speaker is a mechanical system, it needs some samples before it can reach it's maximum output value
– VMMF
Nov 17 '16 at 3:10
• @VMMF "consider that the speaker is a mechanical system, it needs some...": EEEExactly what an impulse response represents. Nov 17 '16 at 18:01

"The best channel code" is really vague.

We can compare channel codes under power, bandwidth, encoder or decoder computational complexity criteria. We can compare minimum hamming distance, correction capability, coding gain, spectral efficiency, error probability, ...

Optimality can be analyzed in different contexts as well. RS codes achieve the Singleton bound and hence belong to the maximum distance separable (MDS) codes. That sais, both RS and BCH codes belong to the category of cyclic codes and RS codes are a subset of BCH codes where the decoder alphabet is the same as the channel alphabet.

As Marcus pointed out, there are hundreds of papers and dozens of books in this area. For very strict requirements of high efficiency, just relying on FEC (e.g. BCH or RS codes alone) is not enough, and more advanced techniques such as hybrid ARQ (H-ARQ) is used. For instance, IEEE 802.15.6 standard (which is a low-power application example) uses BCH(126, 63) with a type-II incremental redundancy H-ARQ.

I can add more design hints if there are more specific design requirements.

• thanks for actually making the point I should've been making: optimality is undefined per se, and anything you do must make sense as a system. Nov 16 '16 at 9:52
• @msm I have updated my question with extra technical info in case you need it. You were right about best channel code being vague, hopefully now you can see what I want. I didn't know the name hybrid ARQ (H-ARQ) but apparently I'm using a Type I HARQ. I do realize the benefits of a type II HARQ, specially the one with soft combining but I'm not there yet
– VMMF
Nov 17 '16 at 3:55
• Right at the beginning, an important factor (maybe even more important than the FEC code itself) is the number of blocks ($4$ in here). You can optimize it. See this related answer.
– msm
Nov 17 '16 at 23:40