[Csnd] A new opcode almost completed

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Csnd] A new opcode almost completed

Gleb
This post was updated on .
Hello, guys!

I have just finished a new opcode with working title ftsaveb. The last b stands for bit. The opcode formats ftable data and writes it to file.

Syntax:
ftsaveb ihandle, ifn,kBitNum,kSize

ihandle is a file handle returned from fiopen
ifn - an ftable which contains a frame of data
kBitNum - an array which contains number of bits per each field
kSize - an array which contains number of elements per each field

In case of
kBitNum[] fillarray 3,5,2
kSize[] fillarray 2,2,3

first two elements of ifn will be bitshifted to 3 most significant bits, next two elements - to 5 most significant bits, and last 3 elements - to 2 most significant bits. After it, the coded frame will be padded and recorded to file in a format
AAAA AABB BBBB BBBB CCCC CC00,
where AAAAAA - six bits of the first bit field, B...B - 10 bits of the second bit field, C..C - 6 bits of the third bit field, 00 - padding to byte alignment.

The realised procedure of formatting is A MUST for any coding algorithm. So I believe this is a first step to use Csound for some coding related processing, i.e. digital audio watermarking, perceptual coding and other funny things.

The next thing is a mirror opcode with working title ftloadb. It will load a coded frame and turn it into a series of decoded samples.


PLEASE, if somebody has suggestions of any kind - I'll be glad to read it. Maybe I can add some extra features.

Thank you!  
Gleb Rogozinsky, PhD
Associated Professor
Interactive Arts Department
Saint-Petersburg University of Film and Television

Deputy Director of Medialab
Saint-Petersburg University of Telecommunications