Although NICAM is now defunct technology, it is still an interesting and compact method of audio bit rate reduction, that may provide an introduction to more advanced bit rate reduction strategies such as those found in MPEG.
y = NICAM(x,fs)
[y,x14] = NICAM(...)
y = NICAM(x,fs) applies the NICAM audio bit-rate reduction algorithm to the input column vector or matrix x sampled at fs Hz. If x is a matrix, then the NICAM algorithm is applied down the columns of x. The input x should be in the range [-1,1]. The NICAM algorithm has the following steps:
1. Convert samples to 14-bit accuracy.
2. Divide the signal into 1 ms frames.
3. Define the "coding range" for each frame from the largest (absolute) sample in the frame.
4. Remove a number of LSBs for each sample in a frame according to the coding range for the frame. The number of LSBs is:
- 4 if coding range 1 (max abs amplitude is 1XXXXXXXXXXXXX);
- 3 if coding range 2 (max abs amplitude is 01XXXXXXXXXXXX);
- 2 if coding range 3 (max abs amplitude is 001XXXXXXXXXXX);
- 1 if coding range 4 (max abs amplitude is 0001XXXXXXXXXX);
- 0 if coding range 5 (max abs amplitude is 00001XXXXXXXXX).
(Note that this notation uses binary integer rather than twos complement)
5. Removed bits are replaces with intermediate values and samples are converted back to 14-bit.
[y,x14] = NICAM(...) returns the 14-bit version of the input. The algorithm re-dithers the audio, using TPDF dither, before it is companded to 14-bit resolution.
Create scripts with code, output, and formatted text in a single executable document.