.OSC File Format and Converting

Thread Starter

MrAl

Joined Jun 17, 2014
11,342
Hello there,

I'd like to find out the structure of the .OSC file format that is typically used for oscilloscopes They store the data in this format when logging the waveforms over time to hard disk.
I'd like to be able to convert this kind of file with my own software, that is, that i program myself, not some ready made program, so i need to know the structure of the file.
It typically contains time and voltage data, but i dont really know if it has anything else too, but it's not human readable. Typically it would be converted to text data which would then be human readable.

Thanks in advance.
 

xox

Joined Sep 8, 2017
838
Hello there,

I'd like to find out the structure of the .OSC file format that is typically used for oscilloscopes They store the data in this format when logging the waveforms over time to hard disk.
I'd like to be able to convert this kind of file with my own software, that is, that i program myself, not some ready made program, so i need to know the structure of the file.
It typically contains time and voltage data, but i dont really know if it has anything else too, but it's not human readable. Typically it would be converted to text data which would then be human readable.

Thanks in advance.
Couldn't find anything on that format either. Can you attach one or two sample files?
 

Alec_t

Joined Sep 17, 2013
14,263
There used to be a site, wotsit.org, which had all sorts of useful file format data, but that site and its mirrors now seem dead. Perhaps it's in the internet archive site (I haven't checked).
 

Thread Starter

MrAl

Joined Jun 17, 2014
11,342
Couldn't find anything on that format either. Can you attach one or two sample files?
Hello again,

Here are two files but one is the .osc file i want to convert and one is the .csv file which is the converted .osc file into text form. So the .csv file is just a text file that could have had a .txt ending. The .osc file is what the scope makes though, and it has to be converted into a text file.
NOTE: i had to rename the .osc file to a .osc.txt file so that it could be uploaded. Please note that because it is NOT a text file it is a file with hex data in it. It should be read in a program that can read hex files not text files.

A couple notes...
1. The waveform was a very very slow approximately 0.1 Hz triangle that stays mostly positive but dips negative for a very short time as shown in the text file, bouncing slightly. This appears to show up in the .osc file around the location 0000:0C80 hex.

Now that i think about it, could it be storing calibration data first and then JUST the 8 bit ADC codes? I'd laugh if that was it, but that would make sense. This is the first time i've seen such repetition of data, and i think that is because of the slow varying wave.
It also might be possible that they derive the time data from the calibration data, so that the time values are not stored they are 'generated' at file conversion time.

[LATER]
Yeah it looks like each data point is just an 8 bit number. For example, C7 hex.
That would mean that the first part of the file before "DATA" would be what tells us what value each hex value translates into. The DWORD right after DATA is the number of samples in this case 0x2C00. That's as far as i got so far.
So maybe the data between "ZOOMBIAS" and "DATA" tells us what we need to know about how to translate the hex data into voltage samples.
BTW the sample rate is 1000 samples per second which translates to 0x03E8 which translates into the file as E8 03 00 00 and can be seen near the start.
 

Attachments

Last edited:

xox

Joined Sep 8, 2017
838
Hello again,

Here are two files but one is the .osc file i want to convert and one is the .csv file which is the converted .osc file into text form. So the .csv file is just a text file that could have had a .txt ending. The .osc file is what the scope makes though, and it has to be converted into a text file.
NOTE: i had to rename the .osc file to a .osc.txt file so that it could be uploaded. Please note that because it is NOT a text file it is a file with hex data in it. It should be read in a program that can read hex files not text files.

A couple notes...
1. The waveform was a very very slow approximately 0.1 Hz triangle that stays mostly positive but dips negative for a very short time as shown in the text file, bouncing slightly. This appears to show up in the .osc file around the location 0000:0C80 hex.

Now that i think about it, could it be storing calibration data first and then JUST the 8 bit ADC codes? I'd laugh if that was it, but that would make sense. This is the first time i've seen such repetition of data, and i think that is because of the slow varying wave.
It also might be possible that they derive the time data from the calibration data, so that the time values are not stored they are 'generated' at file conversion time.

[LATER]
Yeah it looks like each data point is just an 8 bit number. For example, C7 hex.
That would mean that the first part of the file before "DATA" would be what tells us what value each hex value translates into. The DWORD right after DATA is the number of samples in this case 0x2C00. That's as far as i got so far.
So maybe the data between "ZOOMBIAS" and "DATA" tells us what we need to know about how to translate the hex data into voltage samples.
BTW the sample rate is 1000 samples per second which translates to 0x03E8 which translates into the file as E8 03 00 00 and can be seen near the start.


Okay, here's a quick and dirty application which seems to work fine with the sample file you've posted. Still a bit of uncertain about how some of the fields should be interpreted however (namely "alignment", "format", "trigger_point", and "boxing"). If can post some more complex files it might not be too hard to work all that out though.

Anyway, in case you're not too familiar with C++ just jump down to the "parse" function and work backward through the code from there. Should be fairly straight-forward, hopefully.
 

Attachments

Thread Starter

MrAl

Joined Jun 17, 2014
11,342
Okay, here's a quick and dirty application which seems to work fine with the sample file you've posted. Still a bit of uncertain about how some of the fields should be interpreted however (namely "alignment", "format", "trigger_point", and "boxing"). If can post some more complex files it might not be too hard to work all that out though.

Anyway, in case you're not too familiar with C++ just jump down to the "parse" function and work backward through the code from there. Should be fairly straight-forward, hopefully.
Hi again,

Thanks a lot. Just one question, how did you determine the fields and what do the fields mean?
For example, "boxing".

I've included a hex dump of the start of one of the test files. Each field you mentioned is enclosed in a box except for the fields that are clearly upper case text. The hex file values are shown individually below that.
 

Attachments

xox

Joined Sep 8, 2017
838
Hi again,

Thanks a lot. Just one question, how did you determine the fields and what do the fields mean?
For example, "boxing".

I've included a hex dump of the start of one of the test files. Each field you mentioned is enclosed in a box except for the fields that are clearly upper case text. The hex file values are shown individually below that.
The only information I could find on the format was on this Russian message board. Doesn't seem to provide any useful information about those particular fields though.
 

Thread Starter

MrAl

Joined Jun 17, 2014
11,342
The only information I could find on the format was on this Russian message board. Doesn't seem to provide any useful information about those particular fields though.
Hi again,

Well thanks for the info so far, that is at least a start.
 
Top