A place users can post their projects. If you have a small project and would like your own dedicated place to post and have others chat about it then this is your spot.

User avatar
By Sprite_tm
#20758 armSeb: Mind sharing the code? I've been planning on getting the stereo synth to work myself, would be great to share efforts. Also, your solution is a very shaky one: it 'works' because of undefinded compiler behaviour: you're not supposed to not return something in a non-void function. You should be able to get the same behaviour in a 'valid' way by dramatically lowering the ADD_DEL_BUFFPERSAMP (to eg 5) or by disabling that functionality all together.

I2S input is something I'd like to show you, but at the moment my focus is somewhere else; also there's some internal hardware in developement that should be able to help us there but isn't finished yet. Please be patient, eventually we should get around to creating an example for it.
User avatar
By armSeb
#20787 OK, I'll try quickly the clean way ;)

I just made a vimdiff between the two synth files and made changes to get it compile. I don't know if I have to make some other modifications.

Here is my method to parse http headers :

Code: Select allint ICACHE_FLASH_ATTR getIcyMetaint(int sock) {
   int n, i;
   char buf[1];
        char wbuf[64];
   int icy_interval;

   memset(wbuf, '\0', sizeof(wbuf));
        i=0;
        while(1) {
                    n = read(sock, buf, 1);
                    if (n>0) {
                            if (buf[0]=='\n') {
                                    // If we detect a newline
                                    if (i>0)  {
                                           // printf(wbuf);
                                           // printf("\n");
                                             if(strncmp(wbuf, "icy-metaint:", 12)==0) {
                                                    icy_interval=atoi(wbuf+12);
                                                   // printf("%i\n",icy_interval);
                  return icy_interval;
                                            }
                                    } else {
                                          //  printf("Empty line\n");
                 // If this is an empty line : end of headers.
               return 0;
                                    }
                                    memset(wbuf, '\0', sizeof(wbuf));
                                    i=0;
                            } else {
                                    if (buf[0]!='\r') {
                                    //      printf("Appending data\n");
                                            wbuf[i]=buf[0];
                                            i++;
                                    }
                            }
                    }
   }
}


This is not the cleanest method but it works. To get icy metadata, you need to add the following header to your request :

Code: Select allwrite(sock, "\r\nIcy-MetaData: 1", 17);


Here is the stereo synth :

https://www.dropbox.com/s/l2i8ipkl7gwdoj4/synth_stereo.c?dl=1

But I only made basic modifications, to be able to compile it. I don't know ho I can get two pwm signals instead of one.