kopia lustrzana https://github.com/erdewit/HiFiScan
Add causality parameter to seamlessly move between linear- and minimum phase
rodzic
ae6d522b6e
commit
a17f14c6fc
|
@ -100,9 +100,9 @@ class App(qt.QMainWindow):
|
||||||
dbRange = self.dbRange.value()
|
dbRange = self.dbRange.value()
|
||||||
beta = self.kaiserBeta.value()
|
beta = self.kaiserBeta.value()
|
||||||
smoothing = self.irSmoothing.value()
|
smoothing = self.irSmoothing.value()
|
||||||
minPhase = self.typeBox.currentIndex() == 1
|
causality = self.causality.value() / 100
|
||||||
|
|
||||||
t, ir = analyzer.h_inv(secs, dbRange, beta, smoothing, minPhase)
|
t, ir = analyzer.h_inv(secs, dbRange, beta, smoothing, causality)
|
||||||
self.irPlot.setData(1000 * t, ir)
|
self.irPlot.setData(1000 * t, ir)
|
||||||
|
|
||||||
logIr = np.log10(1e-8 + np.abs(ir))
|
logIr = np.log10(1e-8 + np.abs(ir))
|
||||||
|
@ -140,11 +140,11 @@ class App(qt.QMainWindow):
|
||||||
db = int(self.dbRange.value())
|
db = int(self.dbRange.value())
|
||||||
beta = int(self.kaiserBeta.value())
|
beta = int(self.kaiserBeta.value())
|
||||||
smoothing = int(self.irSmoothing.value())
|
smoothing = int(self.irSmoothing.value())
|
||||||
minPhase = self.typeBox.currentIndex() == 1
|
causality = self.causality.value()
|
||||||
_, irInv = analyzer.h_inv(ms / 1000, db, beta, smoothing, minPhase)
|
_, irInv = analyzer.h_inv(
|
||||||
|
ms / 1000, db, beta, smoothing, causality / 100)
|
||||||
|
|
||||||
name = (f'IR_{ms}ms_{db}dB_{beta}t_{smoothing}s'
|
name = f'IR_{ms}ms_{db}dB_{beta}t_{smoothing}s_{causality}c.wav'
|
||||||
f'{"_minphase" if minPhase else ""}.wav')
|
|
||||||
filename, _ = qt.QFileDialog.getSaveFileName(
|
filename, _ = qt.QFileDialog.getSaveFileName(
|
||||||
self, 'Save inverse impulse response',
|
self, 'Save inverse impulse response',
|
||||||
str(self.saveDir / name), 'WAV (*.wav)')
|
str(self.saveDir / name), 'WAV (*.wav)')
|
||||||
|
@ -196,7 +196,7 @@ class App(qt.QMainWindow):
|
||||||
self.hi = pg.SpinBox(
|
self.hi = pg.SpinBox(
|
||||||
value=20000, step=100, bounds=[5, 40000], suffix='Hz')
|
value=20000, step=100, bounds=[5, 40000], suffix='Hz')
|
||||||
self.secs = pg.SpinBox(
|
self.secs = pg.SpinBox(
|
||||||
value=1.0, step=0.1, bounds=[0.1, 10], suffix='s')
|
value=1.0, step=0.1, bounds=[0.1, 30], suffix='s')
|
||||||
self.ampl = pg.SpinBox(
|
self.ampl = pg.SpinBox(
|
||||||
value=40, step=1, bounds=[0, 100], suffix='%')
|
value=40, step=1, bounds=[0, 100], suffix='%')
|
||||||
self.spectrumSmoothing = pg.SpinBox(
|
self.spectrumSmoothing = pg.SpinBox(
|
||||||
|
@ -271,19 +271,21 @@ class App(qt.QMainWindow):
|
||||||
self.dbRange.sigValueChanging.connect(self.plot)
|
self.dbRange.sigValueChanging.connect(self.plot)
|
||||||
self.kaiserBeta = pg.SpinBox(
|
self.kaiserBeta = pg.SpinBox(
|
||||||
value=5, step=1, bounds=[0, 100])
|
value=5, step=1, bounds=[0, 100])
|
||||||
|
self.kaiserBeta.sigValueChanging.connect(self.plot)
|
||||||
self.irSmoothing = pg.SpinBox(
|
self.irSmoothing = pg.SpinBox(
|
||||||
value=15, step=1, bounds=[0, 30])
|
value=15, step=1, bounds=[0, 30])
|
||||||
self.irSmoothing.sigValueChanging.connect(self.plot)
|
self.irSmoothing.sigValueChanging.connect(self.plot)
|
||||||
self.kaiserBeta.sigValueChanging.connect(self.plot)
|
|
||||||
|
causalityLabel = qt.QLabel('Causality: ')
|
||||||
|
causalityLabel.setToolTip('0% = Zero phase, 100% = Zero lateny')
|
||||||
|
self.causality = pg.SpinBox(
|
||||||
|
value=0, step=5, bounds=[0, 100], suffix='%')
|
||||||
|
self.causality.sigValueChanging.connect(self.plot)
|
||||||
|
|
||||||
self.useBox = qt.QComboBox()
|
self.useBox = qt.QComboBox()
|
||||||
self.useBox.addItems(['Stored measurements', 'Last measurement'])
|
self.useBox.addItems(['Stored measurements', 'Last measurement'])
|
||||||
self.useBox.currentIndexChanged.connect(self.plot)
|
self.useBox.currentIndexChanged.connect(self.plot)
|
||||||
|
|
||||||
self.typeBox = qt.QComboBox()
|
|
||||||
self.typeBox.addItems(['Zero phase', 'Zero latency'])
|
|
||||||
self.typeBox.currentIndexChanged.connect(self.plot)
|
|
||||||
|
|
||||||
exportButton = qt.QPushButton('Export as WAV')
|
exportButton = qt.QPushButton('Export as WAV')
|
||||||
exportButton.setShortcut('E')
|
exportButton.setShortcut('E')
|
||||||
exportButton.setToolTip('<Key E>')
|
exportButton.setToolTip('<Key E>')
|
||||||
|
@ -303,8 +305,8 @@ class App(qt.QMainWindow):
|
||||||
hbox.addWidget(qt.QLabel('Smoothing: '))
|
hbox.addWidget(qt.QLabel('Smoothing: '))
|
||||||
hbox.addWidget(self.irSmoothing)
|
hbox.addWidget(self.irSmoothing)
|
||||||
hbox.addSpacing(32)
|
hbox.addSpacing(32)
|
||||||
hbox.addWidget(qt.QLabel('Type: '))
|
hbox.addWidget(causalityLabel)
|
||||||
hbox.addWidget(self.typeBox)
|
hbox.addWidget(self.causality)
|
||||||
hbox.addSpacing(32)
|
hbox.addSpacing(32)
|
||||||
hbox.addWidget(qt.QLabel('Use: '))
|
hbox.addWidget(qt.QLabel('Use: '))
|
||||||
hbox.addWidget(self.useBox)
|
hbox.addWidget(self.useBox)
|
||||||
|
|
Ładowanie…
Reference in New Issue