Jump to content

Efekt kolejowego radia (kod)


Recommended Posts

Hejka, ostatnio miałem sytuację, gdzie rozmawiałem przez centralkę i nagle dyżurny z sąsiedniej stacji (ten drugi, nie ten z którym rozmawiałem) odezwał się na radiu, co kompletnie zagłuszyło mi centralkę. Oczywiście ja go słyszałem, ale ten dyżurny, z którym rozmawiałem nie słyszał, bo było to już za daleko.

Proponuję więc, aby dodać efekt takiego kolejowego radia, + wykrycie czy ktoś gada na centralce i wtedy ściszenie radia. Oto kod w Matlabie (strona nie zezwala plików .m XD), który napisałem aby taki efekt dodać -  wystarczy go przerobić na język w którym to piszecie

(Dołączam również prezentację jak to działa)

GŁÓWNY PROGRAM:

 

%Read signal
[signal, fs] = audioread('signal.mp3');
 
%Store original signal
originalSignal = signal;
 
%To resample, choose sampling rate and calculate some stuff
newFs = 10000;
signal = resample(signal, newFs, fs);
Ts = 1/newFs;
n = length(signal);
 
%Add some noise and high-freq sines
t = (0:n-1)*Ts;
highSine = sin(2*pi*4700*t') + sin(2*pi*4240*t');
noise = randn(n, 1);
 
%Mix it up...
mixedSignal = signal + noise*0.005 + highSine*0.005;
 
%High-pass the signal, gain it and add it to make it more crispy
myHighFilter = highPassFilter();
highSignal = filter(myHighFilter, mixedSignal)*5;
outputSignal = mixedSignal + highSignal;
 
lowCutFilter = lowcut();
outputSignal = filter(lowCutFilter, outputSignal);
 
sound(outputSignal, newFs);
 
 
FUNKCJA highPassFilter.m:
 
function filtrHigh = highPassFilter
 
Fs = 10000;
N = 40;
Fc1 = 1500;
Fc2 = 3500;
flag = 'scale';
 
window = blackman(N+1);
 
b = fir1(N, [Fc1 Fc2]/(Fs/2), 'bandpass', window, flag);
filtrHigh = dfilt.dffir(b);
 
 
FUNKCJA lowcut.m:
 
function filtrLow= lowcut
 
Fs = 10000;
N = 50;
Fc = 600;
flag = 'scale';
win = nuttallwin(N+1);
b = fir1(N, Fc/(Fs/2), 'high', win, flag);
filtrLow = dfilt.dffir(b);
 

 

Edited by dominpiano
  • I agree 4
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Our servers

    • Drivers | Maszyniści Drivers | Maszyniści
      • PL1
      • pl1
      • 0 / 54
          • Percentage filling 0%
          • Most players 61
      • PL2
      • pl2
      • 3 / 43
          • Percentage filling 7%
          • Most players 85
      • PL3
      • pl3
      • 3 / 68
          • Percentage filling 4%
          • Most players 57
      • PL4
      • pl4
      • 0 / 42
          • Percentage filling 0%
          • Most players 77
      • PL8
      • pl8
      • 0 / 69
          • Percentage filling 0%
          • Most players 45
      • EN1
      • en1
      • 4 / 57
          • Percentage filling 7%
          • Most players 60
      • EN2
      • en2
      • 0 / 0
          • Percentage filling 0%
          • Most players 60
      • EN3
      • en3
      • 0 / 65
          • Percentage filling 0%
          • Most players 60
      • DE1
      • de1
      • 1 / 41
          • Percentage filling 2%
          • Most players 81
      • DE3
      • de3
      • 0 / 42
          • Percentage filling 0%
          • Most players 66
      • DE4
      • de4
      • 0 / 69
          • Percentage filling 0%
          • Most players 60
      • FR1
      • fr1
      • 0 / 38
          • Percentage filling 0%
          • Most players 49
      • UA1
      • ua1
      • 0 / 40
          • Percentage filling 0%
          • Most players 19
      • CN1
      • cn1
      • 0 / 70
          • Percentage filling 0%
          • Most players 28
      • CZ1
      • cz1
      • 2 / 41
          • Percentage filling 5%
          • Most players 50
      • ES1
      • es1
      • 0 / 0
          • Percentage filling 0%
          • Most players 18
      • IT1
      • it1
      • 0 / 55
          • Percentage filling 0%
          • Most players 61
    • Dispatchers | Dyżurni ruchu Dispatchers | Dyżurni ruchu
      • PL1
      • pl1
      • 0 / 24
          • Percentage filling 0%
          • Most players 21
      • PL2
      • pl2
      • 1 / 24
          • Percentage filling 4%
          • Most players 25
      • PL3
      • pl3
      • 0 / 24
          • Percentage filling 0%
          • Most players 21
      • PL4
      • pl4
      • 0 / 24
          • Percentage filling 0%
          • Most players 24
      • PL8
      • pl8
      • 0 / 24
          • Percentage filling 0%
          • Most players 17
      • EN1
      • en1
      • 2 / 24
          • Percentage filling 8%
          • Most players 24
      • EN2
      • en2
      • 0 / 24
          • Percentage filling 0%
          • Most players 21
      • EN3
      • en3
      • 0 / 24
          • Percentage filling 0%
          • Most players 12
      • DE1
      • de1
      • 2 / 24
          • Percentage filling 8%
          • Most players 24
      • DE3
      • de3
      • 0 / 24
          • Percentage filling 0%
          • Most players 24
      • DE4
      • de4
      • 0 / 24
          • Percentage filling 0%
          • Most players 20
      • UA1
      • ua1
      • 0 / 24
          • Percentage filling 0%
          • Most players 13
      • FR1
      • fr1
      • 0 / 24
          • Percentage filling 0%
          • Most players 19
      • ES1
      • es1
      • 0 / 24
          • Percentage filling 0%
          • Most players 14
      • CZ1
      • cz1
      • 1 / 24
          • Percentage filling 4%
          • Most players 22
      • CN1
      • cn1
      • 0 / 24
          • Percentage filling 0%
          • Most players 14
      • IT1
      • it1
      • 0 / 24
          • Percentage filling 0%
          • Most players 14
    • 34 Total servers
    • 19 / 1202 Total players
    • 2% Filled servers
×
×
  • Create New...

Important Information

Terms of Use Privacy Policy