mardi 18 novembre 2014

libSpotify (connect) Audio is missing samples


Vote count:

0




I am trying to knock together a quick demo to show that I can get audio from libspotify on my embedded device. I am playing back a sine wave and taking the captured PCM data in Audacity to confirm that data is not nonesense.


I have had some success but I am finding the sine wave, when played back, has clicks in it. Looking at the waveform I can see that a wavelength is 100 samples long, but when the clicks occur the wavelength is 89 samples long.


Below is code from the PlaybackAudioData callback, hopefully someone could help point out why I have missing data.



size_t PlaybackAudioData(const int16_t *samples, size_t sample_count,
const struct SpSampleFormat *sample_format,
uint32_t *samples_buffered, void *context) {

size_t samples_written;

//check the sample format has not changed
printf("Channels: %d, Sample Rate: %d\n", sample_format->channels, sample_format->sample_rate);

samples_written = 0;

//write samples to file
if(sample_count > 0) {
samples_written = fwrite(samples, sizeof(char), sample_count, f);
printf("Write %d samples: samples written %d\n", (int)sample_count, (int)samples_written);
}

return samples_written;


}


Thanks



asked 1 min ago







libSpotify (connect) Audio is missing samples

Aucun commentaire:

Enregistrer un commentaire