Audacity sine - Is this good enough? - diyAudio
Go Back   Home > Forums > Design & Build > Equipment & Tools

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
Reply
 
Thread Tools Search this Thread
Old 19th November 2006, 12:36 AM   #1
diyAudio Member
 
keantoken's Avatar
 
Join Date: Aug 2006
Location: Texas
Blog Entries: 2
Default 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
Attached Images
File Type: png audacitysine1khz.png (23.3 KB, 565 views)
  Reply With Quote
Old 19th November 2006, 12:16 PM   #2
MikeB is offline MikeB  Germany
diyAudio Member
 
MikeB's Avatar
 
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/48khz-fs/16bit, kaiser window beta of 15. fft-window size reduced to 8192. (Created with goldwave)

Mike
Attached Images
File Type: png 1khz_1sec.png (8.3 KB, 533 views)
  Reply With Quote
Old 19th November 2006, 12:23 PM   #3
MikeB is offline MikeB  Germany
diyAudio Member
 
MikeB's Avatar
 
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
Attached Images
File Type: png 1khz_1sec_2.png (8.8 KB, 499 views)
  Reply With Quote
Old 19th November 2006, 12:39 PM   #4
MikeB is offline MikeB  Germany
diyAudio Member
 
MikeB's Avatar
 
Join Date: Apr 2004
Location: Gütersloh
And the wave file created with goldwave...
Attached Files
File Type: zip 1khz_sec.zip (12.7 KB, 34 views)
  Reply With Quote
Old 19th November 2006, 06:33 PM   #5
diyAudio Member
 
keantoken's Avatar
 
Join Date: Aug 2006
Location: Texas
Blog Entries: 2
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
  Reply With Quote
Old 19th November 2006, 10:20 PM   #6
MikeB is offline MikeB  Germany
diyAudio Member
 
MikeB's Avatar
 
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
Attached Images
File Type: png 1khz_30sec.png (10.3 KB, 473 views)
  Reply With Quote
Old 19th November 2006, 10:36 PM   #7
diyAudio Member
 
keantoken's Avatar
 
Join Date: Aug 2006
Location: Texas
Blog Entries: 2
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.
  Reply With Quote
Old 19th November 2006, 11:03 PM   #8
MikeB is offline MikeB  Germany
diyAudio Member
 
MikeB's Avatar
 
Join Date: Apr 2004
Location: Gütersloh
Quote:
Originally posted by keantoken
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.
I don't think so... (If you really want to know the equation to generate sine, google for taylor series)

Mike
Attached Files
File Type: txt singen.c.txt (599 Bytes, 43 views)
  Reply With Quote
Old 20th November 2006, 01:43 AM   #9
diyAudio Member
 
keantoken's Avatar
 
Join Date: Aug 2006
Location: Texas
Blog Entries: 2
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
  Reply With Quote
Old 20th November 2006, 04:41 AM   #10
jcx is offline jcx  United States
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 work-alike 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

Click the image to open in full size.

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
Attached Files
File Type: txt sine_wav.asc.txt (753 Bytes, 53 views)
  Reply With Quote

Reply


Hide this!Advertise here!
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
SMPS to Pure Sine EUVL Power Supplies 2 11th June 2009 04:24 PM
Sine Wave Generator with bulbs (Sine-lightenment) 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 Multi-Way 12 4th July 2004 06:31 AM


New To Site? Need Help?

All times are GMT. The time now is 03:23 PM.


vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2014 DragonByte Technologies Ltd.
Copyright ©1999-2014 diyAudio

Content Relevant URLs by vBSEO 3.3.2