IPS-LMU / emuR

The main R package for the EMU Speech Database Management System (EMU-SDMS)
http://ips-lmu.github.io/EMU.html
23 stars 15 forks source link

Update emuR-get_trackdata.R #233

Closed fsuettmann closed 4 years ago

fsuettmann commented 4 years ago

A solution we hat for an issue with the get_trackdata() function. It feels more like a bodge and might not work for other situations but ours due to fSampleRateInMS.

raphywink commented 4 years ago

Sorry that I haven't had time to look at this yet. I am bulldozing towards a deadline beginning of next week. Will def. look at it then! Sorry about the delay

fsuettmann commented 4 years ago

There is no rush, you may take your time.

raphywink commented 4 years ago

Just stated working on it now but thanks to a new build system of R 4.0.0 under Windows I am still trying to get my build system working on my home-office machine ;-) #yayBreakingChanges!

raphywink commented 4 years ago

Ok just a quick update (still no fix but getting closer):

sl_formant <- get_trackdata(db_temp, seglist = error_mau[3,],

ssffTrackName = "fm",

                        onTheFlyFunctionName = "forest",
                        # onTheFlyParams = formal_params,
                        verbose = T)

The issue is due to the sample rates (and one other value) of on the fly calcs being slightly different than when read from file (this is the first time I have noticed this). And by slightly I mean really slightly: `199.54751131221718196684 vs. 199.54751131221701143659`. What is causing this I am not fully sure, but I guess it could have to do with the sample rate being stored as a character string with limited precision in the SSFF files. Your fix would be a "hacky" work-around for this issue but that might be what we have to do. I'd like to investigate a bit more to see if I can't fix the root of the issue....
fsuettmann commented 4 years ago

Thank you for pointing this out.

Regarding the sampling rates: This is also what I noticed but couldn't find an easy fix for the sampling rates. The proposed fix is surely more a workaround than a solution. I'm not sure if it would work with all cases the function is designed for.

raphywink commented 4 years ago

So after a deep dive into the C code of the libassp I think the best thing to do is just to go with your solution as it nicely try catches everything and we can also issue a warning that something might be a bit fishy. The issue is caused due to slight rounding errors within the C-lib due to the data types used and also guestimating floats from strings. Fixing this would be a nightmare and I don't think it is worth it right now. Anyway, thanks heaps for the pull request and pointing out this issue!

fsuettmann commented 4 years ago

Thank you! I'm glad I was able to contribute and issuing a warning sounds like a good idea.