This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Question about the phyphox file format
#6
Hello,

I explored in more detailed the difference between iOS and Android. Not for the fun of it, but because I wanted to be able to detect the first run of an analysis sequence. [It was for the program that I posted in the acoustic resonance program thread - I needed to skip the first analysis run since no audio data are available then].

Here is what I did, and that works, but is a bit dirty:
- I create an index that is initialized to zero in the declaration section, and upgraded by one each analysis run ;
- I used a timer to store the elapsed time in the analysis section
- the analysis section is performed once each second (I am working with sound and need to let some time between each analysis run)

Now, the index does not tell the same number during the first analysis run on iOS (1) and Android (2) as Sebastian told us above, but the timer also behaves differently. The program below demonstrates it. When the program is open, it shows (first run will be explained later):

On iOS : time = 0s, index=0, first run = 0
On Android : time = 0s, index=1, first run = 1

When the program is run, at the first run, it gives
On iOS : time = 1.02s, index=1, first run = 1
On Android : time = 0s, index=2, first run = 1

On the second run it gives :
On iOS : time = 2.04s, index=2, first run = 0
On Android : time = 1.01s, index=3, first run = 0

On the following run, time and index increase by 1 each run, as expected. First run remains 0 (see below).

So comparing both OS, the timer is off by 1 run, and the index is off by 1 run in the other way. To detect the first run, what I did is to add the time and index, and to give the value 1 to the variable first_run if the total is less than 3, and 0 if the total is more than 3. It works (first run is equal to 1 during the first run and 0 the others), but it is a bit dirty, and note that it is already 1 before the program is run on Android platform.

I was able to make it work for my needs, but is there a better way to detect the first run on an experiment? i am curious...

Cheers,

Fred


Attached Files
.phyphox   test_first_run.phyphox (Size: 2.02 KB / Downloads: 384)
Reply


Messages In This Thread
RE: Question about the phyphox file format - by fbouquet - 04-26-2020, 06:03 PM

Forum Jump: