I've not seen your code until lately.
Although my version an yours do essentially the same, they are very different nonetheless.
You have one input (+ some hidden ones), I have seven (hopefully reducible).
- you: input binary as digits 0/1
- me: input as plain text (ASCII/ANSI) with escape sequences for:
-De Bruijn Sequence (32 byte in succession that hold all possible 256 values, if shifted one position at the time and
changing one bit only, e.g. 0011= 00 01 11 10 [wrapped around])
- Grey codes, same as before but one byte at the time, thus the second bit stream from above 00011110.
- alternating 0101...
- binary input
- individual length for marks and spaces in samples (yours are defined as *sound-srate*/ baud). This ensures a pure square wave with only two values but the resulting baud rate might not be accurate if the sample rate doesn't fit-->resampling.
It is difficult to handle this properly since we are actually doing an analogue thing digitally. All the sample rate is good for is how much we are oversampling, e.g. at 1200 baud at 48 kHz, the factor is 40. .
I've chosen a Gaussian FIR filter instead of an IIR.
It's purpose is to reshape the pulses before the actual modulation and it should thus be symmetric with the lowest possible group delay (=Gaussian).
In contrast, your filter is at the output stage. I'm not sure if a low pass filter is appropriate here:
- The pulse train is at base band--> low pass with (half-) bandwidth frequency deviation (min 500 Hz for 1200 Baud).
- After modulation the signal is shifted and we need a bandpass with (full) bandwidth 1200 Hz min at 1700 Hz, since the modulated signal is double-sided.
It is important to me that the plug-in returns the sound at any desired stage.
- text as binary
- pulse train
- pulse train filtered
- modulated signal
- modulated signal with pre-filtering applied.
Currently, my output creation is floored since I use 'seqrep'.
It seems to me that Nyquist has some memory leak there. I had a stack-overflow error once. The only way to get rid of it was to restart Audacity since applying any kind of code produced the same error.
I will probably try your PWL approach.