Play DSD music in Android

Source: Internet
Author: User

There's a simple ALSA DSD test program on GitHub that can play DSD, address: Https://github.com/zonque/alsa-dsd-player look at its code and find Alsa_format_snd_pcm_ The definition of FORMAT_DSD_U8 is as follows:

#if 1/**/#define alsa_format snd_pcm_format_dsd_u8#define Sample_size (sizeof (uint8_t) * 2)#define sample_rate_div 1#else/** * #define Alsa_format snd_pcm_format_dsd_u16#define sample_size (sizeof (uint16_t) * 2)#define Sample_ Rate_div 2#endif

So can I run this test program on Android? Alsa_format_snd_pcm_format_dsd_u8 seems to be the highlight, not seen before. Try to find its definition in the source code of Android, not found. But it was found in the standard alsa-lib:

typedefenum_snd_pcm_format { theSnd_pcm_format_unknown =-1,127SND_PCM_FORMAT_S8 =0,129Snd_pcm_format_u8,131Snd_pcm_format_s16_le,133Snd_pcm_format_s16_be,135Snd_pcm_format_u16_le,137Snd_pcm_format_u16_be,139Snd_pcm_format_s24_le,141Snd_pcm_format_s24_be,143Snd_pcm_format_u24_le,145Snd_pcm_format_u24_be,147Snd_pcm_format_s32_le,149Snd_pcm_format_s32_be,151Snd_pcm_format_u32_le,153Snd_pcm_format_u32_be,155Snd_pcm_format_float_le,157Snd_pcm_format_float_be,159Snd_pcm_format_float64_le,161Snd_pcm_format_float64_be,163Snd_pcm_format_iec958_subframe_le,165Snd_pcm_format_iec958_subframe_be,167Snd_pcm_format_mu_law,169Snd_pcm_format_a_law,171SND_PCM_FORMAT_IMA_ADPCM,173Snd_pcm_format_mpeg,175snd_pcm_format_gsm,177Snd_pcm_format_special = to,179Snd_pcm_format_s24_3le = +,181Snd_pcm_format_s24_3be,183Snd_pcm_format_u24_3le,185Snd_pcm_format_u24_3be,187Snd_pcm_format_s20_3le,189Snd_pcm_format_s20_3be,191Snd_pcm_format_u20_3le,193Snd_pcm_format_u20_3be,195Snd_pcm_format_s18_3le,197Snd_pcm_format_s18_3be,199Snd_pcm_format_u18_3le,201Snd_pcm_format_u18_3be,202  /*g.723 (ADPCM) kbit/s, 8 samples in 3 bytes*/203snd_pcm_format_g723_24,204  /*g.723 (ADPCM) kbit/s, 1 sample in 1 byte*/205snd_pcm_format_g723_24_1b,206  /*g.723 (ADPCM) kbit/s, 8 samples in 3 bytes*/207snd_pcm_format_g723_40,208  /*g.723 (ADPCM) kbit/s, 1 sample in 1 byte*/209snd_pcm_format_g723_40_1b, About  /*Direct Stream Digital (DSD) in 1-byte samples (x8)*/211Snd_pcm_format_dsd_u8,212  /*Direct Stream Digital (DSD) in 2-byte samples (x16)*/213Snd_pcm_format_dsd_u16_le,214Snd_pcm_format_last =Snd_pcm_format_dsd_u16_le,215 216 #if__byte_order = = __little_endian217 218SND_PCM_FORMAT_S16 =Snd_pcm_format_s16_le, -Snd_pcm_format_u16 =Snd_pcm_format_u16_le,222Snd_pcm_format_s24 =Snd_pcm_format_s24_le,224Snd_pcm_format_u24 =Snd_pcm_format_u24_le,226SND_PCM_FORMAT_S32 =Snd_pcm_format_s32_le,228Snd_pcm_format_u32 =Snd_pcm_format_u32_le, theSnd_pcm_format_float =Snd_pcm_format_float_le,232Snd_pcm_format_float64 =Snd_pcm_format_float64_le,234Snd_pcm_format_iec958_subframe =Snd_pcm_format_iec958_subframe_le235 #elif__byte_order = = __big_endian236 237SND_PCM_FORMAT_S16 =Snd_pcm_format_s16_be,239Snd_pcm_format_u16 =Snd_pcm_format_u16_be,241Snd_pcm_format_s24 =Snd_pcm_format_s24_be,243Snd_pcm_format_u24 =Snd_pcm_format_u24_be,245SND_PCM_FORMAT_S32 =Snd_pcm_format_s32_be,247Snd_pcm_format_u32 =Snd_pcm_format_u32_be,249Snd_pcm_format_float =Snd_pcm_format_float_be,251Snd_pcm_format_float64 =Snd_pcm_format_float64_be,253Snd_pcm_format_iec958_subframe =Snd_pcm_format_iec958_subframe_be254 #else255 #error"Unknown endian" the #endif257} snd_pcm_format_t;


For the time being do not know how the specific work, is the transmission of DSD data to the hardware? or Alsa-lib to standard PCM first? But in Android Alsa-lib, there is really no snd_pcm_format_dsd definition, should be reduced. Therefore only consider the use of DSD->PCM converted to 24bit 176K, and then in accordance with the standard PCM mode to play.

Play DSD music in Android

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.