Vmusic2 questions

elf1564

New Member
Hello all,

I've been working the 8 and 14m chips for a few months now and have been really impressed. I've been using these chips to interface to my RC tank.
I'll be the first to admit that I'm no electronic whiz but dabble with it just enough to get my into trouble.:D

I decided to take the plunge and ordered the Vmusic2 and a 28x1 Picaxe.
I want to use these for a motor sound effects. Pretty simple idea, use the picaxe to take signals from the transmitter (easy enough), tell the Vmusic to play one of three 10 second clips. Motor at idle, motor rev's up and motor at high speed. I need the sound tracks to be able to move from one sound clip to another as the transmitter stick is moved. So far I can get the unit to play a clip, a few seconds or even the whole thing.

After a few days of working with the V module I have managed to make a little head way. But found myself asking more questions than I can seem to find answers or information for.

I do not have the patch cord but instead have been using the Hyper-Terminal program that comes up during running the picaxe. I have managed to found out that my V-module used software version 1.12. I have been able to upgrade this the latest of 3.XX. I been using serial commands. Mostly using the code snipplets found on this site.

Okay, now a for a few general questions for those of you have worked with this unit. Am I the only one that can't seem to get the volume command to work? Okay not a big deal for me on this project as I plan on routing the sound through a amp and speaker. But for some reason this little bit is driving me nuts.

When the Terminal Box is running during program execution, no matter what I type in to the Output Buffer box nothing seems to matter. For instance I can issue the stop command when a track is playing , hserout 0,("vst",CR) and nothing happens. Am I'm wrong thinking I can use to issue direct commands to the Vmusic?

One of the things I noticed but doubt I can do anything about is the delay time between playing of tracks. It seems to be a second or so but is quite noticeable. Anyway to make the gap any shorter?

Finally, before I wear out my welcome. I noted in the few programs I have found for this player, that each time a command such as play or stop the next thing in line is a get_response: routine. Could you please explain that bit a little for us less knowledgeable about such.

I do have more questions but will wait before I bother you good folks anymore.

Thanks,
Rusty Bates
 

100317

New Member
Vmusic2

Hello Rusty!

First of all check the connections.

Secondly, check whether a short exists in the input6 C6 Leg 17
and input7 C7 Leg 18.

Here a link:

http://www.picaxeforum.co.uk/showthread.php?t=8034&highlight=vmusic2

I do not know whether you can communicate over the terminal window with the Picaxe, I have not tried it yet.

The 'get_response' routine is used to communicate with the Vmusic2 module. If you insert the code then you see the answers from the module. E.G. D:>\ = OK.; Bad Command. etc.

Following my Program to logging Temperature and Brightness:

Code:
Code:
; set picaxe type
#picaxe 28x1

; open terminal after download
; This is to view the 'sertxd' debugging comments
#terminal 4800

symbol first_byte = b0
symbol point = b1
symbol temp = b2
symbol loopcounter = b3
symbol isnegative = b13
symbol negative = b14
symbol T_schl = b15

setup:
	; setup serial hardware at 9600 with background receive
	hsersetup b9600_4,%01
	low 0
	pause 1000
	Sertxd ("Wetterlogger.bas",CR,LF)
	Sertxd ("17.12.2007",CR,LF)
	toggle 7

init:
	; Send E's until the unit responds correctly
	'sertxd ("<Sent> E",CR,LF)
	hserout 0,("E",CR)		'Send "E" to vmusic 
	gosub	get_response		'check, if vmusic is ready 
	if first_byte <> "E" then init 'No, try it again

Main:
	'Pause 1000
	
Anfang:
	gosub Check_drive
	gosub Open_file
	gosub	get_response
	sertxd (CR,LF)
	gosub Uhrabfrage
	hserout 0,("wrf ",$00,$00,$00,$0e,CR,b8,b9,".",b10,b11,".",b12,b13,";",b4,b5,":",b3,b2,CR)
	gosub	get_response
	toggle 7	
	gosub Helligkeit
	hserout 0,("wrf ",$00,$00,$00,$06,CR,";",b1,b2,b3,b4,";",CR)
	gosub	get_response
	toggle 7
	T_schl = 0
	gosub temperatur1
	hserout 0,("wrf ",$00,$00,$00,$08,CR,negative,b3,b4,b5,",",b7,b8,";",CR)
	gosub	get_response
	toggle 7
	T_schl = 0
	gosub temperatur2
	hserout 0,("wrf ",$00,$00,$00,$09,CR,negative,b3,b4,b5,",",b7,b8,CR,LF,CR)
	gosub	get_response
	pause 1000
	toggle 7	
	gosub Close_file
	low 7
Wartezeit:
	'Pause 60000		' 1 wait 1 minute
	'Sleep 130 			' 5 wait 5 minutes 
	Sleep 260 			'10 wait 10 minutes 
	goto anfang
	
	'end

get_response:
	pause 1000			; wait a while	
	point = 0			; reset local pointer
	get point,first_byte	; Save the first reply byte
	do
	get point,temp		; get returned byte
	sertxd (temp)		; transmit it to terminal window
	inc point			; increment pointer
	loop while temp <> CR	; if not CR loop 
	sertxd (LF)			; Add a LF to the received CR
	sertxd (CR,LF)		; Do another blank line
	hserptr = 0			; reset the background receive pointer 
	return
	
Check_drive:
	hserout 0,(CR)
	gosub	get_response
	if first_byte <> "D" then Check_drive 'Check, if 1.Byte is "D"
	return

Close_file:
	hserout 0,("clf tempdat.txt",CR)
	pause 300	
	gosub	get_response
	toggle 7	
	return

Open_file:
	hserout 0,("opw tempdat.txt",CR)	
	pause 300
	gosub	get_response
	toggle 7
	return
	
Uhrabfrage:	
	i2cslave %11010000, i2cslow, i2cbyte
	readi2c 0, (b0,b1,b2,b3,b4,b5,b6,b7)
	bcdtoascii b4,b8,b9	'convert b4 in b8 und b9 --> Tag 
	bcdtoascii b5,b10,b11	'convert b5 in b10 und b11 --> Monat
	bcdtoascii b6,b12,b13	'convert b6 in b12 und B13 --> Jahr
	bcdtoascii b2,b4,b5	'convert b2 in b4 und b5 --> Stunde	
	bcdtoascii b1,b3,b2	'convert b1 in b3 und b2 --> Minute	
	bcdtoascii b0,b1,b7	'convert b0 in b1 und b7 --> Sekunde
	toggle 7
	Sertxd ("Datum:",b8,b9,".",b10,b11,".",b12,b13," ",b4,b5,":",b3,b2,CR,LF)
	return

Helligkeit:
	' 516 = ganz Dunkel
	' 1020 = ganz hell
	readadc10 0,w3				'Analog = Pin 2 Picaxe28X1
	bintoascii w3,b0,b1,b2,b3,b4		'convert w3 in b0 bis b4 
	sertxd ("Helligkeit: ",b1,b2,b3,b4,CR,LF)
	'pause 1000
	Toggle 7	
	return

Temperatur1:
	w4 = 0
	readtemp12 0,W4				'Port C 0 = Pin 11
	pause 200
	gosub tempausw
	sertxd ("Temperatur     : ",negative,b3,b4,b5,",",b7,b8,CR,LF)
	if b4 > "4" and b5 > "4" and T_Schl = 0 then 
		T_schl = T_schl + 1
		goto Temperatur1
	end if
	toggle 7
	return

Temperatur2:
	w4 = 0
	readtemp12 1,W4				'Port C 1 = Pin 12
	pause 200
	gosub tempausw	
	sertxd ("Temperatur  1 : ",negative,b3,b4,b5,",",b7,b8,CR,LF)
	if b4 > "4" and b5 > "4" and T_Schl = 0 then 
		T_schl = T_schl + 1
		goto Temperatur2
	end if
	toggle 7
	return

Tempausw:
	isNegative = w4 / $8000
	negative = " "
 	If isNegative = 1 Then
 	W4 = -w4
 	negative = "-"
 	End If
	b1 = 0 
	b2 = 0
	w4 = w4*10/16
	b1 = w4/10
	b2 = w4//16
	bintoascii b1,b3,b4,b5
	bintoascii b2,b6,b7,b8
	if b7 = "0" then 
		b7 = b8 
		b8 = "0"
	end if
	return
[code]

I have had also problems using Vmusic2 at the beginning.
 
Last edited:

elf1564

New Member
Thanks Hans,

All connections checked and rechecked. Looks good. Get an occasional "Looking for Drive" that never seems to around. Sometimes resetting works, a few times I've simply unplugged the small data cable from the Vmusic and reinserted. Seems to work so may have a bad connection at times there.

I sat down with a copy of some different programs for the Vmusic module since yesterday. I beginning to get a idea of what is going on. I spent the past few hours trying to get the radio transmitter to switch the tracks. I finally managed to get the program lines right but still occasionally I get some odd glitches. I'm playing with the pause times during the steps but haven't really latched onto the problem quite yet.

The code is partly that of what I have seen here on the forum and then the middle section is my crude attempt to gain some sort of control over switching from track to track using a radio. I think I will finally have only three clips when I complete. The first will be a 5 second motor startup clip labeled as 1 .mp3 This first track will one will not play in correctly unless I issue a pause command for the length of the track.

The second and third tracks will be about 10 minutes long so I can reduce the amount of times of the silent gap that is produced between changing of tracks. I want to keep the sound as continuous as possible. I've also use a repeat command for this track for right now as the track is only 14 seconds long. The repeat function seems to work alright about 90% of the time but sometimes I get a long gap between. Not sure why.

Basically I will be switching from track two which is the motor at idle and track three which will include a ramping up of the motor to full speed.

I have left out the get_response when issusing a command to play track in some versions to see if I get much of a change but haven't really noted much difference. Still I'll keep banging away.

If anyone has some ideas or suggestions, I'm all ears and welcome any ideas that could help me get the best from this unit.

Thanks,
Rusty

symbol first_byte = b0
symbol point = b1
symbol temp = b2
symbol loopcounter = b3
pulsin 3,1,b1

; set picaxe type
#picaxe 28x1
setfreq m4
; set COM port used for download
;#com 4
; open terminal after download
; This is to view the 'sertxd' debugging comments
#terminal 4800
setup:
; setup serial hardware
; at 9600 with background receive
hsersetup b9600_4,%01
low 0 ; ensure CTS is low
init:
; Send Es until the unit responds correctly
sertxd ("<Sent> E",CR,LF)
hserout 0,("E",CR)
gosub get_response
if first_byte <> "E" then init
main:
; check to see if a drive is actually inserted
; response will start D for yes and N for no
sertxd ("<Sent> Check Drive",CR,LF)
hserout 0,(CR)
gosub get_response
if first_byte <> "D" then main
sertxd ("Computer now ready",CR,LF)
pause 100

hserout 0,("vpf 1.mp3",CR)
gosub get_response
pause 4500

mainidle:
hserout 0,("vst",CR)
hserout 0,("vrf 2.mp3",CR)

mainidle1:
pause 25
pulsin 3,1,b1
if b1>=145 and b1<=160 then mainidle1

mainrev:
hserout 0,("vst",CR)
gosub get_response
hserout 0,("vpf 3.mp3",CR)

mainrev1:
pause 25
pulsin 3,1,b1
if b1>=145 and b1<=160 then restart
goto mainrev1:

restart:
goto mainidle


; Sub procedure to receive background bytes
get_response:
pause 1200 ; wait a while

point = 0 ; reset local pointer
get point,first_byte ; Save the first reply byte
do
get point,temp ; get returned byte
sertxd (temp) ; transmit it
inc point ; increment pointer
loop while temp <> CR ; if not CR loop
sertxd (LF) ; Add a LF to the received CR
sertxd (CR,LF) ; Do another blank line
hserptr = 0 ; reset the background receive pointer
return
 

100317

New Member
Sorry, but my Vmusic Module is since mid of december in use, so i can't test it.

One idea is to omit the "Stop command" and send only the next Play command.

How are the files produced? Is a silent gap at the beginning or end of the file? If so, you may edit the files with a Sound editor.


Have you also read the Vinculum Firmware User Manual? There are many useful informations in this manual.

http://www.vinculum.com/documents.html#vfwspecs

Hans.
 
Top