Shop OBEX P1 Docs P2 Docs Learn Events
WAV Player Jukebox - Revisited — Parallax Forums

WAV Player Jukebox - Revisited

John A. ZoidbergJohn A. Zoidberg Posts: 514
edited 2012-12-01 08:03 in Propeller 1
Hello there,

I have a christmas toy, which plays Christmas music and supporting a Christmas tree decoration made last year, which uses a PIC32MX and my parents really love it. However, the PIC32MX is small, and I can't fit an RTOS inside, so another microcontroller controlled the lightings. The Parallax Prop can do all these without pain, so I'm porting this to the processor.

The jukebox keeps playing songs, and move to the next song when the song is finished playing, and continued indefinitely. There are SD-Card functions on the MPLAB XC32 (MDDFS Library) which allows to move to next file automatically.

I've checked the OBEX for such similar function, but there's none. Anyone knows if there are "Find Next File" inside the SD-Card library?

Thanks.

Comments

  • MacTuxLinMacTuxLin Posts: 821
    edited 2012-11-28 07:06
    John,

    There an app for C3 "Music Box". I've not studied it yet but you think it'll fit your needs?

    Cheers
  • Ken GraceyKen Gracey Posts: 7,418
    edited 2012-11-28 11:30
    John, I have a whole project ready to be posted on our [new] web site that shows you how to do this. But the new web site is late, so that project is not yet posted....I can e-mail it to you in the meantime - just drop me a line. I think it'll help your SD card/WAV problems and should have you up and running quickly.
  • RaymanRayman Posts: 15,509
    edited 2012-11-28 12:56
    regarding "find next file"... the FSRW 2.6 code has this in the "nextfile" command...

    Here's a little code that lists the root directory contents:
      repeat   'try a few times to mount the SD card
        i:=sd.mount_explicit(SD_DO, SD_CLK, SD_DI,SD_CS)
        if i==0
           quit
        ser.str(string("SD mount failed"))
        waitcnt(cnt+clkfreq/4)
      ser.str(string("SD mount success",13))
      waitcnt(cnt+clkfreq)
      
      sd.opendir
      repeat
        i:=sd.nextfile(@fname)
        if i<0
          quit
        ser.str(@fname)
        ser.tx(13)
      ser.str(string("No more files",13))
      waitcnt(cnt+clkfreq) 
      return
    
    
  • John A. ZoidbergJohn A. Zoidberg Posts: 514
    edited 2012-11-28 19:26
    Ken Gracey wrote: »
    John, I have a whole project ready to be posted on our [new] web site that shows you how to do this. But the new web site is late, so that project is not yet posted....I can e-mail it to you in the meantime - just drop me a line. I think it'll help your SD card/WAV problems and should have you up and running quickly.

    Hello there, thanks for the support. I'll drop you a line sometime later this weekend. :)
    Rayman wrote: »
    regarding "find next file"... the FSRW 2.6 code has this in the "nextfile" command...

    Here's a little code that lists the root directory contents:
      repeat   'try a few times to mount the SD card
        i:=sd.mount_explicit(SD_DO, SD_CLK, SD_DI,SD_CS)
        if i==0
           quit
        ser.str(string("SD mount failed"))
        waitcnt(cnt+clkfreq/4)
      ser.str(string("SD mount success",13))
      waitcnt(cnt+clkfreq)
      
      sd.opendir
      repeat
        i:=sd.nextfile(@fname)
        if i<0
          quit
        ser.str(@fname)
        ser.tx(13)
      ser.str(string("No more files",13))
      waitcnt(cnt+clkfreq) 
      return
    
    

    Wow. Thanks for the tip. I should have read the object files thoroughly. :)
  • John A. ZoidbergJohn A. Zoidberg Posts: 514
    edited 2012-12-01 08:03
    Hello,

    I got one of these programs from OBEX, and it did play the WAV files flawlessly. However, the music from the speakers are weak and there is a lot of static. These speakers are bought from Carrefour and it's a normal cheap computer speakers with a jack.

    Should I need an amplifier and a filter in between? Right now I have a simple RC filter with only 1K resistor and 0.1uF capacitor as a filter.
Sign In or Register to comment.