title: Digital audio formatting
body: <p>I have a vectorized wav file with values between -1 and 1, 88,200 samples, 44.1 kHz sampling rate to hear the audio within two seconds. I'd like to send the audio through bluetooth to a bluetooth module, arduino, DAC, and 3.5mm breakout board with earbuds.</p>
  
  <p>I am getting crackly audio when I receive it at the end. I tried to recreate this is MATLAB and it turns out to be a combination of the scaling (multiplying + shifting the values over 0) and the sampling rate change due to the receivers. Of course, I could be completely recking the sampling frequency with inefficient Arduino code, but since a factor is also the initial scaling my guess is that I am misunderstanding something fundamental to audio processing.</p>
  
  <p><strong>What is the proper way to format and or scale the values between 0-4095 (which are needed for the DAC input) so that the audio itself is not distorted upon listening <em>due to the scaling factor</em>, sampling rate retention aside?</strong> OR is there something <em>else</em> I am missing in the big picture of this?</p>
  
  <p><strong>Clarification</strong>: Currently I am using the python sockets library to send an audio string array char by char into an Arduino array and reading them as an integers, then inputting into the DAC. Not sure if python sockets is the best way to go, there should be something better or a more robust implementation of sockets to send the data</p>
  
  <p><strong>UPDATE:</strong> I realized that the HC-05 uses <a href="https://en.wikipedia.org/wiki/List_of_Bluetooth_profiles#Serial_Port_Profile_(SPP)" rel="nofollow noreferrer">SPP bluetooth protocol</a>, which seems to be waaay too low resolution to send reliable audio.  I will see if I can send a more compressed audio file, store it in the arduino, then output to the DAC. That could provide more reliable audio. </p>