Show Posts
Pages: 1 ... 3 4 [5]
61  Using Arduino / Audio / Re: New library for PWM playback from SD cards: SimpleSDAudio on: July 26, 2012, 01:49:30 pm
The wiring is described on the website. If you are using a shield already for SD card connection, all you need is a capacitor (take anything you get between 100nF and 100uF), connect positive end of capacitor to Arduino-Audio-Outputpin (as described in library documentation) and connect the other to your active speaker/line in. Then also connect GNDs of active speaker/line in and Arduino and you are done. That way you can play back the example file or any other files converted to MONO and FULLRATE or HALFRATE.
62  Using Arduino / Audio / Re: Advantages of DAC over PWM for synthesizer tone generation? on: July 26, 2012, 01:45:02 pm
Hi, one important advantage of a DAC over PWM is that you can filter the supply of the DAC from digital noise generated by the rest of the circuit. Therefore if you want good noise performance it is often easier to use a DAC. Some time ago I've build a synthesizer with the MCP4922 or MCP4921 which gave 12-Bit audio quality. Now I know that you can also get good results just by combining two 8-Bit-PWM-Outputs to one 16-Bit-Analog-Output. This can be done very cheap using only a few resistors.

And if you even wonder how CD-quality DACs nowadays work: Not with PWM and 3 GHz but also just with 1 Bit that is clocked often in a region of 10-20 MHz. The magic is not using a counting-ramp like PWM does but using a more intelligent solution called Delta-Sigma-Modulation that could be seen as some kind of dithering.

 
63  Using Arduino / Audio / Re: New library for PWM playback from SD cards: SimpleSDAudio on: July 20, 2012, 10:07:43 am
Hi,

the buzzing sound can come from anything on the Arduino or stuff connected to it. I don't think that you can get rid of it just by optimizing the software - increasing sample rate will not change things. The quality out of the PWM is already superior, but get's damaged by the noise on the supply lines.
Therefore as I proposed before try to use something that "isolates" the digital PWM lines from power source. Use a buffer or a level shifter. Then filter the supply for that level shifter very thouroughly  using an own linear regulator or at least a serial resistor with a capacitor to gnd between VCC-digital and VCC-analog.

Regarding 4channel mode: If I translate the interrupt function to assembler then it should be possible to have enough computing power for stereo 16 bit playback...

Regarding pre-load: The function setFile stores internally something about the file in a small structure. By using that struct it should be possible to playback any file with very little latency. Maybe I will add this feature later to the library.
64  Using Arduino / Audio / Re: New library for PWM playback from SD cards: SimpleSDAudio on: July 16, 2012, 05:02:41 pm
No, I have not changed the library yet. Maybe I will do it later after documenting it better - you only need the new batch file. We should try level-shifters or buffers (anything that is very cheap and easy available) to improve the sound (should be placed between Arduino outputs 9/10 and resistor stuff. 
65  Using Arduino / Audio / Re: Play .wav file from SDcard (ethernet shield) on UNO on: July 16, 2012, 04:56:56 pm
Are you sure that all your files on card are completely non-fragmented? Try the following: Copy all files from card to PC, format card using a full format (not quick-format), copy the files back from pc to card. also avoid having long file names and directories on card.
66  Using Arduino / Audio / Re: New library for PWM playback from SD cards: SimpleSDAudio on: July 16, 2012, 04:47:52 pm
Hi,
now I tried the 16-bit thing with the R256-R DAC and it gives a big advantage. It is not as good as you would expect from 16-Bit because it is hard to get rid of all those digital noise in such a circuit. The problem with all those circuits is to keep away the digital noise from supply from audio output. As long as a digital output pin that is supplied from uC is used, you also hear all the uC noise. Maybe it gets better if you decouple the uC better or use something like a buffer. But simply said, using just those two additional resistors you get rid of those hiss noise. After playing a little bit around it seems that most noise comes from the USB port - maybe you get acceptable results by using battery power.

What I did is the following: I set the following mode in software:
Code:
SdPlay.init(SSDA_MODE_HALFRATE | SSDA_MODE_STEREO)

Then I prepared my file with the following modified batch-file:
Code:
@echo off
cd %~dp0
mkdir converted
FOR %%A IN (%*) DO sox %%A --norm=-1 -e unsigned-integer -b 16 -r 31250 -c 1 -t raw "converted\%%~nA.ahd"  
pause

Connections I made:
Code:
Pin 9  ----[220k]------+
                       |  100nF
Pin 10 -[1k trimmer]---+---||----[10k]--AudioOut--[1k]--GND

With trimmer the sound can adjusted for minimum hiss, I prepared also a special audio-file for easier trimming.
67  Using Arduino / Audio / Re: New library for PWM playback from SD cards: SimpleSDAudio on: July 13, 2012, 02:05:26 pm
Hello,

1)
it would work with 20 MHz, but not better regarding stereo playback at full rate, because this is just a matter of free cycles. But with 20 MHz fullrate will be 78kHz, so just a little better. I think the next improvement I will make is to use a 256R-R network to go from 8 bit to 16 bit with just another port and 3 resistors.

2)
I don't find the circuit for the audio output. Increasing bit resolution is always about decreasing PWM frequency, the only way around is to use either a AVR with high-speed PWM (like Elm-Chan did with ATtiny85) or combining two PWM outputs.
68  Using Arduino / Audio / Re: Play .wav file from SDcard (ethernet shield) on UNO on: July 13, 2012, 10:12:31 am
Hi, as long as you only want to playback one file at a time, my SimpleSDAudio library will do the job without an additional DAC. The library also contains an example where you can select the audio file via a web-interface using the Ethernet-Shield. But for this library you need to convert the .WAV-files to a different format before putting them onto SD card.

You can try to change the library that it supports playback of multiple files at a time, but the slow SPI to SD card (also used for Ethernet shield...) is the limiting bottleneck. In lower quality it could be possible to play 2 or 3 files at the same time.
69  Using Arduino / Audio / Re: Detect sound using Mic !! on: July 11, 2012, 02:19:32 pm
Hi, you need a microphone with pre-amplifier, ready for use with Arduino is this one: http://www.dfrobot.com/wiki/index.php?title=Analog_Sound_Sensor_%28SKU:_DFR0034%29

The simplest way to detect sound events like clapping reliable is to add a few hundreds to thousands times the analog value of the mic to a variable. If the result is over a certain threshold, you could trigger something.

Code:
void loop()
{
  uint32_t value = 0;
  for(uint16_t i=0;i<10000;i++) {
    value += analogRead(0);  // Change 0 to your mic-input
  }
  Serial.print("Sound level = ");
  Serial.println(value);
  if(value > 10000UL) {
    Serial.println("Sound detected!");
  }
}
70  Using Arduino / Audio / Re: New library for PWM playback from SD cards: SimpleSDAudio on: July 09, 2012, 01:23:52 pm
I also thought about that, but the thing is that it is hard to get a high quality playback if PWM runs not at an integer multiple of the sample rate. That is the magic behind my library and that is why I can get such good quality. With high-speed PWM as available in ATtiny85 then it makes more sense to use the original playback rate (as Elm-Chan does).
71  Using Arduino / Audio / Re: New library for PWM playback from SD cards: SimpleSDAudio on: July 08, 2012, 10:40:08 am
Yes, you have to convert the files, but for Windows users the conversion is a simple drag'n'drop operation of the wav-file to a batch-file. I also show a very simple and cheap approach to build an SD-card adapter just from two standard pin-headers.
 
72  Using Arduino / Audio / Re: New library for PWM playback from SD cards: SimpleSDAudio on: July 03, 2012, 02:25:46 pm
Forgot the link: http://hackerspace-ffm.de/wiki/index.php?title=SimpleSDAudio
73  Using Arduino / Audio / New library for PWM playback from SD cards: SimpleSDAudio on: July 03, 2012, 02:24:52 pm
Hello,
I like to promote my new library which makes playback of audio from SD cards very simple. The audio quality is 8-bit, but a PWM frequency of 62.5 kHz is used which gives decent sound quality at very low effort. The library is completely free, fully documented and includes some example projects for quick start. Enjoy, feedback here if you like it.

Edit/New: I updated the library (ported the core output part to hand-optimized ASM) and now also 16 Bit audio output (even in stereo) is possible (combining two PWM outputs using 2 resistors, known as 256R-R-network).

Edit/New: I updated the library again and now you don't have to call the .worker() function anymore if you provide a flag at init. Also added more examples like a doorbell with ding-dong sound as well as an example that shows file access from SD card using this library.

Regards,
Lutz
Pages: 1 ... 3 4 [5]