Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # slider1 = Frequency
- # slider2 = RIT
- # slider3 = Tone
- # slider4 = Volume
- # set the samplerate to 96000samples per second
- samplerate = 96000
- # down-convert to 1st IF:
- # z is a sawtooch oscillator
- # (ai,aq) form the mixer output
- # (ini, inq) are the soundcard's inputs
- z = mod1(z+slider1+slider2/40);
- ai = ini * cos1(z) - inq*sin1(z)
- aq = inq * cos1(z) + ini*sin1(z)
- # filter IF:
- # samplerate: 96000 low-pass order: 150 cutoff: 1800 Hz
- # http://mshook.appspot.com/z/firkernel.htm
- # I branch filter
- ai = fir(ai,0.0001883,0.0002242,0.0002608,0.0002985,0.0003375,0.0003776,0.0004186,0.0004598,0.0005003,0.0005389,0.0005742,0.0006042,0.000627,0.0006403,0.0006416,0.0006285,0.0005984,0.0005489,0.0004776,0.0003825,0.0002617,0.0001139,-0.0000616,-0.0002652,-0.0004963,-0.0007538,-0.0010356,-0.0013389,-0.0016599,-0.001994,-0.0023356,-0.0026784,-0.0030152,-0.0033381,-0.0036385,-0.0039073,-0.004135,-0.0043119,-0.004428,-0.0044735,-0.0044387,-0.0043146,-0.0040924,-0.0037644,-0.0033237,-0.0027646,-0.0020827,-0.001275,-0.00034,0.0007221,0.0019091,0.0032174,0.0046413,0.0061733,0.0078044,0.0095234,0.0113178,0.0131736,0.0150753,0.0170064,0.0189492,0.0208854,0.0227963,0.0246626,0.0264655,0.028186,0.029806,0.0313079,0.0326753,0.0338933,0.0349481,0.035828,0.036523,0.0370251,0.0373287,0.0374303,0.0373287,0.0370251,0.036523,0.035828,0.0349481,0.0338933,0.0326753,0.0313079,0.029806,0.028186,0.0264655,0.0246626,0.0227963,0.0208854,0.0189492,0.0170064,0.0150753,0.0131736,0.0113178,0.0095234,0.0078044,0.0061733,0.0046413,0.0032174,0.0019091,0.0007221,-0.00034,-0.001275,-0.0020827,-0.0027646,-0.0033237,-0.0037644,-0.0040924,-0.0043146,-0.0044387,-0.0044735,-0.004428,-0.0043119,-0.004135,-0.0039073,-0.0036385,-0.0033381,-0.0030152,-0.0026784,-0.0023356,-0.001994,-0.0016599,-0.0013389,-0.0010356,-0.0007538,-0.0004963,-0.0002652,-0.0000616,0.0001139,0.0002617,0.0003825,0.0004776,0.0005489,0.0005984,0.0006285,0.0006416,0.0006403,0.000627,0.0006042,0.0005742,0.0005389,0.0005003,0.0004598,0.0004186,0.0003776,0.0003375,0.0002985,0.0002608,0.0002242,0.0001883)
- # Q branch filter
- aq = fir(aq,0.0001883,0.0002242,0.0002608,0.0002985,0.0003375,0.0003776,0.0004186,0.0004598,0.0005003,0.0005389,0.0005742,0.0006042,0.000627,0.0006403,0.0006416,0.0006285,0.0005984,0.0005489,0.0004776,0.0003825,0.0002617,0.0001139,-0.0000616,-0.0002652,-0.0004963,-0.0007538,-0.0010356,-0.0013389,-0.0016599,-0.001994,-0.0023356,-0.0026784,-0.0030152,-0.0033381,-0.0036385,-0.0039073,-0.004135,-0.0043119,-0.004428,-0.0044735,-0.0044387,-0.0043146,-0.0040924,-0.0037644,-0.0033237,-0.0027646,-0.0020827,-0.001275,-0.00034,0.0007221,0.0019091,0.0032174,0.0046413,0.0061733,0.0078044,0.0095234,0.0113178,0.0131736,0.0150753,0.0170064,0.0189492,0.0208854,0.0227963,0.0246626,0.0264655,0.028186,0.029806,0.0313079,0.0326753,0.0338933,0.0349481,0.035828,0.036523,0.0370251,0.0373287,0.0374303,0.0373287,0.0370251,0.036523,0.035828,0.0349481,0.0338933,0.0326753,0.0313079,0.029806,0.028186,0.0264655,0.0246626,0.0227963,0.0208854,0.0189492,0.0170064,0.0150753,0.0131736,0.0113178,0.0095234,0.0078044,0.0061733,0.0046413,0.0032174,0.0019091,0.0007221,-0.00034,-0.001275,-0.0020827,-0.0027646,-0.0033237,-0.0037644,-0.0040924,-0.0043146,-0.0044387,-0.0044735,-0.004428,-0.0043119,-0.004135,-0.0039073,-0.0036385,-0.0033381,-0.0030152,-0.0026784,-0.0023356,-0.001994,-0.0016599,-0.0013389,-0.0010356,-0.0007538,-0.0004963,-0.0002652,-0.0000616,0.0001139,0.0002617,0.0003825,0.0004776,0.0005489,0.0005984,0.0006285,0.0006416,0.0006403,0.000627,0.0006042,0.0005742,0.0005389,0.0005003,0.0004598,0.0004186,0.0003776,0.0003375,0.0002985,0.0002608,0.0002242,0.0001883)
- # down-convert to audio using a second mixer
- y = mod1(y+0.0275)
- af = ai*sin1(y) - aq*cos1(y)
- audio = audio - slider3*(audio - af)
- # send audio to output of soundcard
- # slider4 controls the volume
- uitL = audio * slider4 * 500
- uitR = audio * slider4 * 500
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement