Shop OBEX P1 Docs P2 Docs Learn Events
play wav from eeprom — Parallax Forums

play wav from eeprom

stilgarstilgar Posts: 47
edited 2012-08-16 12:13 in Propeller 1
Hello,
I need to play a wav file that resides in the eeprom. its small (36K), and 1 sec long. Do to budget, and size constants, a SD card won't work. The wav would run simultaneously with a light controller.

Has anyone used a (64K) AT24C512B-PU EEPROM from ATMEL SEMICONDUCTOR?
Data sheet " https://www.jameco.com/Jameco/Products/ProdDS/276832.pdf "

stilgar

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-12-19 15:23
    I suggest you use a larger EEPROM like an AT24C1024B. This has 128K of EEPROM and is a plug-in replacement for the AT24C512B. You can store the .wav file in the 2nd 64K area and leave the 1st 32K for the Propeller program rather than using the 2nd 32K area of the AT24C512B and splitting off 6K or so to include along with your program.

    I think the only .wav players are designed to work with an SD card. You could easily substitute an EEPROM read routine for the SD card I/O, but I don't think there's any ready-made. I could be wrong though.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2010-12-19 15:53
    Ray Allen's demo, playWav_8bit.spin plays short WAV files directly from the program eeprom.
    http://obex.parallax.com/objects/324/
    Of course, it does eat up a lot of eeprom that you might need for the light contol program, and the file you mentioned is as it stands too large to fit. Could you sample it down to 8 bit at 8 kHz or 16 kHz? If not, Ray's demo is still a good template to start from. The line of code that reads a byte from program memory has to be split to read a byte from the external eeprom. With 16 kHz sampling, it has 62.5 microseconds from byte to byte.
  • stilgarstilgar Posts: 47
    edited 2010-12-19 17:16
    Hello,
    I have the wav player and circuit. Now the question is how do I download the wav file to EEPROM. does it just need to sit in the same directory as the .spin code, and automaticly downloads it to EEPROM?

    Also do I need to start the player as a newcog? If I understand it so far the light control program is in cog 0.

    thanks
  • RaymanRayman Posts: 14,826
    edited 2010-12-19 18:44
    There's a "file" command in the DAT section that tells the Prop tool to embed the wav file.

    You can just replace that filename with the name of your file...
  • AleAle Posts: 2,363
    edited 2010-12-20 08:26
    A SPI Flash would be much better because you can use a higher bit rate and don't worry about buffering... Maybe at 400 kHz it does not make any difference...
  • stilgarstilgar Posts: 47
    edited 2010-12-20 09:58
    Hello,
    new questions,
    I need to start the player in a new cog, (cog 0 is running a light controller). In the Ray Allen's demo, playWav_8bit.spin, which one of the PUB blocks do I put the cognew command?

    The wav file is 8 bit, 16Hz, Mono, what pin does the player use for mono? (P10 or P11)

    thanks everyone for the help
  • jcullins0jcullins0 Posts: 10
    edited 2012-08-15 16:30
    Mike wouldn't you need to select the upper 64 with an address line?
    Jim
  • jstjohnzjstjohnz Posts: 91
    edited 2012-08-15 23:17
    jcullins0 wrote: »
    Mike wouldn't you need to select the upper 64 with an address line?
    Jim

    The Basic_I2C_Driver object is compatible with the Atmel AT24C1024. Different masnufacturers use different addressing schemes for this size part, but the Atmel will work with the stock I2C object without any modification. I use the 1Mb chips in every prop project. For an extra $1 or so it's nice to have that extra 128K of eeprom to play with.
  • cavelambcavelamb Posts: 720
    edited 2012-08-16 05:53
    Work on the wav file a bit.

    I found Audacity 1.3 to be very helpful in changing audio formats and compression.
    My Ships Bells wav file went from 88k down to 14k minimum size (with several stops in between).
    The 28k 8 bit version still sounds great and fits, with code, in a single cog.

    The windows sign-on song came in at 29k. It takes about 3 seconds to complete.
    single cog.
  • jcullins0jcullins0 Posts: 10
    edited 2012-08-16 12:13
    Thanks Mike I will order some. Just assumed you would need to change address line, glad you don't
    Jim
Sign In or Register to comment.