Pages: [1] 2 3 ... 12   Go Down
Author Topic: * MP3 Shield * - Rogue Robotics rMP3  (Read 39909 times)
0 Members and 1 Guest are viewing this topic.
Toronto, ON
Offline Offline
Full Member
***
Karma: 10
Posts: 233
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

We're proud to announce our rMP3 Playback Module - An MP3 Shield.



Rogue Robotics rMP3 Playback Module

Here are some specs:
  • Arduino board compatible
  • Supports MMC/SD/SDHC
  • FAT12, FAT16 and FAT32 compatible - 8MB -> 32GB
  • Plays MP3, PCM WAV, and IMA ADPCM WAV files
  • 32 -> 320 kbps bitrates supported
  • 32 -> 48 kHz sample rates supported
  • Simultaneous playback and data access
  • Serial 2400 bps to 460800 bps
  • SPI control option (soon)
  • 5 volt operating voltage
  • RoHS Compliant
  • Read and write data files as well as audio playback


MSRP: CAD$59.99 (~USD$60 - 11/01/25)
(headers are additional CAD$5.00, unsoldered)

Info available here:
http://www.roguerobotics.com/

Check our distributors for availability.

Libraries/Projects/Examples available at:
http://www.roguerobotics.com/wikidocs/code/

b
« Last Edit: January 26, 2011, 10:05:12 am by bhagman » Logged


Toronto, ON
Offline Offline
Full Member
***
Karma: 10
Posts: 233
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's an example.  Playing a song and reading lyrics from another file at the same time.

[media]http://www.youtube.com/watch?v=NY__jMV5GRE[/media]

Code and more here:

http://www.roguerobotics.com/wikidocs/code/rmp3lyrics

b
Logged


North Yorkshire, UK
Offline Offline
Faraday Member
**
Karma: 104
Posts: 5531
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Apart from the most annoying song example (showed the lyrics example well though), that example is good. I like the quaility of this, that is why I am drawn to it.
Yes, I can have someone's vioce on a project with the wave shield but with this I can have their voice in 320kbs!

Are the lyrics done with reading a time on the song? That is rather cool!

Mowcius
Logged

Toronto, ON
Offline Offline
Full Member
***
Karma: 10
Posts: 233
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Heh... Daft Punk can have that sort of affect on some people.

The lyrics are read off of the SD card from a standard LRC file (which has times for each lyric).

b
Logged


North Yorkshire, UK
Offline Offline
Faraday Member
**
Karma: 104
Posts: 5531
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh yes, I obviously didn't read that bit very well

smiley-grin

Mowcius
Logged

North Yorkshire, UK
Offline Offline
Faraday Member
**
Karma: 104
Posts: 5531
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh, btw. Your link is broken on the rMP3 page:

Quote
Arduino™ is a trademark of Arduino Team
should link to arduino.cc presumably rather than:
http://www.roguerobotics.com/store/arduino.cc

Mowcius
Logged

Toronto, ON
Offline Offline
Full Member
***
Karma: 10
Posts: 233
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

ooops... thanks mowcius.  Fixed.  (I was wondering why there was a http:// lying on the floor next to my desk).

b
Logged


Toronto, ON
Offline Offline
Full Member
***
Karma: 10
Posts: 233
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

XMAS time...

This sketch randomly plays all the songs in a folder.  You can control the volume, play/pause/stop/next, and ff/rew using serial input (from the IDE).

Throw a bunch of your favorite holiday songs in a folder named "XMAS" on your SD card, stick it in the rMP3, and run the sketch.

I haven't got around to building a tree light sequencer to run at the same time as the songs are playing.  Maybe Grumpy_Mike will lend me his Tree-Sink.  ;D

Happy Holidays everyone!

b


Code:
#include <RogueSD.h>
#include <RogueMP3.h>
#include <NewSoftSerial.h>

NewSoftSerial rmp3_serial(6, 7);

RogueMP3 rmp3(rmp3_serial);
RogueSD filecommands(rmp3_serial);

int numberOfSongs;
int lastSong;
char path[96];

const char *directory = "/XMAS";


void setup()
{
  Serial.begin(9600);

  Serial.println("Merry Xmas!");

  rmp3_serial.begin(9600);

  rmp3.sync();
  rmp3.stop();

  filecommands.sync();

  // mix up our random number generator
  randomSeed(analogRead(0));

  // get the number of songs available
  strcpy(path, directory);
  strcat(path, "/");
  strcat(path, "*.mp3");  // we have to do this because the IDE thinks that "/*" needs to be terminated everywhere

  numberOfSongs = filecommands.filecount(path);

  lastSong = -1;
}



void playNextSong()
{
  uint8_t i;
  char filename[80];
  char path[96];
  int nextSong = 0;

  if (numberOfSongs > 0)
  {
    // Select our next song randomly
    if (numberOfSongs > 2)
    {
      do
        nextSong = random(numberOfSongs);
      while (nextSong == lastSong);
    }
    else if (numberOfSongs == 2)
    {
      // we only have two songs
      if (lastSong == 0)
        nextSong = 1;
      else
        nextSong = 0;
    }

    // now, get our file name from file list

    filecommands.opendir(directory);

    for (i = 0; i <= nextSong; i++)
    {
      filecommands.readdir(filename, "*.mp3");
    }

    strcpy(path, directory);
    strcat(path, "/");
    strcat(path, filename);

    rmp3.playfile(path);

    Serial.print("Playing: ");
    Serial.println(path);

    lastSong = nextSong;
  }
  else
  {
    Serial.println("No files to play.");
  }
}


void loop()
{
  char c;
  uint8_t i;
  int16_t newtime;

  playbackinfo playinfo;

  char status = 'S';
  uint8_t playing = 1;
  uint8_t volume = 20;
  uint8_t boostOn = false;

  volume = rmp3.getvolume();  // this only gets the left volume
  
  playNextSong();

  while(1)
  {
    while(!Serial.available())
    {
      // we should do fancy stuff like flash lights on our Xmas tree here!
      // got lots of time!
      delay(200);

      status = rmp3.getplaybackstatus();
      playinfo = rmp3.getplaybackinfo();

      if (status == 'S' && playing)
        playNextSong();
    }
    
    // OOH!! got a character!
    c = Serial.read();

    switch(c)
    {
      case 'p':
        // pause
        if(status == 'D')
        {
          // fade in
          rmp3.playpause();
          rmp3.fade(volume, 400);
        }
        else if(status == 'P')
        {
          // fade out
          rmp3.fade(100, 400);
          rmp3.playpause();
        }
        else
        {
          // start playing
          playNextSong();
          playing = 1;
        }
        break;
      case 's':
        rmp3.stop();
        playing = 0;
        break;
      case 'n':
        playNextSong();
        playing = 1;
        break;

      case 'e':
        if(boostOn)
        {
          rmp3.setboost(0);
          boostOn = false;
        }
        else
        {
          rmp3.setboost(8, 6, 7, 3);
          boostOn = true;
        }
        break;
      
      case 'a':
        // jump back 5 seconds
        newtime = playinfo.position - 5;
        if (newtime < 0) newtime = 0;
        rmp3.jump(newtime);
        break;

      case 'd':
        // jump forward 5 seconds
        rmp3.jump(playinfo.position + 5);
        break;
        
      case 'k':
        if(volume < 254) volume++;
        if(status != 'D') rmp3.setvolume(volume);
        break;

      case 'i':
        if(volume > 0) volume--;
        if(status != 'D') rmp3.setvolume(volume);
        break;

    }
  }
}
« Last Edit: December 18, 2009, 04:44:17 pm by bhagman » Logged


North Yorkshire, UK
Offline Offline
Faraday Member
**
Karma: 104
Posts: 5531
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
volume, play/pause/stop/next, and ff/rew using serial input (from the IDE)
Now it's getting interesting. (to be honest I probably should have read through the page in more detail)

This is definitely on my list and I may be able to get one soon if I get my other stuff free for sparkfun free day or I have to buy it...

Mowcius
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 12
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey Brett,

I'm currently trying to use the rMP3 shield with the DFRduino LCD Keypad shield. The problem is, while rMP3 uses digital pins 6, 7, 8, 11, 12 & 13, the LCD shield uses 5, 6, 7, 8 & 9. Therefore, I'd like to reroute pins 6, 7 & 8 to use pins 3, 4 & 10 by cutting the jumpers and wiring them up. So far, so good. The problem I have, though, is that I can't seem to work out how I'd let the C compiler know of the change. There aren't any obvious locations in the C file or associated header and I can't see any mention of this in the documentation. Could you please give me a clue as to how I would do this?

Thanks,
Lee
« Last Edit: April 07, 2010, 03:02:27 pm by Lazarus404 » Logged

North Yorkshire, UK
Offline Offline
Faraday Member
**
Karma: 104
Posts: 5531
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Does it really use all those pins?

I have not really delved into how it does what it does but I presumed that it just could use those other pins.

Isn't the communication via serial? In which case it would require 2 pins?

Also another question, I know that the LED on board (activity LED) flashes when music is playing and seems to brighten at corresponding points in the music. Is there any easy way to get audio values sent to the arduino so a visualiser could be done from it?

A bit more documentation would also be very nice :p

Mowcius
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 12
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think the documentation is actually pretty good. I wish there was a support forum, tho ;-)
Logged

Toronto, ON
Offline Offline
Full Member
***
Karma: 10
Posts: 233
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Lee - The rMP3 only uses 2 serial pins to communicate.  The SPI port is there as an optional way to control the rMP3, but the current version of firmware (100.01) hasn't got that implemented (expect it in the next version).

You figured out how to do the serial change though.  Just cut the jumper at pins 6 (rMP3 TX) and 7 (rMP3 RX), and reroute the pads to the new pins you want to use.  (make sure you connect wires to the pads FURTHEST of the two from the Arduino header).

The change in the code should be really simple.  Wherever you see:

Code:
NewSoftSerial rmp3_serial(6, 7);

change it to (in your case):

Code:
NewSoftSerial rmp3_serial(3, 4);

(I'm assuming that you changed pin 6 on the rMP3 to pin 3, and pin 7 to pin 4).

If that doesn't work, post your code and we can see what's going on.


mowcius - sounds like either you're listening to a VBR mp3 file (wide range one too!  32 kbps -> 320 kbps) and the music has really quiet and really loud spots, or your eyes are fooling you!  The data goes directly from the card to the decoder.   So, the only effect you'd see is if the MP3 frames had different bitrates.

RE: documentation, our wikidocs have always been public, unfortunately you had to register.  I've changed it now so that you don't have to register.  Just add any comments/questions you have on any page that has a discussion.

b
Logged


0
Offline Offline
Newbie
*
Karma: 0
Posts: 12
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you, Brett, that's awesome news. Having only two pins to worry about makes my life easier ;-)

Best,
Lee
Logged

North Yorkshire, UK
Offline Offline
Faraday Member
**
Karma: 104
Posts: 5531
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
mowcius - sounds like either you're listening to a VBR mp3 file (wide range one too!  32 kbps -> 320 kbps) and the music has really quiet and really loud spots, or your eyes are fooling you!  The data goes directly from the card to the decoder.   So, the only effect you'd see is if the MP3 frames had different bitrates.
I was indeed! I hadn't noticed that it didn't change with non VBR files. It was only on the loud bits that I got brighter flashes...

Any chance you could do the Input/Output Interface page on the wiki? smiley
The rest of the documentation does indeed look good, it has been a while since I have looked and I suppose I did not have a great look through.
I have just gone through and had a thorough read! Interesting stuff!

Now back to my previous question smiley
Quote
Is there any easy way to get audio values sent to the arduino so a visualiser could be done from it?
It is not a problem if not, it would just be interesting to do it without all the extra circuitry it usually requires.

Mowcius
Logged

Pages: [1] 2 3 ... 12   Go Up
Jump to: