Go Back   Home > Forums > Source & Line > Digital Source
Home Forums Rules Articles Store Gallery Blogs Register Donations FAQ Calendar Search Today's Posts Mark Forums Read

Digital Source Digital Players and Recorders: CD , SACD , Tape, Memory Card, etc.

Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools Search this Thread
Old 4th December 2005, 01:15 AM   #1
diyAudio Member
 
neutron7's Avatar
 
Join Date: Dec 2003
Location: Toronto Canada
Default Why cant i get a nice square wave (soundcard)

Ok here is the problem. i thought i would use my sound card as a function generator for testing amplifiers and so-on. well life is not that easy.

first of all let me explain the system. i have an EMU 0404 which is my main card for almost everything. the onboard Analog devices soundmax output is plugged into the input of the 0404. thats just because i need the crappy pc mic input for certain things and the 0404 has no mic preamp

anyways i looked at a 1khz wave from the EMU with a scope and i got this. (see attachment)

this is recorded at 44.1 khz, but it does the same thing at up to 192khz but the ringing is much higher frequency.

it doesnt look like normal ringing anyways, it has "reverse ringing" before the transitions as well.

i tried other things as well.
1: soundmax output bypassing emu to scope (same )
2: i thought it might be my cables which are rather long but tried them with the scopes internal square wave reference and it still looked perfect.
Attached Images
File Type: jpg sq.jpg (52.6 KB, 435 views)
  Reply With Quote
Old 4th December 2005, 01:36 AM   #2
diyAudio Member
 
neutron7's Avatar
 
Join Date: Dec 2003
Location: Toronto Canada
just to be sure, i took the output of the soundmax and viewed it on a software scope that was using the EMUs input. now you can see it on the still pic, but (maybe because of the drift between the 2 cards oscillators) the ringing would cycle between out of phase, cancelled out, and in phase.

in case you want to know what the programs are,

chainer is free, if you do not want to save presets. it lets you load VST and VSTi plugins directly without a host sequencer.

function generator lite is a rather limited but functional function generator. it is free

exoscope is a free scope vst plugin

anyways, does anyone know how i could fix it? the only way i can think of is to run tests at 192 KHZ and then put just the right capacitor/filter across the output. why are both sound card outputs like that? it is rather annoying now i might have to build a function generator.
Attached Images
File Type: jpg soundmax.jpg (91.0 KB, 412 views)
  Reply With Quote
Old 4th December 2005, 02:54 AM   #3
bogicp is offline bogicp  Yugoslavia
diyAudio Member
 
bogicp's Avatar
 
Join Date: Oct 2005
Default Re: Why cant i get a nice square wave (soundcard)

hi neutron7,

Quote:
Originally posted by neutron7
Ok here is the problem. i thought i would use my sound card as a function generator for testing amplifiers and so-on. well life is not that easy.

first of all let me explain the system. i have an EMU 0404 which is my main card for almost everything. the onboard Analog devices soundmax output is plugged into the input of the 0404. thats just because i need the crappy pc mic input for certain things and the 0404 has no mic preamp

anyways i looked at a 1khz wave from the EMU with a scope and i got this. (see attachment)

this is recorded at 44.1 khz, but it does the same thing at up to 192khz but the ringing is much higher frequency.

it doesnt look like normal ringing anyways, it has "reverse ringing" before the transitions as well.

i tried other things as well.
1: soundmax output bypassing emu to scope (same )
2: i thought it might be my cables which are rather long but tried them with the scopes internal square wave reference and it still looked perfect.
Pre-ringing or "reverse ringing" is characteristics of FIR filters (use google or something for explaination).

Chips on your audio card has FIR filters included, and probably, he has this behaviour. This means that you cannot obtain "clean" pulse from your audio card.

If you test audio amplifiers, also good can be wavelets, you can try this

This is a four period Hann type wavelets, "video edition"



Best regards,

boggy
  Reply With Quote
Old 4th December 2005, 11:00 AM   #4
diyAudio Member
 
Join Date: Jun 2004
Location: Italy
It's normal that a soundcard used as signal generator gives that result, very evident on the square wave. This is because the impulse responses of normal DAC chips used in soundcards (and in all digital devices) are of this kind:

Click the image to open in full size.

The explanation involves digital signal processing theory and remember also that the soundcards have a limited bandwidth, while a perfect square wave (with all its harmonics) would require infinite (or at least very large) bandwidth.
You can observe that a lower frequency square wave generated with your soundcard will be more similar to ideal case, since you have more harmonics in the bandwidth allowed (about half of your sample rate).

If you need a perfect square wave you must use a signal generator and not a soundcard. There are chips like the MAX038 that allow to build a signal generator with few components.
  Reply With Quote
Old 4th December 2005, 11:10 AM   #5
diyAudio Member
 
Join Date: Jul 2001
Location: The Netherlands
a perfect square wave has infinite bandwidth

a soundcard does not have infinite bandwidth... you'll never get a perfect square wave out of ya sndcrd.

but if ya bandlimit the sqaure wave before the go to Dig to analog conversion, you'll loose the ringing, but you get rounded edges.
  Reply With Quote
Old 4th December 2005, 11:23 AM   #6
bogicp is offline bogicp  Yugoslavia
diyAudio Member
 
bogicp's Avatar
 
Join Date: Oct 2005
Hi tchrama,
Quote:
Originally posted by tschrama
a perfect square wave has infinite bandwidth

a soundcard does not have infinite bandwidth... you'll never get a perfect square wave out of ya sndcrd.

but if ya bandlimit the sqaure wave before the go to Dig to analog conversion, you'll loose the ringing, but you get rounded edges.
Ringing in impulse or step response is already a product of band limited network, and ringing, or not ringing, impulse edge depend on Q factor of low pass filter employed in band limiting process.

Especially, pre ringing is relatively rare behaviour, and it's characteristic of FIR filter impulse or step response, for example.


Best regards,

boggy
  Reply With Quote
Old 4th December 2005, 07:18 PM   #7
diyAudio Member
 
neutron7's Avatar
 
Join Date: Dec 2003
Location: Toronto Canada
thats all very dissapointing news and shows my ignorance digital audio. i will forget this idea and go with the MAX038 suggestion from paologatto.

thanks everyone for the replies.
  Reply With Quote
Old 4th December 2005, 07:36 PM   #8
diyAudio Member
 
Pjotr's Avatar
 
Join Date: Nov 2002
Location: Netherlands
Hi,

The ringing is a result of the sharp band limiting itself at 20 kHz. It has nothing to do per se with “digital” or “FIR-filters”. If you mange to build a steep analog filter at 20 kHz you get the same ringing when fed with a square wave.

If you want a good square wave, use a simple NE555. But be careful when testing amps with it, most amps cannot handle it and are not designed to handle such steep edges. It is wise to use a 100 kHz (or lower) 1st order low pass to gently limit the bandwidth of the square.

Cheers
  Reply With Quote
Old 4th December 2005, 09:04 PM   #9
diyAudio Member
 
neutron7's Avatar
 
Join Date: Dec 2003
Location: Toronto Canada
well i wanted sine and triangle and other waveforms as well as music, i was just using the square wave as an example. thats why i wanted to use the PC sound card and not a simple 555.

anyways that maxim ic looks pretty good. I ordered one allready.
  Reply With Quote
Old 4th December 2005, 09:27 PM   #10
diyAudio Member
 
Join Date: Jun 2004
Location: Italy
Yes, the Max038 is really nice.. I builded a signal generator with this schematic:

Click the image to open in full size.

and is very useful.
I added also a frequency meter, done with a single PIC, with this schematic:

Click the image to open in full size.

loading on it this code:
http://home.datacomm.ch/str/micro.html
(search for "Autoranging frequency meter")

The final device is this:

Click the image to open in full size.
  Reply With Quote

Reply


Hide this!Advertise here!

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sine wave - Square & Triangle wave generator using Transistors / OP-Amps lineup Solid State 20 9th October 2006 12:15 AM
Square wave Prune Everything Else 11 28th June 2004 06:17 AM
Microphone turns triangle wave into square wave? Circlotron Analogue Source 18 25th January 2003 06:44 AM


New To Site? Need Help?

All times are GMT. The time now is 03:38 AM.

Page generated in 0.12534 seconds (80.06% PHP - 19.94% MySQL) with 11 queries

Copyright ©1999-2012 diyAudio