Go Down

Topic: probelm in VS1003 (Read 34 times) previous topic - next topic

leo_elec

Hi,
this is my first topic in this forum.
I want to play music with arduino,So I use vs1003 module.
And I download this library from github:
https://github.com/andykarpov/VS1003
It works correctly in case of HelloMP3 array.
and here is HelloMP3 hex array of music:


Code: [Select]
unsigned char HelloMP3[] = {
  0xFF,0xF2,0x40,0xC0,0x19,0xB7,0x00,0x14,0x02,0xE6,0x5C, /* ..@.......\ */
  0x01,0x92,0x68,0x01,0xF1,0x5E,0x03,0x08,0xF0,0x24,0x80, /* ..h..^...$. */
  0x05,0x9E,0x20,0xC6,0xFC,0x12,0x32,0x5C,0xBF,0xF9,0xB9, /* .. ...2\... */
  0x20,0x4A,0x7F,0x85,0xEC,0x4C,0xCD,0xC7,0x27,0xFE,0x5C, /*  J...L..'.\ */
  0x34,0x25,0xCB,0xE6,0xFF,0xFF,0x8E,0x42,0xE1,0xA0,0x5E, /* 4%.....B..^ */
  0xCA,0x6E,0x30,0x9F,0xFF,0xF8,0xC2,0x12,0x84,0xB9,0x7C, /* .n0.......| */
  0xDC,0x61,0x09,0x4A,0x7F,0xFF,0xFF,0xF9,0x7D,0x32,0x51, /* .a.J....}2Q */
  0x09,0x7C,0xE1,0xA5,0x6E,0xB4,0xFF,0xFF,0xFF,0xFF,0xD3, /* .|..n...... */
  
};

but when I want to read MP3 from my SDcard I hear nothing and here is my code:
Code: [Select]
#include <LiquidCrystal.h>

#include <SD.h>

/*
  vs1003_hello
  
  A simple MP3 flow player to test if board and library are working together.
  The following sketch should say "Hello" every 0.5s :)
  Created 2012-04-05 by Andrey Karpov
*/

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <avr/io.h>

#include <Arduino.h>

#include "printf.h"
#include <VS1003.h>
#include <SPI.h>

VS1003 player(28, 29, 30, 31); // cs_pin, dcs_pin, dreq_pin, reset_pin

File my_file1;
File my_file2;

LiquidCrystal lcd(22,23,24,25,26,27);

unsigned char buffer[512];

void setup () {
  
  lcd.begin(16,2);
  
  //
  
  pinMode(53,OUTPUT);
  //
  if(SD.begin(53)==true)
  {
    lcd.print("init ok");
    delay(500);
  }
  else
  {
    lcd.print("init fail");
    delay(500);
  }
  //
  if(SD.exists("3.mp3")==true)
  {
    lcd.clear();
    lcd.print("exist ok!");
    delay(500);
  }
  else
  {
    lcd.clear();
    lcd.print("not exist");
    delay(500);
  }
  //
 // initiate SPI
    SPI.begin();                                                                                                                                        
 // initiate a player
    player.begin();
 // set maximum output volume
    player.setVolume(0x00);
    my_file1=SD.open("3.mp3",FILE_READ);
    lcd.clear();
    if(my_file1)
    {
      for(int i=0;i<my_file1.available();i++)
      {
        buffer[i]=my_file1.read();
      }
        //delay(5000);
    }
    else
    {
      lcd.print("error in opening");
      delay(1000);
    }
    my_file1.close();
}



void loop() {
    player.playChunk(buffer, sizeof(buffer));
    delay(500);
}

thanks for your help.I got crazy!!! :o

leo_elec

no one know this problem?

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy