Jump to content

Efekt kolejowego radia (kod)


dominpiano

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
      • PL2
      • pl2
      • 4 / 89
          • Percentage filling 4%
          • Most players 90
      • PL3
      • pl3
      • 2 / 85
          • Percentage filling 2%
          • Most players 76
      • PL4
      • pl4
      • 2 / 81
          • Percentage filling 2%
          • Most players 84
      • PL8
      • pl8
      • 0 / 57
          • Percentage filling 0%
          • Most players 84
      • EN1
      • en1
      • 6 / 74
          • Percentage filling 8%
          • Most players 81
      • EN2
      • en2
      • 2 / 80
          • Percentage filling 3%
          • Most players 60
      • EN3
      • en3
      • 0 / 0
          • Percentage filling 0%
          • Most players 60
      • DE1
      • de1
      • 6 / 76
          • Percentage filling 8%
          • Most players 87
      • DE3
      • de3
      • 1 / 78
          • Percentage filling 1%
          • Most players 67
      • DE4
      • de4
      • 0 / 89
          • Percentage filling 0%
          • Most players 65
      • FR1
      • fr1
      • 1 / 115
          • Percentage filling 1%
          • Most players 49
      • UA1
      • ua1
      • 0 / 81
          • Percentage filling 0%
          • Most players 27
      • CN1
      • cn1
      • 0 / 0
          • Percentage filling 0%
          • Most players 28
      • CZ1
      • cz1
      • 6 / 78
          • Percentage filling 8%
          • Most players 61
      • ES1
      • es1
      • 1 / 80
          • Percentage filling 1%
          • Most players 23
    • Dispatchers | Dyżurni ruchu Dispatchers | Dyżurni ruchu
      • PL2
      • pl2
      • 7 / 34
          • Percentage filling 21%
          • Most players 34
      • PL3
      • pl3
      • 1 / 34
          • Percentage filling 3%
          • Most players 28
      • PL4
      • pl4
      • 2 / 34
          • Percentage filling 6%
          • Most players 31
      • PL8
      • pl8
      • 1 / 34
          • Percentage filling 3%
          • Most players 27
      • EN1
      • en1
      • 3 / 34
          • Percentage filling 9%
          • Most players 33
      • EN2
      • en2
      • 5 / 34
          • Percentage filling 15%
          • Most players 21
      • EN3
      • en3
      • 0 / 0
          • Percentage filling 0%
          • Most players 13
      • DE1
      • de1
      • 7 / 34
          • Percentage filling 21%
          • Most players 34
      • DE3
      • de3
      • 0 / 34
          • Percentage filling 0%
          • Most players 29
      • DE4
      • de4
      • 1 / 34
          • Percentage filling 3%
          • Most players 24
      • UA1
      • ua1
      • 1 / 34
          • Percentage filling 3%
          • Most players 17
      • FR1
      • fr1
      • 3 / 34
          • Percentage filling 9%
          • Most players 23
      • ES1
      • es1
      • 1 / 34
          • Percentage filling 3%
          • Most players 15
      • CZ1
      • cz1
      • 2 / 34
          • Percentage filling 6%
          • Most players 28
      • CN1
      • cn1
      • 0 / 0
          • Percentage filling 0%
          • Most players 19
    • 30 Total servers
    • 65 / 1505 Total players
    • 4% Filled servers
×
×
  • Create New...

Important Information

Terms of Use Privacy Policy