
Home  Forums  Rules  Articles  The diyAudio Store  Gallery  Blogs  Register  Donations  FAQ  Calendar  Search  Today's Posts  Mark Forums Read  Search 
Equipment & Tools From test equipment to hand tools 

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 

Thread Tools  Search this Thread 
19th November 2006, 12:36 AM  #1 
diyAudio Member

Audacity sine  Is this good enough?
I recently generated a sine wave with audacity  1kHz @ 96k sample rate. I then tested it with RMAA to determine the worthiness of Audacity as a sine wave generator. On the far right of the FFT there are some peaks which are probably results of sampling and digital errors. Does anyone else use Audacity to generate sine waves?
 keantoken 
19th November 2006, 12:16 PM  #2 
diyAudio Member
Join Date: Apr 2004
Location: Gütersloh

Keantoken, is this an fft plot of a wave file ? If yes, the quality is more than bad. How big was the wave file ? 1 second ?
The artefacts are likely to be jitter or resampling. Attched is fft plot of 1khz/1sec/48khzfs/16bit, kaiser window beta of 15. fftwindow size reduced to 8192. (Created with goldwave) Mike 
19th November 2006, 12:23 PM  #3 
diyAudio Member
Join Date: Apr 2004
Location: Gütersloh

The same with audacity, worse, but not comparable to yours. Did you resample ? Also, audacity already clips when using full scale (1.0)
Audacity does something wrong with the dithering. Mike 
19th November 2006, 12:39 PM  #4 
diyAudio Member
Join Date: Apr 2004
Location: Gütersloh

And the wave file created with goldwave...

19th November 2006, 06:33 PM  #5 
diyAudio Member

I did not resample (to my knowledge).
I could think of two different types of equations for dithering: 1: Analyze the curves before and after the place needing dithering and pick the optimal place to insert a sample using an algorithm. 2: Insert a sample between two samples. I would think that the optimal type of sound format would take samples depending on the skew rate (if this is the correct term) of the piece of a wave, so that all samples would be equal distance away from each other if viewed by Audacity. This would produce the same number of samples for each frequency, and even out the quality of the sound. It could be hard to code and play, though. Have you heard of FLAC? It's Free Lossless Audio Codec. It's like the sound version of PNG image format. Do you think that this would work for quality sine waves? My sine waves were 30 seconds long. keantoken 
19th November 2006, 10:20 PM  #6 
diyAudio Member
Join Date: Apr 2004
Location: Gütersloh

With a 30sec sinewave you shouldn't have any problems... See attached file for fft of 30sec file.
About the dithering, you are thinking way too complex. Simply add white noise (output from a random number generator) to the signal (Scaled down to the scale of a single bit) before quantizing to 16bit. And, don't rely on proper rounding from the FPU, it doesn't. You need to round yourself with (int)floorf(Val+0.5). Otherwise you get crossover distortion, as the FPU always rounds to the number closest to zero. Another trap when generating a sinewave is jitter, caused by unaccuray of the float format when calculating the phase for the sinewave absolute instead of relative. Mike 
19th November 2006, 10:36 PM  #7 
diyAudio Member

Okay, looks like Audacity isn't my generator of choice any more. Unless I have some way of applying this rounding equation and know the decibel value of 1 bit. Any free software that you can suggest? I would try to make my own, but I don't know the equation that represents sine. And its probably way over my head anyways.

19th November 2006, 11:03 PM  #8  
diyAudio Member
Join Date: Apr 2004
Location: Gütersloh

Quote:
Mike 

20th November 2006, 01:43 AM  #9 
diyAudio Member

I believe that I might be able to manage if I pulled out my calculus book and concentrated extremely hard on learning about the f^(n) (a) thing (This is how I learned about rate of change t(delta), but it still didn't tell me how to calculate the speed of a falling object vs. time relative to air pressure, which was my motive at the time ). I know more about mathematics than others may see, even though I make a lot of errors sometimes.
agent_keantoken_signing_out 
20th November 2006, 04:41 AM  #10 
diyAudio Member
Join Date: Feb 2003
Location: ..

I’ve used Audacity to play/record .wav test files, but LtSpice to create and analyze them (also SciLab free MatLab workalike but the 24 bit .wav i/o needs a modified xwavread function which is stackspace expensive, keep test files short) http://www.scilab.org/
This LtSpice file should get you started The problem is getting it started; LtSpice reads in a .wav file and then outputs a .wav file so this example needs an initial .wav to startup, otherwise it just reports a file error After installing the free LtSpice simulator you can rename the attached file by just trimming off the .txt and you can open it in LtSpice SwCAD III http://linear.com/company/software.jsp Rt clik on the text line “wavefile=.\output.wav chan=0” (the “Value” of V2 Voltage Source) Type 0 Run (rt clik on blank space to get Sim menu ) Undo (<F9> or Edit>undo) to get wavefile line back for V2 Run (now for any further changes you have to run the file twice to have the V(in) values reflect any changes in the V(out), 1st Run writes the new .wav but reads the preexisting .wav, 2nd pass reads the modified .wav) This is an attempt to show dither and show how LtSpice can create .wav source for testing and analysis The Dither source is supposed to be a triangular probability distribution function by adding 2 white noise sequences (adding 1e6 to 2nd white function arg to get a decorrelated series from the underlying random number generator) I’m not certain the dither spectrum and level is optimal; with the noise created at the sample output rate it is sinc filtered with a zero at fs/2 
Thread Tools  Search this Thread 


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
SMPS to Pure Sine  EUVL  Power Supplies  2  11th June 2009 04:24 PM 
Sine Wave Generator with bulbs (Sinelightenment)  Rodeodave  Everything Else  6  21st July 2008 12:19 PM 
Sine wave testing on sub(s)  jol50  Car Audio  3  14th January 2008 05:10 AM 
sine waves on nos dac  regal  Digital Source  5  11th March 2007 09:38 PM 
Pure sine wave?  PeteMcK  MultiWay  12  4th July 2004 06:31 AM 
New To Site?  Need Help? 