SwatPhonLab / UltraTrace

A Free/Open-Source tool for manual annotation of Ultrasound Tongue Imaging data.
GNU General Public License v3.0
10 stars 5 forks source link

use or emulate dynamic range instead of using contrast #67

Closed mr-martian closed 5 years ago

mr-martian commented 5 years ago

Originally posted by @jonorthwash at 2019-06-25T21:20:44Z (original issue)

(17:06:38) firespeaker: in parselmouth
(17:06:40) firespeaker: dynamic range
(17:06:44) firespeaker: doesn't seem to be specifiable
(17:06:53) firespeaker: even though it is in Praat's spectrogram settings
(17:07:01) firespeaker: know anything about that?
(17:07:11) popcorndude: looking
(17:08:12) firespeaker: we used an adjustment for contrast instead
(17:08:20) firespeaker: (I guess you implemented contrast)
(17:08:28) firespeaker: but dynamic range is a little different
(17:08:38) firespeaker: it moves the floor around before applying any contrast stuff
(17:08:45) firespeaker: (as I understand it)
(17:13:10) popcorndude: self.spectrogram = np.minimum(self.spectrogram - 20, np.zeros(self.spectrogram.shape))
(17:13:56) popcorndude: would cut off the bottom 20 [units of self.spectrogram]
(17:14:08) popcorndude: (you'd probably have to do that before rescaling)
(17:14:15) firespeaker: is there a way to relate that to decibels?
(17:14:27) firespeaker: (= the units praat uses)
(17:15:47) popcorndude: probably
(17:16:25) firespeaker: any thoughts?
(17:17:15) popcorndude: self.spectrogram.clip(-20, dyn_range-20) would be better
(17:19:15) popcorndude: based on the parselmouth example code, decibels is apparently 10 * log10(spectrogram.values)
mr-martian commented 5 years ago

Originally posted by @BartholomaeusAstrum at 2019-06-26T19:42:15Z

b4302d9a4b7485c395a5716428699c1eeac3bbdf brings it close to praat, but not exactly the same

mr-martian commented 5 years ago

Originally posted by @jonorthwash at 2019-07-09T19:23:06Z

It's probably close enough. We can open this later if needed.