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.

 

Parents
  • 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. 

  • 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.

  • By the way: Are you aware of any useful tools to convert RAW into WAV

    I don't think so, since it is sampled waveform file, and the raw file is not really a simple x-y. I'll ask. You can export waveform results.

    BTW, any chance the multi-channel ability of wav files helps you? Say, instead of ten individual files for each run, you produce a wav file each run with ten channels. Maybe you already do this.

    mike

  • You wouldn't believe, if i told you, what i am doing. LTSpice makes Music. I use WAV output to feed Renoise (Tracker-DAW) Multisample-Instruments - per bash - fully automated. For this task i need specially designed mono-wav (or later maybe 45°out of phase Stereo). I render 120 Wav-Files (for 120 Notes on the scale - per instrument, that is - in other words: Per (virtual) VCO Waveform) and wrap them up to a multichannel-instrument - I am fully aware of the Multi-Channel ability of LTSpice - it has maybe the best, and most flexible WAV direct-renderer - i am aware of. This is, why i use it. Something e.g. Qspice, Tina etc.. are still missing. And yes: "Normally" i use LTSpice for Circuit simulation - but right now - i am building something like an organ-instrument - and LTSpice is my Waveform-Constructor - with B-Sources, a lot of Maths and MS-Copilot (AI) as Guidance regarding all sorts of mechanic (acoustic), mathematic, or programming-related problems. Anyways: As for now, i need mono-out. Again: I come back to you at the weekend - when i am on windows again, and able to update my LTSpice files. Thanks for all. Really appreciated. And Yes. I know, that the RAW File-Format is asymmetric regarding the timeline - so: Decoding would be needed. As far as i know, there exist scripts - and addons for some Maths-Programs - but i don't want to dig too deep into this, since -- yes, you are right --  i already have one of the best WAV Writers worldwide (=LTSpice). 

  • You wouldn't believe, if i told you, what i am doing. LTSpice makes Music.

    Would you believe. I'm not surprised. At all. :-)

    Cool stuff. Are you sharing your results anywhere? Would love to see how it goes. Sure many here at ADI would agree it's a worthy project.

    Are you able to produce soundfonts for your instruments, say for use in musescore or simply better midi representations?

    mike

  • Hi  ,

    Very cool. Curious about how well you are able to produce acoustic instruments...

    mike

Reply Children
  • ...updated to Version 26 .. and yes: string params are now working, but i am not able to get the syntax for the .wave command - either i get errors ("expected expression here") or the param (.param text="abcd") is not read, but interpreted as plaintext ("text" instead of "abcd"). I short words: It is not working. Reason: Either i don't understand the syntax, or it simply doesn't work. What i wanted was something like this "/drive/folder/filename+{param}.wav.