diyAudio

diyAudio (http://www.diyaudio.com/forums/)
-   Equipment & Tools (http://www.diyaudio.com/forums/equipment-tools/)
-   -   Audacity sine - Is this good enough? (http://www.diyaudio.com/forums/equipment-tools/90605-audacity-sine-good-enough.html)

keantoken 19th November 2006 01:36 AM

Audacity sine - Is this good enough?
 
2 Attachment(s)
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

MikeB 19th November 2006 01:16 PM

2 Attachment(s)
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

MikeB 19th November 2006 01:23 PM

2 Attachment(s)
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

MikeB 19th November 2006 01:39 PM

2 Attachment(s)
And the wave file created with goldwave...

keantoken 19th November 2006 07:33 PM

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

MikeB 19th November 2006 11:20 PM

2 Attachment(s)
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

keantoken 19th November 2006 11:36 PM

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.

MikeB 20th November 2006 12:03 AM

2 Attachment(s)
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

keantoken 20th November 2006 02:43 AM

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 :bawling: ). I know more about mathematics than others may see, even though I make a lot of errors sometimes.

:cheers:
-agent_keantoken_signing_out

jcx 20th November 2006 05:41 AM

2 Attachment(s)
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

http://img.photobucket.com/albums/v252/f5r5e5d/wav.png

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


All times are GMT. The time now is 08:27 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