Hi all, need help finding easiest way to do a conversion task.
I need to convert a txt report that lists biquads like this:
into a string like this, and also add an a0 value of 1 as highlighted in orange: (note a0 is not listed above)
If I only had a few to do, manual is easy. But I need to do 20 at a time, and try a number of sets.
A single csv file with 20 lines, each line a biquad string like above, each string pulled from the original txt report and converted, is what I need to get to.
I don't know where to start...whether this is a simple enough task for an advanced txt editor, or move to Excel/spreadsheet, or move to Excel with an AI spreadsheet assistant.
Happy to do the work/learn...just would like to get a vision for easiest route. Been a long time since I've done any type programming...
Thx for any guidance
I need to convert a txt report that lists biquads like this:
into a string like this, and also add an a0 value of 1 as highlighted in orange: (note a0 is not listed above)
If I only had a few to do, manual is easy. But I need to do 20 at a time, and try a number of sets.
A single csv file with 20 lines, each line a biquad string like above, each string pulled from the original txt report and converted, is what I need to get to.
I don't know where to start...whether this is a simple enough task for an advanced txt editor, or move to Excel/spreadsheet, or move to Excel with an AI spreadsheet assistant.
Happy to do the work/learn...just would like to get a vision for easiest route. Been a long time since I've done any type programming...
Thx for any guidance
Hi, try chatgpt. You can make your own version with instructions. If you do it right the next time you only need to upload the file and it'll spit the result out. No programming, just explain what you need to do and give the examples. Almost copypaste the post and it ought to work just fine 🙂
You could also ask it to return a python code for such conversion if you wanted. Or excel macro, almost anything 🙂 python is likely easiest and fastest get working if you don't have any particular environment yoy like to work with. You could ask how to install it all as well.
You could also ask it to return a python code for such conversion if you wanted. Or excel macro, almost anything 🙂 python is likely easiest and fastest get working if you don't have any particular environment yoy like to work with. You could ask how to install it all as well.
Thx tmuikku, i have stated looking at chatgpt. And excel macro. No experience with python at all.
I don't really care what path, other than getting all the biquads from their existing format into a csv file, where each line is a biquad.
If I do that, the csv file imports directly into qsys (which can handle 256 biquads per channel!)
My auto-IIR generator can produce 20 filters at at time, and add layer upon layer if a higher filter count is desired.
I'm hoping to give auto FIR vs auto-IIR a good fair test.
I don't really care what path, other than getting all the biquads from their existing format into a csv file, where each line is a biquad.
If I do that, the csv file imports directly into qsys (which can handle 256 biquads per channel!)
My auto-IIR generator can produce 20 filters at at time, and add layer upon layer if a higher filter count is desired.
I'm hoping to give auto FIR vs auto-IIR a good fair test.
How soon do you need it? Give me a sample file and two days time, and I may come up with something that will run under Linux and Windows.
VERY kind offer Preamp, thank you.
I'm in no hurry at all. This is just another ongoing experiment with my fascination for how important processing is to DIY speakers.
First file is example of the txt report my IIR generating software makes. I put in 4 IIR filters to extract and convert.
Second file is the output format I need in csv. Note I had to add a0=1 into each string.
Please just say screw it ! If not as easy as hoped.
Best, Mark
I'm in no hurry at all. This is just another ongoing experiment with my fascination for how important processing is to DIY speakers.
First file is example of the txt report my IIR generating software makes. I put in 4 IIR filters to extract and convert.
Second file is the output format I need in csv. Note I had to add a0=1 into each string.
Please just say screw it ! If not as easy as hoped.
Best, Mark
Attachments
Do the files contain a variable number of up to 20 biquads?
How many files would you like to convert at once; i.e. do you prefer to pick a single file and receive a single csv, or pick a folder containing several files to be converted at once into: either a single, or into several csv files?
How many files would you like to convert at once; i.e. do you prefer to pick a single file and receive a single csv, or pick a folder containing several files to be converted at once into: either a single, or into several csv files?
On Linux, one line of Bash can do that.
Ed
Code:
% cat file.txt
biquad1,
b0=1.0211,
b1=-1.9406,
b2=0.93622,
a1=-1.9406,
a2=0.957417,
%
% for n in b0 b1 b2 a0 a1 a2; do echo -n `grep $n= file.txt` | sed 's/^...//g' ; if test $n == "a0"; then echo -n "1,"; fi; done; echo
1.0211,-1.9406,0.93622,1,-1.9406,0.957417,
%
Ed
Yes, the files can contain any number of biquads up to 20.Do the files contain a variable number of up to 20 biquads?
How many files would you like to convert at once; i.e. do you prefer to pick a single file and receive a single csv, or pick a folder containing several files to be converted at once into: either a single, or into several csv files?
A single file that has however many biquads were in the original file is what I need.
Here's what qsys says it accepts for import in this help page file:///C:/Program%20Files/QSC/Q-SYS%20Designer%209.4/WebHelp/Index.htm#Schematic%20Library/filter_IIR.htm
If however many biquads are in the original txt file, turn into lines like that, I'd be good to go
Thx Ed, if I were just needing to do one biquad at a time, I'd be slugging it out with excel. But the idea of search and replace an unknown number of biquads, along with changes needed, has me coming for help.On Linux, one line of Bash can do that.
I don't know where to start...whether this is a simple enough task for an advanced txt editor, or move to Excel/spreadsheet, or move to Excel with an AI spreadsheet assistant.
This looks like a task for whatever scripting language you use for addressing small tasks like this. If you haven't got one then this looks a task to help learn one. There are many viable choices (I would likely use lua) but for engineers, scientists, data scientists python seems to have become the goto language being open, free and cross-platform. It also has a lot of dsp modules enabling you to also address possible issues with whatever you are currently using.
The script (mytxt2csv.py) could be written to accept a list of txt files (a.txt b.txt or *.txt) and write a list of csv files with the same name. Invoke with 'python mytxt2csv.py *.txt'. It would open each txt file and corresponding csv file, search for the line containing a coefficient, read the coefficient and write to the csv file with a comma, inject the a0 coefficient before the a1 and finally close the files. The procedure would be similar in other scripting languages. It should be less than 10 lines of code and a lot easier to understand and modify in the future compared to pattern scanning and processing gobbledegook (e.g. awk, regexp, and friends). Of course you can pattern scan and process strings in scripting languages like python and lua if inclined but it is avoidable.
Python of course has a csv module and might have a module for whatever you are using to create the coefficients. There are relatively few engineering packages I use these days that don't have support for python scripts.
Here's something to try for you. At the moment it is compiled for Windows only; I can compile it for Linux when I'm back home later.
The ZIP file contains the Executable (biquad.exe) and all the project files for you to play around with. It is built with the Lazarus IDE, which is free and cross-platform.
The ZIP file contains the Executable (biquad.exe) and all the project files for you to play around with. It is built with the Lazarus IDE, which is free and cross-platform.
Attachments
Preamp, you rock !!! Thx so much man 🙂👍
Here's a 10 PEQ and shelving I just tried out....looks great to me.
Here's a 10 PEQ and shelving I just tried out....looks great to me.
Thx Andy...very helpful in planning where I want to devote some learning time. I'm inclined to try to learn Lua because it is the scripting language qsys uses.This looks like a task for whatever scripting language you use for addressing small tasks like this. If you haven't got one then this looks a task to help learn one. There are many viable choices (I would likely use lua) but for engineers, scientists, data scientists python seems to have become the goto language being open, free and cross-platform. It also has a lot of dsp modules enabling you to also address possible issues with whatever you are currently using.
The script (mytxt2csv.py) could be written to accept a list of txt files (a.txt b.txt or *.txt) and write a list of csv files with the same name. Invoke with 'python mytxt2csv.py *.txt'. It would open each txt file and corresponding csv file, search for the line containing a coefficient, read the coefficient and write to the csv file with a comma, inject the a0 coefficient before the a1 and finally close the files. The procedure would be similar in other scripting languages. It should be less than 10 lines of code and a lot easier to understand and modify in the future compared to pattern scanning and processing gobbledegook (e.g. awk, regexp, and friends). Of course you can pattern scan and process strings in scripting languages like python and lua if inclined but it is avoidable.
Python of course has a csv module and might have a module for whatever you are using to create the coefficients. There are relatively few engineering packages I use these days that don't have support for python scripts.
But easiest alternatives are almost always usually end up making most sense. I think I'll try the ChatGBT route first...just to see if this old man can still play.
Hey, i used to be a pretty good programmer back in the days of CPM/Basic/assembly language ...lol You wouldn't believe some of the financial routines I managed to get into a HP41-CV lol again..
You may want to try Linux. A Linux distro comes with at least two dozen programming languages. It is a toolkit for solving computing problems. You can try all of them. 🙂
Ed
Ed
Very nice, thx! I've used raspi's for a few tasks...a little bit of flirting Debian is my total Linux experience.
The txt report your program pulls the biquads from is run on Windows, and from other Crosslite users I know it would take some kind of virtual Windows under Linux to run. Akin to bootcamp or something....not my domain really.
I can see a real need to have a Linux computer that allows any OS to run underneath it. I think that is about the only way I could make the switch off of the f..(ing) windows dependency, given all the software I use.
The txt report your program pulls the biquads from is run on Windows, and from other Crosslite users I know it would take some kind of virtual Windows under Linux to run. Akin to bootcamp or something....not my domain really.
I can see a real need to have a Linux computer that allows any OS to run underneath it. I think that is about the only way I could make the switch off of the f..(ing) windows dependency, given all the software I use.
I can see a real need to have a Linux computer that allows any OS to run underneath it. I think that is about the only way I could make the switch off of the f..(ing) windows dependency, given all the software I use.
It's likely to be easier the other way round by running vmware, virtualbox or whatever on Windows. Linux distros are open and designed to be installed and booted in all sorts of different ways unlike Windows and Apple OSs whose business case tends to support being proprietary and difficult. If you actually use Windows or Apple as your main OS then that strengthens the case for doing it this way round. A few hours installing vmware/virtualbox/..., a linux distribution and having a quick play to find out how things work and it is there ready to be used at your leisure when you have some spare time. As your familiarity with open source alternatives to Windows software grows you will be in a position to judge when or if it is time to move the bulk of your data to linux.
- Home
- Design & Build
- Software Tools
- Convert Biquad coefficient list, into a string?