Music to Ppice

Jun 22, 2006 12 Replies

How do I convert a music file into something pspice can use? I figured out that I can use the VPWL_FILE if I have a .txt with a time and voltage column, but how do I create that .txt file? Thanks



Do you have access to Matlab? It'll happily read in .WAV files and write out the type of text file you're after.

reaman4ever,

FYI, LTspice can directly play .wav files into your simulation. The syntax is

V1 X 0 wavefile=.\\ring.wav chan=0

Example using the technique are installed as C:/Programme/LTC/SwCADIII/examples/Educational/{wavein.asc,waveout.asc}

--Mike

[/quote] Do you have access to Matlab? It'll happily read in .WAV files and write out the type of text file you're after.[/quote]

Yes I do, How do I do that? Thank you

Mike,

Will it create a PWL file, or is it internal use only?

...Jim Thompson

| James E.Thompson, P.E. | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC\'s and Discrete Systems | manus | | Phoenix, Arizona Voice:(480)460-2350 | | | E-mail Address at Website Fax:(480)460-2142 | Brass Rat | | http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

Jim,

LTspice can read/write .wav files. This is so you can play a track of music from a .wav into a simulated HiFi amp while writing the amp's output to another .wav file. (Then you can replace the tubes with transistors and see if you like that sound better -- all without getting near any hardware.)

LTspice can also do the PSpice "PWL FILE=..." syntax. But to create that file you'd have to export the simulation data to a file and delete the header with data labels to get the format you need for the "PWL FILE=..." syntax.

--Mike

Mike,

How do you get the simulation data into ASCII format? (PSpice has a block to check for CSDF, but I couldn't find a similar setting in LTSpice.)

...Jim Thompson

| James E.Thompson, P.E. | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC\'s and Discrete Systems | manus | | Phoenix, Arizona Voice:(480)460-2350 | | | E-mail Address at Website Fax:(480)460-2142 | Brass Rat | | http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

Jim,

You export the data from the waveform viewer: (Active waveform window)=>File Export. You get a file of time, value pairs that can be used as the input for a source using the "PWL FILE=..." syntax. Except you have to remove the first line of this file which will look something like time V(n001) 0.000000e+000 1.000000e+000 1.012000e-006 1.200000e-002 2.012000e-006 9.880000e-001 3.012000e-006 1.200000e-002

--Mike

[snip]

OK. Found it. Thanks!

Turns out that PSpice can export like that as well to a *.txt file. I'd just never used it... my usual way was to simply ctrl-C a waveform and paste into Excel.

The reading-in of *.wav files is a super idea!

...Jim Thompson

| James E.Thompson, P.E. | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC\'s and Discrete Systems | manus | | Phoenix, Arizona Voice:(480)460-2350 | | | E-mail Address at Website Fax:(480)460-2142 | Brass Rat | | http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

"Jim Thompson" a écrit dans le message de news: snipped-for-privacy@4ax.com...

Intusoft can do that too.

Maybe it's time to do a simulator's sound contest: same amplifier design, different simulator. Which simulator sounds best?

Thanks, Fred.
[snippage]

Obviously, a computer using an Intel processor will sound better due to the thermal emission characteristics of the CPU!

Thanks Does anyone know how to get pspice to take sample points at exactly a certain sample rate?

Depends on what you mean by "sample".

If you use a .PRINT statement, you can specify the timestep for which data is recorded.

This data will appear in the .OUT file

...Jim Thompson

-- | James E.Thompson, P.E. | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona Voice:(480)460-2350 | | | E-mail Address at Website Fax:(480)460-2142 | Brass Rat | |

formatting link
| 1962 | I love to cook with wine. Sometimes I even put it in the food.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required