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
      • 62 / 76
          • Percentage filling 82%
          • Most players 90
      • PL3
      • pl3
      • 3 / 66
          • Percentage filling 5%
          • Most players 76
      • PL4
      • pl4
      • 7 / 73
          • Percentage filling 10%
          • Most players 84
      • PL8
      • pl8
      • 5 / 74
          • Percentage filling 7%
          • Most players 84
      • EN1
      • en1
      • 6 / 75
          • Percentage filling 8%
          • Most players 80
      • EN2
      • en2
      • 0 / 30
          • Percentage filling 0%
          • Most players 60
      • EN3
      • en3
      • 0 / 79
          • Percentage filling 0%
          • Most players 60
      • DE1
      • de1
      • 25 / 75
          • Percentage filling 33%
          • Most players 87
      • DE3
      • de3
      • 2 / 73
          • Percentage filling 3%
          • Most players 66
      • DE4
      • de4
      • 1 / 67
          • Percentage filling 1%
          • Most players 65
      • FR1
      • fr1
      • 10 / 78
          • Percentage filling 13%
          • Most players 49
      • UA1
      • ua1
      • 0 / 73
          • Percentage filling 0%
          • Most players 27
      • CN1
      • cn1
      • 0 / 68
          • Percentage filling 0%
          • Most players 28
      • CZ1
      • cz1
      • 4 / 77
          • Percentage filling 5%
          • Most players 61
      • ES1
      • es1
      • 1 / 78
          • Percentage filling 1%
          • Most players 23
    • Dispatchers | Dyżurni ruchu Dispatchers | Dyżurni ruchu
      • PL2
      • pl2
      • 22 / 27
          • Percentage filling 81%
          • Most players 27
      • PL3
      • pl3
      • 4 / 27
          • Percentage filling 15%
          • Most players 27
      • PL4
      • pl4
      • 5 / 27
          • Percentage filling 19%
          • Most players 27
      • PL8
      • pl8
      • 2 / 27
          • Percentage filling 7%
          • Most players 27
      • EN1
      • en1
      • 6 / 27
          • Percentage filling 22%
          • Most players 27
      • EN2
      • en2
      • 0 / 27
          • Percentage filling 0%
          • Most players 21
      • EN3
      • en3
      • 1 / 27
          • Percentage filling 4%
          • Most players 13
      • DE1
      • de1
      • 19 / 27
          • Percentage filling 70%
          • Most players 27
      • DE3
      • de3
      • 4 / 27
          • Percentage filling 15%
          • Most players 27
      • DE4
      • de4
      • 0 / 27
          • Percentage filling 0%
          • Most players 24
      • UA1
      • ua1
      • 0 / 27
          • Percentage filling 0%
          • Most players 17
      • FR1
      • fr1
      • 2 / 27
          • Percentage filling 7%
          • Most players 23
      • ES1
      • es1
      • 1 / 27
          • Percentage filling 4%
          • Most players 15
      • CZ1
      • cz1
      • 8 / 27
          • Percentage filling 30%
          • Most players 27
      • CN1
      • cn1
      • 0 / 27
          • Percentage filling 0%
          • Most players 19
    • 30 Total servers
    • 200 / 1467 Total players
    • 14% Filled servers
×
×
  • Create New...

Important Information

Terms of Use Privacy Policy