Pages: 1 [2] 3 4   Go Down
Author Topic: Arduino and VMUSIC2  (Read 5621 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Did someone manage to set the volume? The code should be "VSV byte" but I've no idea how to handle the command with the byte value.

Here is what I've tried:

Code:
 Serial.print("VPF 1.mp3"); // play file
  Serial.print(13,BYTE);
  delay(10000); // wait
  Serial.print("VST"); // stop
  Serial.print(13,BYTE);

  Serial.print("VSV"); // set volume
  Serial.print(100,BYTE); // should be between 0 (loud) and 254 (mute)
  Serial.print(13,BYTE);

Sound keeps loud whatever I put instead of 100...
Logged

0
Offline Offline
Faraday Member
**
Karma: 7
Posts: 2526
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You want a space after the "VSV" unless you are in "short command set" mode.

Sending that 100 as binary sort of looks like you are mixing modes - did you try sending it as DEC (e.g. ASCII, not binary) instead?  Yeah, the documentation sort of indicates binary, but I've had problems with the VDIP docs.

-j

Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks kg4wsv, I tried every possible combination without success.

I managed to hear a sound variation when printing VSV 80, but that's all...
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 84
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi guys   anyone found out how to change the volume in the vmusic2 ?  

What i,m trying to achive is :

Play a track when a bottom is pushed when release pause this track then if you push again the track keep playing from the last position so it is play pause only .  

The problem , i have is that when the track finish it never play back i,d like it to repeat when is done to do the same play and pause , I tried the command (VRF·file Repeatedly plays a single file) , but does not work or maybe i,m not sending it in the right way .

The other thing is that i need a volume fade out before pause and fade in when play but the commad (VSV·byte Sets playback volume)  seem not to do anything ,


here is my code , which only works once  until the track is finished after play pause and it does not have the fade in out implemented .

Code:
int sensor=7;// this is the buttom
int value=0;
int LastValue=0;
int pot =0; // poti value .

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

void loop() {
  
  value=digitalRead(sensor); // this is a buttom in pin 7 .
  pot=analogRead(0)/4; // this is a poti in analog pin  0 which i wanted to use for testing the volume .
    
  if(value != LastValue){
  if (value == HIGH) {
    
  Serial.print("VPF 4.wav "); //#play this file 4.wav
  Serial.print("\r");
   }
  }
  
  if(value != LastValue){
  if(value == LOW) {
    
  Serial.print("VP"); //#pause playing
  Serial.print("\r");
  
 }
 
 /*
 
 VSV·byte Sets playback volume
 Serial.print("VSV ");
 Serial.print(pot,BYTE);
 Serial.print("\r");
 delay(1000);*/
 
 
 }
    
LastValue = value ; //this is to write into port only on change .
    
  
}

/* VMUSIC COMMANDS:
VPF·file Plays a single file eg: "VPF 1.mp3"
VRF·file Repeatedly plays a single file
V3A Plays all MP3 files
VRA Repeatedly plays all MP3 files
VP Pause playback
*/

any tip suggestion apreciated .

cheers ;D

btw (something happen that my usb drive is dead ) ;(
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The VRF command works fine with me. Have you updated the firmware?
(1/ download: http://www.vinculum.com/downloads/firmware/ftrfb_main_03_64VMSC1F.ftd 2/ rename to ftrfb.ftd 3/ put it on your usb key and wait for the red light to become green)

You should be able to hear some sound variation using the VSV command then... I read somewhere on the internet that it's not possible to perform a fade in / fade out using that command.

Let us know if you find a way to control the sound!
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 84
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok thanks , i,ll try to update the firmware and let you know if any luck with the fade in ;D

cheers
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 84
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi i updated the firmware and now the repeat file works ;D ,

still dont know the right way o send the volume command

is it this way ?

Serial.print("VSV 254"); // i read in a forum that the volume goes from 254 to 0 where zero is the max volume
Serial.print(13,BYTE);

any tips or ideas about it ?
Logged

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

emm... can someone answer me this question
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1224394350/0#0

Quote
I was use a code in
http://www.arduino.cc/playground/Main/VMUSIC
arduino playground with vmusic2 simple source code
with my jx-mega128
to control a vmusic2 module
I was connected RX on VMUSIC to TX on board / also with TX
/+5v ,Ground, CTS#cto ground

and the result was turn out like this
-the led in VMUSIC2 blinking / my flash drive blinking in an any play command and stop blinking in any stop command(does this mean that the firmware and the code work out?)
-but the music doesn't turn out to my head phone.
- I just test with V3A/VPF xxx.mp3 but it still doesn't work

and the question is what wrong with it?
sorry that i cann't see this topic before

and i was use flash drive with 256m.

so, did i miss any thing that make me work out with VMUSIC

and when i first test there was a song woww!!! after the first song
there no sound anymore why?
i re format flash drive and reset everything again but it won't work :-[
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 217
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hey Guys,

Just wondering a few things about the VMUSIC2:

1. How long of a delay is there before audio is heard after you issue a play command?

2. What happens if you rapidly send new play messages while it is playing?

thx
Logged

Amsterdam
Offline Offline
Full Member
***
Karma: 0
Posts: 137
he's looking at you, kiddy...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

the response time is about half a second. mainly because of the filesystem overhead. i used one in a project with touch sensors. every time a sensor was touched, an audible click was heard, next to a led. i had to delay the led to get it more in sync...

it has no precaching. so every time you play a sound, it fetches it again from the drive
Logged

--
"We're all in this together..."

0
Offline Offline
Full Member
***
Karma: 0
Posts: 217
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I got the VMUSIC2 firmware updated and I can get it to respond to commands. However, quite often a command is received as being a "bad command" and I have to send it 3 times before it will finally be accepted.

Any ideas what might cause this?  One issue is that since I am using software serial to communicate, the voltage levels are 5V and I think think the VMUSIC2 is expecting 3.3V levels. If this is true I can just use a logic level converter (I got some from sparkfun).

Another thing I noticed is that VPF commands trigger the audio to play almost instantly (which is great) but once the file is finished playing I have to wait for about 5-7 seconds before I make another command. If I don't then I get the condition of having to re-send commands three times in a row.

Any other ideas?

thanks,
    Danjel

This is the code I am using:
Code:
#include <avr/interrupt.h>
#include <SoftwareSerial.h>

#define VMUSIC_CTS 5  //to VMUSIC CTS pin 6 (or ground!)
#define VMUSIC_RX 2  //to VMUSIC TXD pin 5
#define VMUSIC_TX 3  //to VMUSIC RXD pin 4
#define ledPin 13

// set up a new serial port
SoftwareSerial mySerial =  SoftwareSerial(VMUSIC_RX, VMUSIC_TX);  //(RXpin, TXpin)

void setup() {
  Serial.begin(9600);      // opens serial port, sets data rate to 9600 bps

  // define pin modes for tx, rx, led pins:
  pinMode(VMUSIC_CTS, OUTPUT);
  pinMode(VMUSIC_RX, INPUT);
  pinMode(VMUSIC_TX, OUTPUT);
  pinMode(ledPin, OUTPUT);  // declare LED as output
  digitalWrite(ledPin, LOW);

  // set the data rate for the SoftwareSerial port:
  mySerial.begin(9600);

  //This will allow softwareSerial to process incoming automatically:
  attachInterrupt(0, readSoftwareSerial, LOW);

  //Tells VMUSIC that hardware is connected:
  digitalWrite(VMUSIC_CTS, LOW);    
  delay(200);
  mySerial.print("VSV ");
  mySerial.print(0);
}


void loop() {
  int serialReceived = 0;
  if(Serial.available() > 0){
    noInterrupts();
    digitalWrite(VMUSIC_CTS, LOW);
  }  
  while(Serial.available() > 0){
    char incoming = Serial.read();
    mySerial.print(incoming);
    serialReceived = 1;
  }
  if (serialReceived == 1){
    mySerial.print(13,BYTE);  //carriage-return for VMUSIC2
    serialReceived == 0;
  }
  interrupts();  //re-enable softwareSerial
}


void readSoftwareSerial(){
  noInterrupts();
  digitalWrite(ledPin, HIGH);
  char incoming = mySerial.read();
  Serial.print(incoming);
  digitalWrite(ledPin, LOW);
  interrupts();
}


/* VMUSIC COMMANDS:
 
 VPF·file       Plays a single file eg: "VPF 1.mp3"
 
 VRF·file       Repeatedly plays a single file
 
 VST            Stops playback
 
 V3A            Plays all MP3 files
 
 VRA            Repeatedly plays all MP3 files
 
 VRR            Repeatedly plays random MP3 files
 
 VSF            Skip forward one track
 
 VSB            Skip back one track
 
 VSD            Skip forward one whole directory
 
 VP             Pause playback
 
 VF             Fast forward 5 seconds
 
 VB             Rewind 5 seconds
 
 VRD·byte       Reads command register
 
 VWR·byte+word  Writes command register
 
 VSV·byte       Sets playback volume
 
 *//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
« Last Edit: November 01, 2008, 06:16:09 pm by intellijel » Logged

Amsterdam
Offline Offline
Full Member
***
Karma: 0
Posts: 137
he's looking at you, kiddy...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

the problem i think is the speed of the arduino, not fast enough to send a nice uart signal to the vmusic. or the interrupt is not handled efficient enough in the code.

tomorrow i will be testing a setup where i change the serial speed of the vmusic to 2400 baud and switch the software serial to that as well.

it's just theory, i'm not even shure that it might be possible to change the serial speed on the fly.

the most sucess i had with a vmusic connected to the normal serial port (pin 0 and 1) and power the arduino externally. that is very reliable. although a pain in the ass to upload a new sketch. you have to disconnect the vmusic every time.
Logged

--
"We're all in this together..."

0
Offline Offline
Full Member
***
Karma: 0
Posts: 217
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I actually got it working totally well now!

It triggers quickly and I can re-trigger it rapidly (interrupting playback) and it does not crash.

For some reason I could not communicate to it using the hardware UART but I have no problems using SoftSerial.

For now I won't try to fix what ain't broken!
Logged

Amsterdam
Offline Offline
Full Member
***
Karma: 0
Posts: 137
he's looking at you, kiddy...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

well, what did you change? i use the software serial mainly for debugging, so the command is send to the computer as well as the vmusic. and i want to see when a file finishes.

i'm figuring how to capture the > sign so i know the vmusic is back at its prompt
Logged

--
"We're all in this together..."

Amsterdam
Offline Offline
Full Member
***
Karma: 0
Posts: 137
he's looking at you, kiddy...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

well, i had a lot of trouble with the Vmusic2 lately. i had a sketch controlling a vmusic playing continues sound, but the player would stop after the first run. no prompt, nothing. i suspected the power supply, because the setup worked perfectly earlier on.

it turned out to be a problem with the fat implementation of the vmusic. it is very strict:

-only FAT16 up till 1Gb
-only big caps in the name of the stick like "UNTITLED". no small caps are working.

if this is wrong, the stick does'nt mount.

-no ._xxx files, so mac users have to clean their usb sticks in the terminal. those ._xxx files are actually te resource fork of a mac file, but is not used in the vmusic player.
-no .Trashes or .DStore files, again for macs only.
the savest thing is using a 8.3 naming scheme as well.


hope to save you al a lot of trouble...
Logged

--
"We're all in this together..."

Pages: 1 [2] 3 4   Go Up
Jump to: