Unfortunately, there is not much you can do about it except for trying to work around the problem by finishing the measurement with fewer total periods (I know, a very strange and hard to control limitation) or pausing the measurement, saving the current state and re-opening the state to continue from there. The bad news is that this will be a while since it is a rather niche problem and the first change since we published the last beta version just before Christmas. The good news is that this is an easy fix included in the next update (probably another beta). If you set it to 100 Hz it works for over an hour and if you set it to 8738Hz it breaks after exactly one minute. So, if you try the default frequency of the included tone generator at 440 Hz, the tone will stop after 1192 seconds (almost 20 minutes). In terms of the tone generator, this means that limit is reached after (2^31-1)/48000 periods. And this absurdly large number hit the maximum of a signed 32bit integer of 2^31-1. And since it is cyclic, we just calculate an absurdly large number and map it to the 0 to 4095 range with the modulo function. When generating the tone we then need to calculate the index of these values, which simply means that instead of calculating a phase from 0 to 2pi, we calculate an integer phase from 0 to 4095. Instead of calculating the sine function for each sample (which would mean 48000 sines per second - and that is not a quick and simple calculation) phyphox generates a table of 4096 pre-calculated sine values (thanks to sine's symmetry we could do with a fourth of this, but the implementation is easier this way). In detail, the problem was that there was an integer overflow while calculating the index for the sine lookup table. It is independent of how often you set the frequency, but happens after an exact number of periods - even on the built in tone generator experiment. the iPhone 5s of those supporting phyphox). Ths short version: The problem occurs on Android and maybe 32bit iPhones (i.e. But the solution is simple and to me somewhat satisfyingly "low level". This was probably the most annoying bug to test I have ever seen as I had to actually run the tone generator for about 20 minutes to hear when it fails and I had to do so every time I tried something.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |