Audacity sine generation

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
This topic might not be new. But the data to be shown are probably "new". The tools involved are USBStreamer, WM8740 DAC board, Audacity and WinAudioMLS.

A 1 kHz wav (Fs = 48 kHz) file was generated by Audacity. The file was analyzed by WinAudioMLS. 16k-point FFT with Rife-Vincent 4 window function was used to analyze the file. FFT plot is shown below.
 

Attachments

  • Audacity wav file analysiss.jpg
    Audacity wav file analysiss.jpg
    125.6 KB · Views: 116
In contrast to the above 16 bit, 48 kHz wav file, Audacity can also export 24 bit, 48 kHz wav file. FFT analysis of this wav file is shown below.

I also used AP2700 to generate a 1kHz wav file. In the utility, 24 bit and 48 kHz was selected. As can be seen, AP generated wav file is effectively a perfect 1 kHz sine.
 

Attachments

  • Audacity 24b 48k wav file analysiss.jpg
    Audacity 24b 48k wav file analysiss.jpg
    128.5 KB · Views: 103
  • AP 1k wav file analysis.jpg
    AP 1k wav file analysis.jpg
    128.5 KB · Views: 87
Hardware is now involved. Signal is loopback at I2S interface of USBStreamer. No ADC/DAC is involved.

WinAudioMLS ASIO signal generator plays wav file and also generates sine. It can be seen that AP generated wav file is still the best.
 

Attachments

  • WinAudioMLS ASIO SigGen Play wav files.jpg
    WinAudioMLS ASIO SigGen Play wav files.jpg
    378.9 KB · Views: 91
  • Loopback WinAudioMLS-Audacity-AP compare.jpg
    Loopback WinAudioMLS-Audacity-AP compare.jpg
    131.9 KB · Views: 87
you're just looking at digital sines - the "hardware" to move the bits will always be "perfect" - or the digital interface is simply broken - no need to look at -170 dB distortion to see that

you should be able to select dither for the Audacity sine too - although they use a frequency shaped differentiated dther
 
Hi,

I've played a lot with software sine generation in the past and indeed not all programms allow you to go theoretical and practical limits of purity. I've never used Audacity, though.

All I can say for x86(PC)-based systems that the math operation of the FPU (floating point unit of the CPU) is NOT the culprit. I was able to get perfect 24bit precision using the old Turbo-C compiler, from way back in the early 90'ies.

I also anaysed 64-bit double precision floating-point output from the FPU with FFT working in the same domain and found the results to be free of any worries. Without dithering this allow one to better see some aspects of sine generation.

It's best to use exact FFT bin center frequencies only so you don't need any windowing and you may use synced averaging.

You may need to trick the software by setting the sample rate to the FFT size (65536Hz for a 65536-pt. FFT) so that bin frequencies are integer and spaced "1Hz" apart (but scaled). Then overwrite the samplerate field in the ouput with desired value, the ratio determining the scale factor to be used.

You want to avoid the repetition of identical value sequences within one FFT block, therefore the "unit frequency" (bin number) should not contain any factors of two (assuming a 2^N FFT block size). TThat's the reason for the 997Hz used with 48kHz. 1kHz would loop one very short 48 samples block all the time.

This sort of maximally self-dithers the values but additional dithering should be used when going to integer 24 or 16 bit output. Here the period of the random generator used for the dithering should also be non-related to FFT size and notably much larger.
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.