Post Go back to editing

{Request} Wildcards in .wave statement

Thread Summary

The user requested support for parameterized filenames in the .wave directive for LTspice to automate the naming of multiple WAV files generated from simulations. The final answer confirmed that string parameter concatenation is supported in LTspice versions 24.1 and higher, using the '+' operator. The user encountered issues with string parameters in version 24.0.9 but successfully tested the feature after updating to version 26.0.1. The user also inquired about writing B-sources across multiple lines for better readability, which remains unresolved.
AI Generated Content
Category: Software
Software Version: 24.0.9

To keep a long story short:

I'd like to post a request. It would be nice, if you could add parameter-support for the filename in the wav-output directive. 

Something like:

.wave {filename} 24 176400 V(out)

or something like:

.wave output_#_{number}.wav 24 176400 V(out). 

My schematic puts out 10 Waves in parallel - and i have to do 12 different runs (with different global parameters). I need to edit every single file-name of my 10 WAV-outputs - for every new run - to include the changed parameter. Makes 120 manual edits per circuit. It would be nicer, if i could insert the parameter into the filename - automatically. I hope you understand.

Greetings 

J.H.

 

  • Hello JHerrmann, All assigned engineers are out of office currently. MStokowski will be back in the week of 1/5/2026 to answer your question!

  • ADI North America will be on winter shutdown starting December 24, 2024; perhaps another community member can assist you until our return on January 2, 2025.
  • Hi  ,

    This is already supported by string expressions in versions 24.1 and up.

    From the Help:

    .wave <filename.wav>|<string exprssion> <Nbits>  <SampleRate> V(out) [V(out2) ...]

    and

    String parameters only support the "+" operator for string concatenation, e.g:

    .param variant = "_fast"
    X23 PIN1 PIN2 {"U125D" + variant}

    mike

  • I will test this as soon as possible (=tomorrow). As you show it, i guess [.step param variant list "_fast" "_slow" "_medium"] would also work as intended? That would really be something new (and useful!) - i searched all the internet, and even asked AI (MSCopilot) for it - but nobody knew something. From your point of view ("read the manual") it seems logical - but this kung fu (with + operator) is really somewhat unsual .. i guess... I come back to you, as soon as i have tested it. Thanks for now. Very much appreciated - really. 

  • Hi  ,

    Concatenation, I believe, is commonly achieved with either an ampersand (&) or plus (+), depending on the application language. Note, also, from the help:

    Note that numerical parameters implicitly convert to strings. The conversion of non-integers is unspecified. Implicit conversion takes place before performing any operations, for instance

    .param text = 1 + 3 + "text"

    yields "13text", not "4text".

    This inference precludes the need to convert an integer to a string character, as one would have to do in, say, Excel.

    mike

  • Hello Mike...

    Sorry for coming back here a bit late. I have tried your suggestions, but i am not even able to set string variables. ".param text="xyz"" or ".param text= 1 + 2 + 3 + "text" leads to "couldn't resolve parameter" errors. Using plain numbers instead of text leads to invalid Stoi errors in the .wav command.  That doesn't kill my project, since i have switched to batch-mode-simulation and bash/batch programming of the netlist instead. Working under Linux, i am able to modify the netlists and start runs with parameters and wav-names as i want. I believe, for my project, this is the definite solution, but i am still interested in what you suggested. But as of now: it simply doesn't work. Sorry ... either i am doing something wrong (tested different variations - also with "&") or it simply doesn't work. LTSpice version FIY is: 24.0.9 - i will try to get a newer Version, next time i am on Windows. This could delay until the weekend i believe, since i am very busy atm.

  • Hi  ,

    Huh, I'd better look at this. Thanks.

    mike

  • yepp - i think the fault is on my side, since i am running version 24.0.9 - the recent version is 26. So... Maybe its just, that i am a bit late regarding my updates. I come back to you, as soon as i am on windows again. By the way: Bash-Programming of the netlists is like... well.. LTSpice as Atombomb. I am able to deform the netlists in every direction i want. Prototyping: As usual with LTSpice -- Mass Production of Output: Per Bash- Netlists - and LTSpice in Batchmode...Definitely the way to go (besides Python-LTSpice etc..) if you are mass-processing... By the way: Are you aware of any useful tools to convert RAW into WAV?

  • Hi  ,

    If you are using LTspice 24.0.9, it will not work. You must use version 24.1 or higher to use string parameters. As there are quite a few stability fixes in the latest version, 26.0.1, I would highly recommend updating. 

    This is already supported by string expressions in versions 24.1 and up.

    mike

  • Yes. Sorry about the concurrent reply.