Maker Pro
Maker Pro

LTSpice "waveout" feature

J

James Meyer

Jan 1, 1970
0
I was playing around with the waveout feature of LTSpice yesterday at
work. The example file, waveout.asc, produced a file, ring.wav, that Windows
media player on the Win2000 box could play just fine. I continued my playing
here at home with my Win98SE box and found that the same .wav file would load
into media player, but wouldn't play through my speakers. There was no error
message, just no sound.

I changed waveout's parameters to produce ring.wav at 11025 BPS (one of
the "standard" bit rates) instead of the original file's 10000 BPS and then my
media player started making sound.

Why did the work machine handle 10K BPS and my home machine didn't? Is
it due to different media player versions? Or is it because the sound card I'm
using at home is different?

Jim
 
K

Ken Smith

Jan 1, 1970
0
James Meyer said:
Is it due to different media player versions?
Or is it because the sound card I'm using at home is different?

Or different versions of Windows.
Or different versions of some software that shouldn't effect sound.
Or you installed Windows under a full moon.

In Windows, hardware usually has a drive specific for it. The driver
adapts the actual hardware to a more generalized interface to Windows.
Windows then regulates accesses applications make to this interface. Both
the OS and the application can use DLLs to do part of their work.

The driver, hardware and application all can limit things. The tricky
part is the business to do with DLLs. If you install "Uncle Billy's band
of mouse fixer" and that software happens to install a DLL with the same
name as one used by the sound, the sound functions could quit working.
 
M

Mike Engelhardt

Jan 1, 1970
0
Jim,
I was playing around with the waveout feature of LTSpice yesterday
at work. The example file, waveout.asc, produced a file, ring.wav,
that Windows media player on the Win2000 box could play just fine.
I continued my playing here at home with my Win98SE box and found
that the same .wav file would load into media player, but wouldn't
play through my speakers. There was no error message, just no sound.

I changed waveout's parameters to produce ring.wav at 11025 BPS (one
of the "standard" bit rates) instead of the original file's 10000 BPS
and then my media player started making sound.

Why did the work machine handle 10K BPS and my home machine didn't?
Is it due to different media player versions? Or is it because the
sound card I'm using at home is different?

LTspice can write .wav formats that your PC codec can't handle. It
depends on the card and driver. Until you posted I hadn't heard of
a sound card that couldn't play 10KHz sampled data. But you're
right, it isn't that popular of a sampling rate and I'll see the
example gets changed to the nearest popular rate, 11025. Basically,
if you want to play the .wav file on your PC sound card, it is safer
to use one of the more popularly supported .wav file formats; i.e.;
1 or 2 channels; 8 or 16 bits/channel; and a sample rate of 11025,
22050, or 44100 Hz. Though if you're going to play the .wav file
into a subsequent simulation, you can use a much higher sampling rate
or data width. See the help docs for the limits there.

--Mike
 
J

James Meyer

Jan 1, 1970
0
LTspice can write .wav formats that your PC codec can't handle. It
depends on the card and driver.

A Yamaha OPL3-SAx WDM driver shows up in my hardware list. And about 10
other drivers under "details". The card's pretty old and the drivers probably
are too.
Until you posted I hadn't heard of
a sound card that couldn't play 10KHz sampled data.

--Mike
Thanks. I'm using LTSpice like a music synthesizer to generate sound
effects for a "government" project. Listening to the .wav file is the result
I'm after. It works a treat!

Jim "Moog" Meyer

Hey! I just thought of something. I started to attach one of the
effects I made as a .wav file so you guys could hear it. But then I thought
better of putting a binary attachment up on S.E.D.

Then I realized that I could simply copy the text "synth.asc" in-line
and anybody with LTSpice could reproduce the .wav locally.

How's that for compression? A 33KB .wav file replaced with a 2KB text
file. And it's utterly lossless to boot!

.........clip here.........

Version 4
SHEET 1 2600 848
WIRE 1008 512 1008 560
WIRE 1008 640 1008 688
WIRE 1360 512 1360 560
WIRE 1360 640 1360 688
WIRE 1152 160 1152 208
WIRE 1152 288 1152 336
WIRE 1664 512 1664 560
WIRE 1664 640 1664 688
WIRE 2000 224 2144 224
WIRE 1664 512 1744 512
WIRE 1856 256 1760 256
WIRE 1360 512 1408 512
WIRE 1008 512 1056 512
WIRE 1856 192 1760 192
WIRE 1152 160 1248 160
FLAG 1008 688 GND
FLAG 1360 688 GND
FLAG 1056 512 A
FLAG 1408 512 B
FLAG 1152 336 GND
FLAG 1664 688 GND
FLAG 1744 512 VOLUME
FLAG 1248 160 FREQUENCY
FLAG 2144 224 OUT
FLAG 1760 256 VOLUME
FLAG 1760 192 FREQUENCY
SYMBOL VOLTAGE 1008 544 R0
WINDOW 39 0 0 Left 0
WINDOW 123 0 0 Left 0
SYMATTR InstName V2
SYMATTR Value SINE(0 .03 5 10m)
SYMBOL voltage 1360 544 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V3
SYMATTR Value PWL(0 0 3 1)
SYMBOL BV 1152 192 R0
SYMATTR InstName B1
SYMATTR Value V=(V(B)*V(B)*V(B))+.03*RANDOM(100*V(B))
SYMBOL voltage 1664 544 R0
WINDOW 39 0 0 Left 0
WINDOW 123 0 0 Left 0
SYMATTR InstName V4
SYMATTR Value PWL(0 0 .5 1 1.5 1 3 0)
SYMBOL SpecialFunctions\\modulate 1856 192 R0
WINDOW 3 -7 147 Left 0
SYMATTR Value MARK=5000 SPACE=10
SYMATTR InstName A1
TEXT 992 744 Left 0 !.tran 3
TEXT 960 784 Left 0 !.wave .\\sepfeg.wav 8 11025 V(OUT)
TEXT 1208 248 Left 0 ;MIXER

.........end of file.......
 
J

Joe

Jan 1, 1970
0
James Meyer said:
A Yamaha OPL3-SAx WDM driver shows up in my hardware list. And about 10
other drivers under "details". The card's pretty old and the drivers probably
are too.

Thanks. I'm using LTSpice like a music synthesizer to generate sound
effects for a "government" project. Listening to the .wav file is the result
I'm after. It works a treat!

Jim "Moog" Meyer

Hey! I just thought of something. I started to attach one of the
effects I made as a .wav file so you guys could hear it. But then I thought
better of putting a binary attachment up on S.E.D.

Then I realized that I could simply copy the text "synth.asc" in-line
and anybody with LTSpice could reproduce the .wav locally.

How's that for compression? A 33KB .wav file replaced with a 2KB text
file. And it's utterly lossless to boot!

........clip here.........

Version 4
SHEET 1 2600 848
WIRE 1008 512 1008 560
WIRE 1008 640 1008 688
WIRE 1360 512 1360 560
WIRE 1360 640 1360 688
WIRE 1152 160 1152 208
WIRE 1152 288 1152 336
WIRE 1664 512 1664 560
WIRE 1664 640 1664 688
WIRE 2000 224 2144 224
WIRE 1664 512 1744 512
WIRE 1856 256 1760 256
WIRE 1360 512 1408 512
WIRE 1008 512 1056 512
WIRE 1856 192 1760 192
WIRE 1152 160 1248 160
FLAG 1008 688 GND
FLAG 1360 688 GND
FLAG 1056 512 A
FLAG 1408 512 B
FLAG 1152 336 GND
FLAG 1664 688 GND
FLAG 1744 512 VOLUME
FLAG 1248 160 FREQUENCY
FLAG 2144 224 OUT
FLAG 1760 256 VOLUME
FLAG 1760 192 FREQUENCY
SYMBOL VOLTAGE 1008 544 R0
WINDOW 39 0 0 Left 0
WINDOW 123 0 0 Left 0
SYMATTR InstName V2
SYMATTR Value SINE(0 .03 5 10m)
SYMBOL voltage 1360 544 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V3
SYMATTR Value PWL(0 0 3 1)
SYMBOL BV 1152 192 R0
SYMATTR InstName B1
SYMATTR Value V=(V(B)*V(B)*V(B))+.03*RANDOM(100*V(B))
SYMBOL voltage 1664 544 R0
WINDOW 39 0 0 Left 0
WINDOW 123 0 0 Left 0
SYMATTR InstName V4
SYMATTR Value PWL(0 0 .5 1 1.5 1 3 0)
SYMBOL SpecialFunctions\\modulate 1856 192 R0
WINDOW 3 -7 147 Left 0
SYMATTR Value MARK=5000 SPACE=10
SYMATTR InstName A1
TEXT 992 744 Left 0 !.tran 3
TEXT 960 784 Left 0 !.wave .\\sepfeg.wav 8 11025 V(OUT)
TEXT 1208 248 Left 0 ;MIXER

........end of file.......

Jim,
I tried copying the above file but when I went into LTSPICE, there was
nothing I could do with it. Can you advise me how to get it to work?

Joe
 
H

Helmut Sennewald

Jan 1, 1970
0
Joe said:
James Meyer said:
Jim,
I tried copying the above file but when I went into LTSPICE, there was
nothing I could do with it. Can you advise me how to get it to work?

Hello Joe,
this is a simulation/schematic file for LTSPICE. So please put it
into a file named "yourname.asc". The .asc is important.
Then open it with LTSPICE and press "Run".
It will generate an audio .wav file.

Best Regards,
Helmut

PS: This is a great feature of LTSPICE that you can have your
schematic file within a posting.
 
C

Chaos Master

Jan 1, 1970
0
Joe said those words of wisdom from the arcane mages in sci.electronics.design:

:)

[snip LT code]
Jim,
I tried copying the above file but when I went into LTSPICE, there was
nothing I could do with it. Can you advise me how to get it to work?


Save this in .asc format (copy it into Notepad, save as .asc file as in File->Save
As->"music.asc"), then open music.asc into LTSpice, then do as usual for
simulation, and look for the result in the same folder where the .asc file is
stored.
 
J

James Meyer

Jan 1, 1970
0
Jim,
I tried copying the above file but when I went into LTSPICE, there was
nothing I could do with it. Can you advise me how to get it to work?

Joe

Open the original message.

Highlight the parts between the ".......".

Use the control-C keystroke to copy the highlighted part into Windows'
clipboard.

Open Windows' Notepad program.

Use the control-V keystroke to paste the highlighted part into Motepad.

Save the new Notepad file to somewhere you can find with the name
"synth.asc". Or any name with the extension " .asc".

Then open LTSpice and load yout newly saved file just like any other
schematic.

Jim

P.S. There will be a prize for anyone who figures out what "sepfeg" stands for.
 
Top