Go Down

Topic: * MP3 Shield * - Rogue Robotics rMP3 (Read 44 times) previous topic - next topic

jennyc

Is it just those to pins that need to be soldered down? Or am I ok to have all of them soldered to the same pin on the uno board?

I don't have access to my soldering iron at the moment, will be back with it tomorrow. I will double check 6&7 ?and the rest? of the pins, and will let you know how it works from there.

Thank you for your help

Jenny

bhagman

No problem!

Yeah, just need to make sure 5V, Ground (GND), and pins 6 and 7 are well soldered.  Those are the only pins that are used.  If you have the pins soldered, it's just as good - just more work. :)

b

jennyc

Turns out that was the problem.

Its working now. =D Thank you very much.

Away off to read about using the getspectrumanalyser() to get the rmp3 giving the arduino a value, so that an output can be created depending on the value. That sound about right?

Thanks again

jennyc

#178
Jan 21, 2011, 03:44 pm Last Edit: Jan 22, 2011, 12:12 am by jennyc Reason: 1
Hi

edit::

Sorry, I have just looked back and seen that I pasted the wrong code, I just pasted yours, oops.

I was using your code as a base for mine.

I think I have got to a point where it should be analysing the code, but I am not sure as to what each part of your original code actually does. I have tried to edit it with the code to play from the folder /mp3/ and the audio is not playing, but have had a version where it did only play my song gold.mp3.

From what I can tell from your code, mine should now be analysing for 3 different bands, and sending it back to the arduino. My problem is now, I am not sure how to change this from the lcd output, to just have a different arduino output turned "on" when each frequency returned.
Code: [Select]
#include <SoftwareSerial.h>
#include <RogueMP3.h>
#include <RogueSD.h>

SoftwareSerial rmp3_s(6, 7);

RogueMP3 rmp3(rmp3_s);
RogueSD filecommands(rmp3_s);

uint16_t bandfreqs[] = {  120,  2000,  20000 };

uint16_t numfiles = 0;

#define MP3PATH "/mp3/"
// you need to put the two double quotes ("") in the middle below,
// because the Arduino IDE looks for unclosed comments.
#define MP3FILTER "/mp3/""*.mp3"


void doFREQSpec(void)
{
 // prepare for up to 3 bands
 uint8_t v[3];

 rmp3.getspectrumanalyzer(v);

}

void setup(void)
{
 Serial.begin(9600);
 Serial.println("Started");
 Serial.println("Starting sync");
 rmp3.sync();
 filecommands.sync();
 Serial.println("Done sync");
 
}


void playTrack(void)
{
 char mp3path[128];

// ...

 rmp3.playfile(mp3path);

 rmp3.setspectrumanalyzer(bandfreqs, 10);

 Serial.println("Playing");
}

void loop(void)
{
 
}


Currently my code is stuck on the syncing. I will keep trying to get this working with the folder, but as a failsafe, I have it working with a single track.

Is there a specific part of the documentation that I can read, or a direction you can point me in on how to translate this back to an arduino output?

Thanks

Jenny

bhagman

@jennyc:  Here is an example I wrote.  In my case, I am using a LEDHead with LEDs to display output.

Code: [Select]
#include <RogueMP3.h>
#include <NewSoftSerial.h>

NewSoftSerial rmp3_s(6, 7);

RogueMP3 rmp3(rmp3_s);

#define numberOfBands 3
uint16_t bandfreqs[] = { 120, 2000, 20000 };
//uint8_t outputPin[] = { 2, 3, 4 };
uint8_t outputPin[] = { 29, 30, 31 };

#define THRESHOLD 12

#define songname "/001.mp3"


void checkFrequencies(void)
{
 // prepare for up to 23 bands
 uint8_t v[23];

 rmp3.getspectrumanalyzer(v);

 for (uint8_t i=0; i<numberOfBands; i++)
 {
   if (v[i] > THRESHOLD)
     digitalWrite(outputPin[i], HIGH);
   else
     digitalWrite(outputPin[i], LOW);
 }
}


void setup(void)
{
 Serial.begin(9600);
 Serial.println("Started");

 rmp3_s.begin(9600);

 for (uint8_t i = 0; i < numberOfBands; i++)
   pinMode(outputPin[i], OUTPUT);

 Serial.println("Starting sync");
 rmp3.sync();
 Serial.println("Done sync");
}


void playTrack(void)
{
 Serial.println("Playing Track");

 rmp3.playfile(songname);

 rmp3.setspectrumanalyzer(bandfreqs, numberOfBands);
}

int8_t isPlaying(void)
{
 return (rmp3.getplaybackstatus() == 'P' ? 1 : 0);
}


void loop(void)
{
 if (!isPlaying())
   playTrack();

 checkFrequencies();
}


You'll definitely have to have different thresholds for each band, since they will have different responses.

b

Go Up