diyAudio

diyAudio (https://www.diyaudio.com/forums/index.php)
-   Multi-Way (https://www.diyaudio.com/forums/multi-way/)
-   -   ARTA (https://www.diyaudio.com/forums/multi-way/76977-arta.html)

iMat 12th November 2019 07:56 PM

Quote:

Originally Posted by mbrennwa (https://www.diyaudio.com/forums/multi-way/76977-arta-post5973541.html#post5973541)
"The format of PIR files is changed. Marker and cursor positions are saved in PIR files. They can be loaded on File->Open command if that action is defined in dialog opened with command File->Options."


Does that mean there are some new fields in the header section? Or does the marker / cursor data go to previously existing fields that were not used?

I am asking because changing the format might break PIR import functions in other software. That wouldn't be nice.

There will be no problem with import software, as header size is unchanged and data for cursor and marker are saved to previously reserved (unused) fields.

Ivo

jzagaja 12th November 2019 07:58 PM

Proposal - user clicks impulse max and ARTA sets gate - defined msec before and after. Usefull for raw directivity plots.

mbrennwa 13th November 2019 07:23 AM

Quote:

Originally Posted by iMat (https://www.diyaudio.com/forums/multi-way/76977-arta-post5973629.html#post5973629)
There will be no problem with import software, as header size is unchanged and data for cursor and marker are saved to previously reserved (unused) fields.

Ivo

Can you send me an example file that was saved with the new format so that I can try / confirm?

kimmosto 13th November 2019 08:23 AM

Single if clause shouldn't be that hard. It's safe no matter how platform behaves when reading and casting value to different type.

Code:

                //Open file
                fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read);
                reader = new BinaryReader(fileStream);

                //Read header
                char[] filesignature = reader.ReadChars(4);    // four signature characters: 'P','I','R','\0'
                string signature = new string(filesignature);
                if (signature != "PIR\0")
                {
                    reader.Close();
                    fileStream.Close();
                    MessageBox.Show(this, "Illegal file format.", KSPub.Caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return false;
                }
                uint version = reader.ReadUInt32();            // version of file format starting from 0x0100
                int infosize = reader.ReadInt32();              // length of user defined text at end of file
                int reserved1 = reader.ReadInt32();            // 0;
                int reserved2 = reader.ReadInt32();            // 0;
                float fskHz = reader.ReadSingle();              // sampling frequency in kHz
                int samplerate = reader.ReadInt32();            // sampling rate in Hz
                int length = reader.ReadInt32();                // pir length
                int inputdevice = reader.ReadInt32();          // 0-voltprobe, 1-mic, 2-accelerometer
                float devicesens = reader.ReadSingle();        // V/V or V/Pa ( for mic input)
                int measurement_type = reader.ReadInt32();      // 0- signal recorded - external excitation
                                                                // 1- IR single channel correlation
                                                                // 2- IR dual channel correlation IR
                int avgtype = reader.ReadInt32();              // type of averaging (0-time or 1-freq)
                int numavg = reader.ReadInt32();                // number of averages used in measurements
                int bfiltered = reader.ReadInt32();            // forced antialiasing filtering in 2ch
                int gentype = reader.ReadInt32();              // generator type
                float peakleft = reader.ReadSingle();          // peak value (ref. 1.0) in left input channel
                float peakright = reader.ReadSingle();          // peak value (ref. 1.0) in right input channel
                int gensubtype = reader.ReadInt32();            // (0-male, 1—female for Speech PN ...
                if (version >= 0x0101)
                {
                    int cursorpos = reader.ReadInt32();        // 0..length-1
                    int markerpos = reader.ReadInt32();        // 0..length-1
                }
                else
                {
                    float reserved3 = reader.ReadSingle();      // should be 0
                    float reserved4 = reader.ReadSingle();      // should be 0
                }

                //Read data
                // pir data itself
                float[] pir = new float[length];
                for (int i = 0; i < pir.Length; i++)
                {
                    switch (inputdevice)
                    {
                        case 1:  //mic
                            pir[i] = reader.ReadSingle() / devicesens;
                            break;
                        default:  //volt probe, accelerometer
                            pir[i] = reader.ReadSingle();
                            break;
                    }
                }

                // user defined text
                char[] infotext = reader.ReadChars(infosize);

                //Close the file
                reader.Close();
                fileStream.Close();


mbrennwa 13th November 2019 10:57 AM

Quote:

Originally Posted by kimmosto (https://www.diyaudio.com/forums/multi-way/76977-arta-post5974131.html#post5974131)
Single if clause shouldn't be that hard. It's safe no matter how platform behaves when reading and casting value to different type.

Code:

                //Open file
                fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read);
                reader = new BinaryReader(fileStream);

                //Read header
                char[] filesignature = reader.ReadChars(4);    // four signature characters: 'P','I','R','\0'
                string signature = new string(filesignature);
                if (signature != "PIR\0")
                {
                    reader.Close();
                    fileStream.Close();
                    MessageBox.Show(this, "Illegal file format.", KSPub.Caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return false;
                }
                uint version = reader.ReadUInt32();            // version of file format starting from 0x0100
                int infosize = reader.ReadInt32();              // length of user defined text at end of file
                int reserved1 = reader.ReadInt32();            // 0;
                int reserved2 = reader.ReadInt32();            // 0;
                float fskHz = reader.ReadSingle();              // sampling frequency in kHz
                int samplerate = reader.ReadInt32();            // sampling rate in Hz
                int length = reader.ReadInt32();                // pir length
                int inputdevice = reader.ReadInt32();          // 0-voltprobe, 1-mic, 2-accelerometer
                float devicesens = reader.ReadSingle();        // V/V or V/Pa ( for mic input)
                int measurement_type = reader.ReadInt32();      // 0- signal recorded - external excitation
                                                                // 1- IR single channel correlation
                                                                // 2- IR dual channel correlation IR
                int avgtype = reader.ReadInt32();              // type of averaging (0-time or 1-freq)
                int numavg = reader.ReadInt32();                // number of averages used in measurements
                int bfiltered = reader.ReadInt32();            // forced antialiasing filtering in 2ch
                int gentype = reader.ReadInt32();              // generator type
                float peakleft = reader.ReadSingle();          // peak value (ref. 1.0) in left input channel
                float peakright = reader.ReadSingle();          // peak value (ref. 1.0) in right input channel
                int gensubtype = reader.ReadInt32();            // (0-male, 1—female for Speech PN ...
                if (version >= 0x0101)
                {
                    int cursorpos = reader.ReadInt32();        // 0..length-1
                    int markerpos = reader.ReadInt32();        // 0..length-1
                }
                else
                {
                    float reserved3 = reader.ReadSingle();      // should be 0
                    float reserved4 = reader.ReadSingle();      // should be 0
                }

                //Read data
                // pir data itself
                float[] pir = new float[length];
                for (int i = 0; i < pir.Length; i++)
                {
                    switch (inputdevice)
                    {
                        case 1:  //mic
                            pir[i] = reader.ReadSingle() / devicesens;
                            break;
                        default:  //volt probe, accelerometer
                            pir[i] = reader.ReadSingle();
                            break;
                    }
                }

                // user defined text
                char[] infotext = reader.ReadChars(infosize);

                //Close the file
                reader.Close();
                fileStream.Close();


Looks like importers made for the old format should have no big trouble if "float" and "int" are the same byte length. I don't remember much from C... are they the same length?

kimmosto 13th November 2019 12:21 PM

Quote:

Originally Posted by mbrennwa (https://www.diyaudio.com/forums/multi-way/76977-arta-post5974219.html#post5974219)
I don't remember much from C... are they the same length?

Both single/float and integer are usually 32-bit at the moment. Today native types could be "hidden" inside classes so length is not so obvious for programmer anymore.

mbrennwa 13th November 2019 12:38 PM

Quote:

Originally Posted by kimmosto (https://www.diyaudio.com/forums/multi-way/76977-arta-post5974270.html#post5974270)
Both single/float and integer are usually 32-bit at the moment. Today native types could be "hidden" inside classes so length is not so obvious for programmer anymore.

Hmm, sounds like a bigger question mark then.

What is the byte length of the new/modified fields in the ARTA PIR files?

kimmosto 13th November 2019 02:59 PM

Ivo has already confirmed that length of int and float are equal in pir files. I can confirm that too. Both are 32-bit in pir-files so you can cope those two values by reading 2x32-bits into some dummy buffer, totally 8 bytes.

I can also confirm that existing VituixCAD reads new pir-files without error so at least .NET is able to read and convert int32 value 0 to float type variable. Modified pir-reader (C# source above) will be published later when other modifications are done.

iMat 13th November 2019 08:26 PM

Quote:

Originally Posted by kimmosto (https://www.diyaudio.com/forums/multi-way/76977-arta-post5974381.html#post5974381)
Ivo has already confirmed that length of int and float are equal in pir files. I can confirm that too. Both are 32-bit in pir-files so you can cope those two values by reading 2x32-bits into some dummy buffer, totally 8 bytes.

I can also confirm that existing VituixCAD reads new pir-files without error so at least .NET is able to read and convert int32 value 0 to float type variable. Modified pir-reader (C# source above) will be published later when other modifications are done.

Thanks Kimo,
you fully explained how to read data and format.
I will just add for those that are not familiar with C or C++:
Data types float and integer have same size - four bytes.
You may continue using old code to read new file format, if you do not need information on cursor and marker position.
If you want to read cursor/marker position you should first check if version number is 0101 (heksa) or larger. If version number is smaller set cursor position to value 0 and marker position to value -1.

Ivo

tmuikku 26th November 2019 12:04 PM

1 Attachment(s)
Quote:

Originally Posted by tmuikku (https://www.diyaudio.com/forums/multi-way/76977-arta-post5952533.html#post5952533)
Hi mbrennwa, others. Spent a better half of a day doing measurements with ARTA and noticed too late there was arbitrary DC offset / low frequency noise ruining most of the measurements... Being novice, didn't notice it before trying to simulate crossover. Live and learn. I found some of you were discussing about the same issue back in January 2019.

I don't know when I have another day off to take new set of measurements so it would be worth trying to salvage some of these.

Any tips if there was a way to clean some of the low frequency anomalies out? Checked out MATAA but it pretty much requires some custom code bulk process files from ARTA? I would be pleased if there was a tool to batch process these since full 360 hor + ver measurement sets for a huge three way speaker was commenced :cool:

I tried to find out what was causing the problem afterwards, but didn't find it out yet. Might be bad connector in my old sound card. It didn't occur on single channel measurements, only on two channel. Tried swapping between left and right, same problemo.
Thanks!

Thanks jzagaja letting me know, RME support has given a tip: RME Babyface outputs are DC coupled and seem to be the cause for the error I had.

The cure is, use software Loopback for the reference channel in the two channel measurement mode. This way, it is not possible to have the Babyface IO and power amp included in the reference channel but at least the timing should be consistent between measurements and not include a DC error.

Attached is RME Totalmix screencapture, channel 1 is used as reference (loopback), mic in channel 2.


All times are GMT. The time now is 12:14 AM.


Search Engine Optimisation provided by DragonByte SEO (Pro) - vBulletin Mods & Addons Copyright © 2019 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 17.65%
vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2019 DragonByte Technologies Ltd.
Copyright ©1999-2019 diyAudio

Wiki