SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By simplyes
#185123
I seem to be failing with the RS232 coding for fading a playing track on the WAV Trigger. Codes I use to select, start, stop a track or to stop all tracks - all is working fine, but following the guide isn't helping when it coems to fading a track. Below is what I have entered to reduce the volume of track 1 across 5 seconds and to stop the track at the end of the fade process (I have listed the codes without the Esc character for clarity). This is just isn't doing the task. Can someone point out my error?!

F0 AA 0C 0A 01 00 60 10 32 00 01 55
User avatar
By robertsonics
#185126
I'm assuming you're not using an Arduino and therefore can't use the WAV Trigger Serial Control library.

https://github.com/robertsonics/WAV-Tri ... al-Library

Even if not, you can look at the code to see how to format the messages. I can see two issues: You're specifying a target volume outside of the -70 to +10 gain dB range, and your time is 50 ms, which is much shorter than 5 seconds. Look at the ::trackFade() routine in wavTrigger.cpp.
By simplyes
#185178
Thanks for the response. I need a little more clarification and the trigger.cpp doesn't really help me for this. For volume I have [70 10]. As you point out, the 70 is incorrect, of course, and should be 46 hex for minimum target volume at -70 decimal. You also pointed out my error on the timing. I have corrected both those things. Timing element is now working correctly and the stop, at least, is happening when it should. Fade control is still not quite right. From the WAV Trigger RS232 guide I have understood that the 1 of the 10 in my string represents the -ve sign, but since the volume is increasing instead of fading out, I am guessing I have not understood this correctly.
By simplyes
#185180
I should have added that I am using the RS232 Shifter, not Arduino, so I am firing 'raw RS232' at it.
User avatar
By robertsonics
#185187
It's all async serial communications - sending 8 data bits, 1-stop, 1-start at a certain baud rate. RS-232 only signifies the signal level. The WAV Trigger Arduino serial library sends the same bytes you are, and the C code should help you understand how to format those bytes.

The gain is sent as a signed 16-bit number. -70 is 0xFFB7 so the bytes should be 0xB7 0xFF (LSB first.) In practice, you won't hear much below -50, so if I'm fading a track to stop I usually use -50 as the target, which would be 0xCE 0xFF.

Hope this helps.