Is there anyway to get volume control without adding more hardware such as a digital potentiometer?
Just multiply the values in the buffer? E.mapInPlace(buffer,buffer,x=>x*0.5); should work ok.
back to my original question
You're getting an error for the line buf.set(fileBuf); but that's not in the code you've posted... Do you have other code in the file that you're not showing?
The other option is you've previously saved code to Espruino, and it's not getting reset properly before upload so when you upload the new code it's causing errors
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Just multiply the values in the buffer?
E.mapInPlace(buffer,buffer,x=>x*0.5);
should work ok.You're getting an error for the line
buf.set(fileBuf);
but that's not in the code you've posted... Do you have other code in the file that you're not showing?The other option is you've previously saved code to Espruino, and it's not getting reset properly before upload so when you upload the new code it's causing errors