Shop OBEX P1 Docs P2 Docs Learn Events
Wave File Player with RS232 console + XModem — Parallax Forums

Wave File Player with RS232 console + XModem

Simon AmplemanSimon Ampleman Posts: 19
edited 2006-12-03 23:20 in Propeller 1
Hello,

· I just finished something really useful for anyone that want to start integrating different files into the propeller.

You compile the software inside the propeller and then you open a terminal software (I suggest TeraTerm) at 57600. You hit CTRL+C to see the menu. Right now it asks between Play the Wave file from EEPROM or Upload a new Wave. If you select Upload, the software waits for a file transfer using XModem CheckSum 128 bytes packet protocol to make sure the file is not corrupted by transfer error. I jump the first page of the 24FC512 and start to write each Xmodem packet (128 bytes) inside the EEPROM before acknowledging for the next packet to come. After the transfer, I write on the first page the size of the file in the first two bytes. If you select play, the software will read the first two bytes to know how big is the file to read and put the data in RAM, since the propeller is limited in RAM and I did not used any external ram for this first version, the wave file is limited to 25k. Then, it will decode the fmt chunk of the wave file showing you the Compression Code, The numbers of channel and the sample rate. Finally, if the file is using Uncompressed, 1 Channel, 8000hz it will play it on Pin 3.

This software can be used to send other kind of file (midi, nes music, rom... ) on EEPROM and then you can code the software to work with them.

Since 25K is too much limited, I will add external RAM as soon as I find how to avoid using all the 32 pins of the propeller to connect one. Would an IO expander be fast enough to stay near nanoseconds access time? I don't think so... Anyone is familiar with external RAM?

For the EEPROM, I also have plan to change it to a SD Card so we can work with megabyte of data instead of 64k, I ordered the socket last week, so I will find out the way to connect it and I will write my own FAT driver which will minimize the cost of buying a DOS-on-chip or others chip like that...

By the way, the WAVE player works but sounds bad. I wrote a DAC using the PWM... There is probably something missing or an error in my Wave Player function (only 3 spin lines) because there is a kind of very high tone over the output and I approximated the period of 8000hz by ear because my calculation gave a slower output. I will probably buy the HYDRA book to understand how to do that or wait for·audio·object made by someone. Also the source code is not yet separated into individual objects (one for xmodem, one for wave player..) but this is because the project will change too much in the weeks to come.

The XModem·is a good start since it's was a very easy protocol to implement.... I also plan to code the better XModem version (1k packet, CRC 16 bits)... Since this will be very useful soon or later to get stable transfer using RF, Infrared or very fast wired communication to conserve file integrity.

Have a nice day!

Simon

Comments

  • nutsonnutson Posts: 242
    edited 2006-12-03 12:34
    Simon,

    Thanks for the program, very usefull. I would love·to see it evolve·into·a·more general data transfer function PC->prop with a variety of·data storage possibilities (EEprom, flash, external RAM). Two remarks;
    - could you also upload a valid demo .WAV file, I don't seem to have one
    - the "serial" object uses a·"timing" object for delay functions, which was not in the archive or my library. I found it somewhere in other downloads.

    Regards,

    Nico Hattink
  • Simon AmplemanSimon Ampleman Posts: 19
    edited 2006-12-03 17:05
    Nico,

    ·· Thanks for your remarks. Here is a new archive with all files + a test WAV file and the Delay object removed from FullDuplexSerial (test last week, sorry for that).

    You are right with the evolution of this software, I will follow this direction.

    Have a nice day,

    Simon
  • Ym2413aYm2413a Posts: 630
    edited 2006-12-03 23:20
    Oh cool.
    This looks neat.

    wink.gif
Sign In or Register to comment.