Show Posts
Pages: [1] 2 3 ... 23
1  International / EspaƱol / Re: Mensajes de audio con Arduino, un sistema barato [INFO] on: November 16, 2013, 08:24:34 pm
Usa um RC low pass filter antes de lo altavoce, para limitar la maioria de los artifactos de lo PWM.
Se quiseras, hay postado algo sobre PCM and WAVE, de lo puento de vista de microcontroladores. Solo la introducion a elos... Mas para venir...
Quicas es util para vosotros..
http://dubworks.blogspot.co.uk/2013/11/wav-file-format-and-brief-intro-into.html
*perdona mi espanol smiley
2  Using Arduino / Audio / Re: How to play Raw audio? on: November 16, 2013, 08:03:22 pm
No experience in streaming data online, but if you have the chance to choose the data format you have a few options...
WAVE PCM 8 bit is unsigned( probably the easiest and lighter to implement on a uC ( good for speech); 16 bit unsigned if you need more quality. Anything else might be a bit too much to handle in real time, specially if the sound is not the main aim of your project/code.
Or just PCM , given the chance, of course !
I started documenting the WAVE format from an embedded pont of view, as an option to an add-on for one of my projects.... Gives you a good insight into other related formats as well  AVI, RIFF and compression related ones, etc.
Hope it comes handy !
http://dubworks.blogspot.co.uk/2013/11/wav-file-format-and-brief-intro-into.html
3  Using Arduino / Audio / Re: Can Arduino Be Set Up As an Audio Interface in Windows? on: November 16, 2013, 07:53:33 pm
Youd have a lot of problems ... Most audio standards are quite heavy on calculating and sample  if you wanted inputs), heavy on storage and the only lighter ones unbalance things by having compressed formats . You could always do everything on 8 bit unsigned PCM  16 bit is signed already and you dont want to get into IEEE Float format ): ).
Dedicated chips, deffo the way to go ! Unless you want to build a proof of concept. Then go for it !
There is a usb serial audio input with the DUE Forum post, somewhere ( was developed for an oscilloscope if my memory serves me well). But im gonna guess youd still have to deal with the PC processing of things in some way, plus deal with the encoding format youd be using.
As i said, id go for a dedicated chip, unless you want to study it , proof of concept or similar...
4  Using Arduino / Audio / Re: Adding ADSR to wavetable synth...? on: November 16, 2013, 07:44:56 pm
With the 8 bit series you can implement a linear, proper ADSR without many problems  rule of thumb, unless you already pushing it far); With DUE, you can take into the realms of looping inside the sustain stage, exponential attack stage, and a few more quirks not so easy with the 8 bit series, specially if you're aiming at a more complex synth module.
As Duane said , usually its done by one multiplication against a value based on an accumulator to keep track of where the ADSR is or whatever way you might find to do this).
Use the proverbial ADSR graph as a guide for a clearer understanding, if you havent already !
http://en.wikipedia.org/wiki/File:ADSR_parameter.svg

* Duane's posts are brilliant to guide you into the basic building blocks, plus saves you some hassle with the intricacies of the hardware.
I have been doing some posts on it, several different ideas, some of the classic methods, etc but not much of a finished working code posted as yet( just exemplifying, more on a reading style not optimized as was written for better understanding of the concepts i was trying to demonstrate in each of them; kind of building blocks stages, one by one).
I been trying to document as much as i can, so i can share it and hopefully help others save some time, where i didnt smiley
http://dubworks.blogspot.co.uk/
5  Using Arduino / Audio / Re: IIR Sine wave generation on: November 16, 2013, 07:32:11 pm
Nice one.... Been looking into all the discrete implementation methods for sines/cosines ( approximations inclusive) and hadn't looked properly into this method yet.
Thanks for sharing !
6  Using Arduino / Audio / Re: Arduino DDS Sinewave Generator on: November 16, 2013, 12:24:45 pm
If you dont need much accuracy, you can count time using many other methods... Interrupts being one of them ?! If not, there is always the option of a real time clock chip  ?! Or the proverbial 32.768 kHz crystal, to keep the time? I think it depends how accurate you need it to be !

PS: Actually, the interrupt on the code is quite close... Every 31250  Clock Interrupts, will be  a second, 15625 half a second, and each interrup 0.000032  of a second... A millisecond will be 31.250(31+1/4) and 125 will, make exactly 4 millis...
7  Using Arduino / Audio / Re: Arduino Realtime Audio Processing on: November 10, 2013, 09:00:35 am
Mike is probably right, as usual...
my guess would also go on...Maybe the wrong board/chip?!
As far as i remember that specific example will work on atmega 328, 168 and previous compatibles( 8, etc).
Even to use with the mega 2560 there might be the need for slight alterations in order to port the code( dont quote me on this, for this particular  example you mentioned though... Havent looked at the code for a while) , but am sure it does compile and work on the Uno/328,etc.
8  Using Arduino / Audio / Re: Arduino Realtime Audio Processing on: October 28, 2013, 03:35:24 pm
DC_Offset in this code is the Offset value used to make it a ONLY POSITIVE values for the pwm ( as its easier to work with this kind of signal calculations mimicking nature's laws ... ) As PWM will only work with values up to 255 the middle point is 127( a wave travels between +1 and -1 , with ZERO being the middle point). Does that make more sense ?! So DC_Offset is the value that offsets the result into a positive number( or zero), which is also the same as the value for the amplitude calculations( did you notice is also 127?! dc_offset +127= space wherethe wave will travel...its a cheap way of calculating it in the discrete domain ).
Hope it helps!
I tried to break down some of the techniques here. Hope it helps complement it a bit !
http://dubworks.blogspot.co.uk/p/blog-page.html
9  Community / Exhibition / Gallery / Re: Problem : Write a decimal to Roman Numerals Converter on: October 28, 2013, 03:18:15 pm
I know ! I took it as an attempt to take the seriousness out of it !
Code:
tocipher[il]=in;
would have been enough. I have a perverted sense of humour !  smiley-cool
Hence the mention, "despite working dont take the code too serious ! Im not the best coder when it comes to clean code, but i aint that bad either ! smiley-mr-green
10  Community / Exhibition / Gallery / Re: Problem : Write a decimal to Roman Numerals Converter on: October 28, 2013, 10:40:48 am
I know !! And how it jumps from one side to the other, when it could have been so much simpler !  smiley 
11  Community / Exhibition / Gallery / Problem : Write a decimal to Roman Numerals Converter on: October 27, 2013, 08:55:54 pm
Problem : Write a decimal to Roman Numerals Converter
I had kept my eye on this weekly programming contest for a while, but only now rushed in to apply with some code.
 And  im quite sure i was the first to apply with a working project ! At what cost ?!  smiley-roll-sweat Check the code for yourself !!  smiley-cool
It does work, and thats what matters !
To take away that seriousness associated with programming ! smiley

http://dubworks.blogspot.co.uk/2013/10/arduino-decimal-to-roman-numerals.html
12  Using Arduino / Audio / Re: How to do a DDS synth on Due with multiple waves. on: October 22, 2013, 10:28:28 am
This might help !
With a good explanation of different methods and ways of implementing it.
http://dubworks.blogspot.co.uk/p/blog-page.html
13  Using Arduino / General Electronics / Re: Potentiometers in parallel: can I do it? on: October 21, 2013, 05:49:56 pm
I find this circuit simulator quite useful so, so ( oh so) often!!
http://www.falstad.com/circuit/
14  Community / Exhibition / Gallery / Re: "Caesar cipher" with Arduino Pt.1 on: October 21, 2013, 05:33:05 pm
A more user friendly version of the code.
As this subject includes maths as well, id guess this would be perfect for a subject in younger users workshops !
Code:
//              "CAESAR CIPHER"
//   A simple "CAESAR CIPHER"ing project - http://dubworks.blogspot.co.uk/
//  Number_of_Characters = 96
//  [ from "ascii'" character number 32-decimal; 040-OCT; 20-HEX; 00100000-BIN ==> "SPACE"
//  to "ascii'" character number 126 decimal;  176-OCT;  7E-HEX;  01111110-BIN; ==> "~" Equivalency sign - tilde
//
//  Caesar cipher ==> C=(P+s) Mod (Number_of_Characters)
//  P = numerical equivalent of character plaintext
//  C = Numerical equivalent of ciphertext character
//  s = number of shifts/adds
//  Ke== Enciphering Key
//  Kd== Deciphering key
//  Ke= s = 3 ==> (P+s) mod (Number_of_Characters)
//  Kd = -s = -3 ==> (C  -s)mod (Number_of_Characters)
//
//
//
//   For more on Caesar cipher - http://en.wikipedia.org/wiki/Caesar_cipher
//
#define Nchars 96  //  starting at 32 up to 126 in the ascii table
#define n_shift 3  //  shift desired
//
char plaintext[]=
{
  "Arduino to cipher this#"};
//  'A','r','d','u','i','n','o',' ', 't','o',' ','c','i','p','h','e','r',' ','t','h','i','s', '#'};
//
char ciphered[sizeof(plaintext)];
//

boolean stringComplete = true;  // whether the string is complete

void setup() {
  // Insert your setup code here, to run once:
  Serial.begin(9600);
}

void loop() {
  uint8_t i;
  //   Serial.println(sizeof(plaintext));
  //   Insert your main code here, to run repeatedly: 

  while(Serial)
  {
    if(stringComplete==true){
      Serial.println ("Arduino Caesar Cipher v1");
      Serial.println ("");
      cphr();
      //
      //
      Serial.println(" ");
      //
    }
  }
}

void cphr()
{
  uint8_t sizeofarray = sizeof(plaintext);
  uint8_t i;
  //
  for(i=0;i<sizeofarray;i++)
  {
    uint16_t retrieved;
    retrieved=plaintext[i];
    if(retrieved == 0){
      ciphered[i]=0;
      Serial.print("i- ");
      Serial.println(i);
      Serial.println("null CHARACTER ");
      // The use of goto's is highly frowned upon...
      // ...but can be quite handy as well !
      goto bailout;
    }
    Serial.print("P original- - ");
    Serial.println(retrieved);
    //retrieved -=32; // Subract Ascii_offset
    Serial.print("P - Offset = ");
    Serial.println(retrieved-32);
    uint16_t c =((retrieved-32) + n_shift)% Nchars; // check blog post for more info on this   
    Serial.print("C original - ");
    Serial.println(c);
    c +=32; // add the Ascii_offset
    Serial.print("C + Offset = ");
    Serial.println(c);
    ciphered[i]=c;
    //
    Serial.println(" ");
    Serial.print("i- ");
    Serial.println(i);
    Serial.println(c);
    Serial.print("C_array- ");
    Serial.println(ciphered[i]);
    Serial.print("Alphaarray- ");
    Serial.println(plaintext[i]);
    delay(50);
  }
bailout://  :)
  displayResults();
  stringComplete = false;
}

void displayResults(){
  //
  uint8_t i;
  uint8_t sizeofarray = sizeof(plaintext);
  Serial.print("plaintext to encipher- ");
  for(i=0;i<sizeofarray;i++)
  {
    Serial.print(plaintext[i]);
    delay(10);
  }
  Serial.println(" ");
  Serial.print("Ciphered_array- ");
  for(i=0;i<sizeofarray;i++)
  {
    Serial.print(ciphered[i]);
    delay(50);
  }
}




15  Using Arduino / Audio / Re: Send Audio data to PC via Serial/Network on: October 21, 2013, 01:03:38 pm
Was gonna say the same : That wont solve your problem of sampling the data outside and getting it into the rpi. If anything id say it will be more complicated if you have to do it from scratch, from my experience !
Pages: [1] 2 3 ... 23