2015-08-30 11:03 AM
Hi, as specified in the topic, I'm trying to create my own wave file player using f4-discovery board. I've managed to configure the DAC, read the file, find the data section, read the samples and I can hear the sound, but it's full of noise. I can hear very clearly the high tones, such as flute and guitarre, but the rest sound frequencies are distorted. There is almost no bass.
The files have 2 channels, with 16bit samples and sample rate 44100Hz. I use both channels of DAC, using 12bit left aligned registers and conversion triggered by TIM7. The samples before conversion are increased by 32768 in order to get an unsigned value. The output buffers are turned on. The output is driving an external amplifier which drives headphones. I've tried to use the Li-Poly battery to power the board and its still the same. I've checked if the sample buffer is filled faster then the currently used buffer and it is. I don't have an oscilloscope at hand so I can't tell anything more. Do I do anything wrong or it's hardware fault? Here's my code: DAC triggering timer IRQHandler: DAC configuration: (params: dac_dual_channel_simultanous, dac_trigger_tim7, true) Thanks in advance for any reply. #dac #stm32f4-discovery2015-08-30 12:47 PM
Doing it one sample at a time with a bunch of modulus operations doesn't seem at all efficient. Surely you could send a block of data as a 32-bit pair directly to the DACs in one operation via DMA, with the DAC triggered by a TIM. Fill the buffer half at a time during the HT and TC interrupts.
Suggest you do it without the file system, send a sine-wave form of various frequencies and confirm that seems to perform as expected.