Wavetooeasy serial volume

Hi I’m using you wavetooeasy board through serial and it’s working great. But im having problems tring to change the volume level. Please can you give me a INI file example for serial and an example of how i implement the volume level. You have an example that plays a test.wav file on channel 5 looped. Please can you show me how to adjust this volume level. Thanks

Hi @dave777

To give you a precise answer and example I would need to know which method are you using to communicate with the WaveTooEasy. Is it the Arduino library,the C library or a custom library?

Hi Thanks for the reply

Im communicating with it with a Uart from a pic 18f4550 and sending the serial data I got sound playing ok on different channels with different sounds I just don’t understand how I change the volume.

In the config.INI file I have the following

[settings]

Mode = serial

Sample_rate = 44100

Speaker_volume = -5

Headphone_volume = -5

Baudrate = 9600

I also tried it like this

[settings]

Mode = serial

Sample_rate = 44100

Baudrate = 9600This

Not sure if these are correct.

The example code from your website to set speaker volume is with 0x0F

Send to WaveTooEasy

0x7F 0xAA 0x0F 0x02 0x00 0x02 0x00

But I don’t understand where I put this code above as it doesn’t have the CRC16 at the end either.

As from another example here

Example for playing a WAV file called test.wav, played in loop mode on channel 5:

Send to WaveTooEasy:
0x7F 0xAA 0x03 0x0B 0x00 0x05 0x01 0x74 0x65 0x73 0x74 0x2E 0x77 0x61 0x76 0x00 [CRC16]

How would I change the volume of the code above ? That’s what I don’t understand please could you give me an example of the above with the volume turn to say 75% up.

Best Regards David

Hi @dave777,

OK, so if you can play different files on different channels I will assume you can correctly generate your own data packets to send to WaveTooEasy through serial port, with CRC16, correct?

You are right in saying the volume example in the documentation is misleading. In fact, and besides missing [CRC16], the example is incorrect.

The documentation should say

Send to WaveTooEasy
0x7F 0xAA 0x0F 0x02 0x00 0x14 0x00 [CRC16]

The entire packet to set the speaker volume to 2dB, comprising CRC should be

0x7F 0xAA 0x0F 0x02 0x00 0x14 0x00 0x84 0x2E

To set other values for volume you should change 0x14 0x00 to the value you want, and recalculate CRC.

In case the documentation is not clear, the command for playing a file and for changing volume are two different commands.

Hi Ivan Thanks for the reply I thought it needed the CRC16 on the end of the code but wasn’t sure.
I tried that but for some reason I’m not getting any changes in volume. I sent the code as
0x7F 0xAA 0x0F 0x02 0x00 0x14 0x00 0x84 0x2E to change the volume then i send the code to play the wave but I’m not getting any change in volume at all. Is that the correct sequence send volume level first before send the file to play ?
I have tried different volume levels with the correct CRC16 at the end but the volume doesn’t change. I will check my code again but it all looks correct because thats quite a simple piece of code compared to playing a file name and that works ok that’s what’s confusing me as to why its not working.
If you can think of what I’m doing wrong please let me know.
David

Yes. The sequence is correct. You can change the volume even when the file is playing.

The only explanation I can imagine is that you are using the jack to connect speakers, instead of using the pins for speakers.

How are you connecting the speakers?

Hi Yes i’m using the pins off the pcb connected to some small speakers. Ive not used the jack socket.
I will going over what i’m doing and see if i can get it working thanks.

Hi Ivan I have check my code through and all seem ok but I still can’t change the volume for some reason through serial. Have you found anything that may cause this not to work ? Could it be the firmware version I have in this device maybe it’s not the latest version ? I did read I could update firmware through the SD card but I couldn’t find the file on git hub to put on a SD card that it refers to. Maybe you could give me a link to the firmware file ? If you think that would help ? Could this particular device be faulty in some way ? What do you think ?

The boards are shipped with the latest version, so no further action is required on your side.

I’m testing this personally later today. I’ll let you know.

In the meantime, please tell me how are you powering the board.

Thank you.

Hi Ivan Ok so it should have the latest firmware so that’s something to rule out. So you’re going to give it a test today ok. Im powering the board from a Computer power supply going into the 6 - 12 volt input i measured the voltage and it measures 12.2 V dc. I also tried a different 12 volt supply and that was the same. I don’t have to make any link on the board or anything like that do i ?

OK. I have tested it and the command for speakers volume works fine. I did a test with 5V from USB and 12.2V from a power supply. In order to be able to give more help we will need a byte-to-byte dump of the commands you are sending through UART so we can check them.

Incidentally I’ve found a bug that makes WaveTooEasy to ignore the volume you put in the INI file. We have corrected it and you can find the (beta for now) v1.0.1 version here.

Please copy the file to the SD card and power-up your board. You will see the green LED quickly flashing meaning that the update operation is in progress. After that, the LED will blink slowly as in normal operation. The update can’t fail (so far) so you can repeat the procedure as many times as you want.

Let me know how it goes.

Hi Ivan Thanks for the update i will give that a try and let you know how it goes. Just one thing what files should i be putting in the .INI file for it to work i was putting the volume line but i took that out and using whats below.

[settings]
Mode = serial
Sample_rate = 44100
Baudrate = 9600

Is this ok as it is ?

That’s ok. You can put ‘speakers_volume = 10’ and check if the volume is higher.

This allows you to set an initial volume without sending any command.

Hi Ivan I updated the firmware with the file you send it updated just like you said. But it’s no different i have just put this speaker_volume = 10 as this
[settings]
mode = serial
sample_rate = 44100
speakers_volume = 10
baudrate = 9600

The volume is just not changing at all even if i change the value of 10 to something else it’s never changed up or down.
So if it’s not changing with this code directly maybe that’s why the serial code is not working?
So why do you think this volume set to 10 is not working ?

Have you removed all commands controlling the volume from your code? Otherwise the INI file settings will be overridden.

Hi Ivan I have removed the volume control part from the code the volume is still the same, but it’s not playing the full wav file now it starts the wav for about a second and them starts the wav again over and over and doesn’t play the whole file unless a remove the speakers_volume = 10 from the INI file then it play normal again.

Is your board (the one with the PIC) resetting by itself? Perhaps the power supply you are using or (thin) wires cannot sustain the power consumption of high volume?

I see you’ve purchased two boards. Is this behavior (volume and bad playback) seen in both boards?

Otherwise at this point I will need:

Connection diagram and pictures of your setup.

You will need to make a small program that shows this behavior and sent it to me so I can check the code.

INI file and a WAV file to test.

If you don’t want to make this information public, send the files to ivan [at] artekit.eu

Thank you.

Hi My board with the PIC doesn’t seem to be resetting it’s only doing this when i have the speakers_volume = 10 in the INI file. I have measured the 5 Volt supply from my PC power supple going to my pic and it’s good. I have measured the 12 Volts going to your board and that’s good doesn’t move.
We did purchase two boards but unfortunately we don’t have the other board now we send it to a customer connected to one of our boards. That was just set up to play a file on power up.
I will send you my setup on email with the files and pictures.

Hi Just making sure you received my email ok?
Thanks

Yes. Thank you. We received it and we are looking for clues.

I saw the video and I have to say that this could be the most strange error I’ve seen so far. It doesn’t look like a reset, because there should be several milliseconds of silence between every play.

It seems like it’s receiving commands on serial to start playing again. But you say that this goes away by just modifying the INI file… for a volume setting that is sent with I2C to the internal codec only once… so I can’t explain it. I doesn’t look like a hardware problem but sending you a new board isn’t excluded.

I will later try to reproduce your exact code with an Arduino. In the meantime, a couple of shots in the dark: try to reformat the SD with “sd formatter”, be sure the INI file ends with an empty line, and put the command to play the file out of the while loop.