View Full Version : Emic Sound Module: Volume Adjust --Help

02-11-2012, 04:26 PM
Hi all,
I know this subject has been hashed out in the past. But, I check the post and did not see this specific request. I connected and used the example code for the Emic board and it works fine.
What I'm trying to do is adjust the volume and that's not working (its my code). I tried different examples and still can't get the volume to change. I also tried reset as well.
Can someone tell me what I'm doing wrong please? The code is below.


Tx PIN 0 ' connects to Emic SIn
Rx PIN 1 ' connects to Emic SOut
Busy PIN 2 ' 1 = busy

' -----[ Constants ]-------------------------------------------------------

Baud CON 396 ' 2400 baud, N81
Baud CON 1021

Yes CON 1
No CON 0

' Emic Commands (Hex Mode)

Say CON $00 ' say Engish text
Volume CON $02 ' set volume, 0 - 7
Speed CON $04 ' set speed, 0 - 4
Pitch CON $03 ' set pitch, 0 - 6
AddAbbr CON $04 ' add abbreviation
DelAbbr CON $05 ' delete abbreviation
ListAbbr CON $06 ' list abbreviations
Version CON $07 ' get version
Reset CON $08 ' soft reset
Audio CON $09 ' enable audio in
PhT CON $10 ' start of phonetic text
Help CON $FE ' display help
EOM CON $AA ' end of message

OK CON $55 ' "okay" for hex mode

' -----[ Program Code ]----------------------------------------------------

vol VAR Byte
response VAR Nib

GOSUB Check_Busy
SEROUT Tx, Baud, [Say, "Testing 1 2 3.", EOM]
PAUSE 1 ' allow busy to activate
' DO WHILE (Busy = Yes) : LOOP ' wait until not busy

vol = 2
SEROUT TX, Baud, [Volume, DEC1 vol, EOM] ' send to Emic
++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++

When I replace Main with the following to adjust volume, it does not work:

GOSUB Set_Volume
GOSUB Check_Busy
SEROUT Tx, Baud, [Say, "Testing 1 2 3.", EOM]

Help is appreciated.
Thanks (in advance)

Duane Degn
02-11-2012, 05:18 PM
I notice the constant "Volume" is set to an incorrect value.

Volume CON $02 ' set volume, 0 - 7

Should be:

Volume CON $01 ' set volume, 0 - 7

$02 is used to adjust speed.

02-11-2012, 05:53 PM
Would this allow me to set my volume vol to any number (between 0 and 7) and dynamically adjust my volume?

02-11-2012, 06:02 PM
I changed the Volume CON to "$01". I still wasn't able to change the volume.
I also tried the:
SEROUT TX, Baud, [Volume, DEC1 vol, EOM] ' send to Emic
to adjust the volume....still no luck.

Duane Degn
02-11-2012, 06:23 PM
It looks like the "Check_Busy" routine doesn't do much.

Try adding a "PAUSE 500" after setting the volume and before trying to have the emic say anything.

Make sure you set the "vol" varible before using the SEROUT command.

Another thing you could try is:

SEROUT TX, Baud, ["volume=2;"]
SEROUT Tx, Baud, [Say, "Testing 1 2 3.", EOM]

02-11-2012, 06:47 PM
I applied the code and place in a lower volume of 1 (also tried other values between 1 and 7), but the volume level remains the same.



GOSUB Check_Busy
vol = 1 ' set pgm vars to defaults
SEROUT Tx, Baud, ["volume=1;"]
SEROUT Tx, Baud, [Say, "1 2 3 Testing.", EOM]



Duane Degn
02-11-2012, 06:56 PM
You are just a little off with your code blocks. Instead of "
' use "".

I use a Emic a lot but I generally just leave the volume at 7 and adjust the volume on the speakers (built into the VGA monitor I use with a Prop).

I don't think I've ever tried to dynamically adjust the volume with commands to the Emic.

What is your sound circuit like? Are you using the "AOUT" pin or the "SP-" and "SP+" pins?

I personally don't use Basic Stamps anymore so I'm not very sure about any Stamp code I may offer.

02-11-2012, 07:03 PM
I appreciate your help very much.
How do I know if my volume is set to 7?
When I read through the pdf it says it defaults to 3 or 4.
If I can make it set to a particular volume, I'm good with that. The dynamic volume was just me testing.
I connected my speaker to the "SP-" and "SP+".
I also tried the "AOUT", but thats just a set volume which I don't think adjust. ( just for amplifier output according to the pdf, if i read correctly).
Thanks for the block explanation. Just to be sure...Do i use [/code] for the beginning of the code and [/code] at the end of the code?

02-11-2012, 07:16 PM
Hey this works. I look at the pdf again and with your input:
I noticed that adjusting the vol changes the volume. Adjusting the "volume" in the serout cmd does not change.

GOSUB Check_Busy
vol = 7 ' set pgm vars to defaults
'SEROUT Tx, Baud, ["volume=1;"]
SEROUT Tx, Baud, [Volume, DEC1 vol, EOM]
SEROUT Tx, Baud, [Say, "1 2 3 Testing.", EOM]


02-11-2012, 07:20 PM
It appears that the "Volume" in the SEROUT command adjust the volume for the AOUT pin of the EMIC.

Thanks again for all your FAST help. I was trying to figure this thing out for hours!!
Thank you very much.

Duane Degn
02-11-2012, 07:22 PM
How do I know if my volume is set to 7?

I assume it's at 7 because I just copied this code from the Emic Propeller demo.

emic.SetVolume("7") 'loudest

I've just left that part of the code alone ever since I started using an Emic (a couple of years ago).

Do i use [/code] for the beginning of the code and [/code] at the end of the code?

You use [/code] at the end of your code and [code] at the beginning.

I have a second Emic that I've wanted to use with a robot. (The first Emic is used with my data logging equipment. I don't want to mess with that one.) I'll test out my 2nd Emic with an 8 ohm speaker to make sure I can really adjust the volume. I'll let you know what I find out.

02-11-2012, 07:32 PM
Check my post before yours, I have the right syntax working now. You can refer to that if you use the stamp.
Thanks for all your help.
Thanks for the code block help also.
I have three EMIC which I bought a few years ago. I'm using one for my robot. As an amplifier, I hacked a Lego amplifier which is perfect.
I connected an 8 ohm speaker with it also. The volume adjust work. But if its outside or around additional ambient sound, an amplifier is needed.
If I can help in any way, let me know, I learned through my mistakes...lol.
Let me know how it goes with your 2nd Emic.