Boas noites! Estou a usar um Music Shield v2.0 para arduino, eu meti as keys disable e queria que o som estivesse sempre no máximo.. alguém me pode ajudar?

Tenho este pograma mas nada resulta..

#include <SD.h>
#include <SPI.h>
#include <arduino.h>
#include <MusicPlayer.h>
#define MAXVOL

void setup()
{
  Serial.begin(9600);
  player.keyDisable();//keys disable first;All the keys will be invalid.
  player.begin(); //will initialize the hardware and set default mode to be normal.
  player.setPlayMode(PM_REPEAT_LIST); //set mode to repeat to play a song
  player.scanAndPlayAll(); //If the current playlist is empty,it will add all the songs in the root directory to the playlist.

}
void loop()
{
  player.play();
}

Exibições: 299

Responder esta

Respostas a este tópico

http://www.seeedstudio.com/wiki/Music_Shield_V2.0

Bem legal esse Shield ! não conhecia. 

Sugestão para Volume maximo :

https://github.com/Seeed-Studio/Music_Shield/blob/master/examples/a...

#include <SD.h>
#include <SPI.h>
#include <arduino.h>
#include <MusicPlayer.h>

void setup(void)
{
Serial.begin(9600);
player.keyDisable(); //keys disable first;
player.analogControlEnable(); //enable to scan the A4/A5
player.begin(); //will initialize the hardware and set default mode to be normal.
player.attachAnalogOperation(A4, adjustVolume); //Grove - Rotary Angle Sensor connected to A4,to control the volume
player.scanAndPlayAll(); //If the current playlist is empty,it will add all the songs in the root directory to the playlist.
}
void loop(void)
{
player.play();
}
void adjustVolume(void) //User-defined function
{
unsigned int vol_temp = analogRead(A4);
unsigned char volume = vol_temp / 12;
if (volume == 0x55) volume = MAXVOL; //MAXVOL = 0xfe;
player.setVolume(volume);
}

http://seeedstudio.com/wiki/images/9/9a/VS1053.pdf

8.7.11 SCI_VOL (RW)

SCI_VOL is a volume control for the player hardware. The most significant byte of the volume
register controls the left channel volume, the low part controls the right channel volume. The
channel volume sets the attenuation from the maximum volume level in 0.5 dB steps. Thus,
maximum volume is 0x0000 and total silence is 0xFEFE.
Note, that after hardware reset the volume is set to full volume. Resetting the software does
not reset the volume setting.

Setting SCI_VOL to 0xFFFF will activate analog powerdown mode.
Example: for a volume of -2.0 dB for the left channel and -3.5 dB for the right channel: (2.0/0.5)
= 4, 3.5/0.5 = 7 → SCI_VOL = 0x0407.

Example: SCI_VOL = 0x2424 → both left and right volumes are 0x24 * -0.5 = -18.0 dB
In VS1053b bass and treble initialization and volume change is delayed until the next batch of
samples are sent to the audio FIFO. Thus, audio interrupts can no longer be missed during a
write to SCI_BASS or SCI_VOL.

This delays the volume setting slightly, but because the volume control is now done in the DAC
hardware instead of performing it to the samples going into the audio FIFO, the overall volume
change response is better than before. Also, the actual volume control has zero-cross detection,
which almost completely removes all audible noise that occurs when volume is suddenly
changed.

O que não entender, me avise. 

Obrigado!

Sim existe ja algum tempo e da muito jeito!

Por acaso foi mesmo ter visto mal..porque andei nesse site a procura e nao vi esse exemplo!

Obrigado :)

Vou ver se me safo!

Tou a ter um problema..o som não aumenta.. as vezes aumenta outras não..da ruído.. e as vezes fica o som baixo não sei porque

#include <SD.h>
#include <SPI.h>
#include <arduino.h>
#include <MusicPlayer.h>

void setup(void)
{
Serial.begin(9600);
player.keyDisable(); //keys disable first;
player.analogControlEnable(); //enable to scan the A4/A5
player.begin(); //will initialize the hardware and set default mode to be normal.
player.setPlayMode(PM_REPEAT_LIST); //set mode to repeat to play List
player.attachAnalogOperation(A4, adjustVolume); //Grove - Rotary Angle Sensor connected to A4,to control the volume
player.scanAndPlayAll(); //If the current playlist is empty,it will add all the songs in the root directory to the playlist.
}
void adjustVolume(void) //User-defined function
{
unsigned int vol_temp = analogRead(A4);
unsigned char volume = vol_temp / 12;
if (volume == 0x55) volume = MAXVOL; //MAXVOL = 0xfe;
player.setVolume(volume);
}
void loop(void)
{
player.play();
}

Você conectou um potenciometro na porta A4 ?

http://www.seeedstudio.com/wiki/Music_Shield_V2.0

Demo 3: Control Volume by analog port
1.Plug the Grove-Base Shield onto the Music shield, Connect the Grove socket of the Rotary and anolog port 4 of the Base Shield with a Grove cable. You can change to
the digital port as well. But don't forget to change the port number in the definition of the demo code at the same time. 

2. Open the “analogInputControl” example and upload it onto your Arduino Board.
3. Rotate the knob to change music volume.

Eu nao.. apenas meti o shield em cima do arduino e ele começa a tocar e depois faz ruido e outras vezes faz ruido e nao toca nada..

Eu tou a criar uma coisa complexa

Tou a usar o Music shield para dar a musica e tenho um analisador de som para arduino para receber as frequencias..mas parece que o analisador de som usa as mesmas portas que o music shield e nao sei como resolver..

RSS

© 2024   Criado por Marcelo Rodrigues.   Ativado por

Badges  |  Relatar um incidente  |  Termos de serviço