I am learning the Nyquist Language with the hope to use it first in synthesizing audio waves to transfer data (in/out, series of bits) via the soundcard of a PC/Lap.
The basic algorithm is rather simple.
There are 4 fixed patterns. The period of each equals to the half cycle time of a chosen audio carrier. They are used to form the data audio wave:
{A} The cosine rising edge (from negative to positive peak, following the cosine function)
{B} The cosine falling edge (from positive to negative peak, following the cosine function)
{C} The positive constant peak
{D} The negative constant peak
After a new bit is read, the rules that select the pattern ({A}, {B}, {C} or {D}) to be outputted while generating the data audio signal are:
1- If newBit = previousBit & the last pattern was {A}, output the pattern {B} then {A}.
2- If newBit = previousBit & the last pattern was {B}, output the pattern {A} then [B}.
3- If newBit != previousBit & the last pattern was {A}, output the pattern {C} then {B}.
4- If newBit != previousBit & the last pattern was {B}, output the pattern {D} then {A}.
In my application (concerning moving message signs), the maximum length of the character file is 2048 bytes (16384 bits).
So if there are 32 samples per cycle and the generated wave is of 8-bit type (1 byte/sample), the file of the data audio wave would be 524288 bytes, about 0.5 MB.
I have the impression that by using a Nyquist program/script, there will be no need to create and save the wave file. The data audio signal could be outputted directly via the line-out of the soundcard.
So I wonder if there is an available Nyquist program which could be used as a template in synthesizing simple waves.
Thank you.
Kerim
Edited:
The above two rules, 1 and 2, were incomplete. I fixed them.