Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # slider1 = Frequency
- # slider2 = Fine tunning
- # slider3 = Tone
- # slider4 = Volume
- # set the samplerate to 48000 samples per second
- samplerate = 48000
- # 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/10);
- ai = ini * cos1(z) - inq*sin1(z)
- aq = inq * cos1(z) + ini*sin1(z)
- # filter IF:
- # samplerate: 48000 band-pass order: 130 cutoffs: 20 - 2000 Hz
- # http://mshook.appspot.com/z/firkernel.htm
- # I branch filter
- ai = fir(ai,-0.001512,-0.0014883,-0.0014579,-0.0014203,-0.0013755,-0.0013241,-0.0012686,-0.0012137,-0.0011669,-0.0011384,-0.0011414,-0.001191,-0.0013031,-0.0014933,-0.0017746,-0.0021559,-0.0026395,-0.0032202,-0.0038833,-0.0046052,-0.0053529,-0.0060859,-0.0067587,-0.0073236,-0.0077349,-0.0079535,-0.0079509,-0.0077139,-0.0072473,-0.006577,-0.0057501,-0.0048345,-0.0039157,-0.0030925,-0.0024705,-0.0021544,-0.0022396,-0.0028032,-0.0038952,-0.0055318,-0.0076888,-0.0102987,-0.0132499,-0.016389,-0.0195268,-0.0224466,-0.0249159,-0.0266994,-0.027574,-0.0273439,-0.0258547,-0.0230068,-0.0187652,-0.0131666,-0.0063221,0.0015843,0.0103015,0.0195224,0.0288972,0.038051,0.0466032,0.0541871,0.0604705,0.0651732,0.0680831,0.0690681,0.0680831,0.0651732,0.0604705,0.0541871,0.0466032,0.038051,0.0288972,0.0195224,0.0103015,0.0015843,-0.0063221,-0.0131666,-0.0187652,-0.0230068,-0.0258547,-0.0273439,-0.027574,-0.0266994,-0.0249159,-0.0224466,-0.0195268,-0.016389,-0.0132499,-0.0102987,-0.0076888,-0.0055318,-0.0038952,-0.0028032,-0.0022396,-0.0021544,-0.0024705,-0.0030925,-0.0039157,-0.0048345,-0.0057501,-0.006577,-0.0072473,-0.0077139,-0.0079509,-0.0079535,-0.0077349,-0.0073236,-0.0067587,-0.0060859,-0.0053529,-0.0046052,-0.0038833,-0.0032202,-0.0026395,-0.0021559,-0.0017746,-0.0014933,-0.0013031,-0.001191,-0.0011414,-0.0011384,-0.0011669,-0.0012137,-0.0012686,-0.0013241,-0.0013755,-0.0014203,-0.0014579,-0.0014883,-0.001512)
- # Q branch filter
- aq = fir(aq,-0.001512,-0.0014883,-0.0014579,-0.0014203,-0.0013755,-0.0013241,-0.0012686,-0.0012137,-0.0011669,-0.0011384,-0.0011414,-0.001191,-0.0013031,-0.0014933,-0.0017746,-0.0021559,-0.0026395,-0.0032202,-0.0038833,-0.0046052,-0.0053529,-0.0060859,-0.0067587,-0.0073236,-0.0077349,-0.0079535,-0.0079509,-0.0077139,-0.0072473,-0.006577,-0.0057501,-0.0048345,-0.0039157,-0.0030925,-0.0024705,-0.0021544,-0.0022396,-0.0028032,-0.0038952,-0.0055318,-0.0076888,-0.0102987,-0.0132499,-0.016389,-0.0195268,-0.0224466,-0.0249159,-0.0266994,-0.027574,-0.0273439,-0.0258547,-0.0230068,-0.0187652,-0.0131666,-0.0063221,0.0015843,0.0103015,0.0195224,0.0288972,0.038051,0.0466032,0.0541871,0.0604705,0.0651732,0.0680831,0.0690681,0.0680831,0.0651732,0.0604705,0.0541871,0.0466032,0.038051,0.0288972,0.0195224,0.0103015,0.0015843,-0.0063221,-0.0131666,-0.0187652,-0.0230068,-0.0258547,-0.0273439,-0.027574,-0.0266994,-0.0249159,-0.0224466,-0.0195268,-0.016389,-0.0132499,-0.0102987,-0.0076888,-0.0055318,-0.0038952,-0.0028032,-0.0022396,-0.0021544,-0.0024705,-0.0030925,-0.0039157,-0.0048345,-0.0057501,-0.006577,-0.0072473,-0.0077139,-0.0079509,-0.0079535,-0.0077349,-0.0073236,-0.0067587,-0.0060859,-0.0053529,-0.0046052,-0.0038833,-0.0032202,-0.0026395,-0.0021559,-0.0017746,-0.0014933,-0.0013031,-0.001191,-0.0011414,-0.0011384,-0.0011669,-0.0012137,-0.0012686,-0.0013241,-0.0013755,-0.0014203,-0.0014579,-0.0014883,-0.001512)
- # down-convert to audio using a second mixer
- y = mod1(y+0.0275)
- af = ai*cos1(y) - aq*sin1(y)
- audio = audio - slider3*(audio - af)
- # send audio to output of soundcard
- # slider3 controls the volume
- uitL = audio * slider4 * 100
- uitR = audio * slider4 * 100
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement