aplayer output rate

      Re: aplayer output rate

      About µ-law I'm not sure. In fact it's the first time that I hear about this coding. Is this a special coding for PCM files?

      But other sample rates are of course OK. On the other hand playing the sound is mostly done by dedicated hardware, so the CPU load will not be much lower when using another data rate. Just the files are smaller.

      If it's about the file size: usually we also have madplay included in our rootfs, that can play MP3 files. At the moment I'm not sure if this is also true for PicoCOM4, but you can easily check if it is available. If not, just add it to your selected BuildRoot packages.

      Your F&S Support Team
      F&S Elektronik Systeme GmbH
      As this is an international forum, please try to post in English.
      Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

      Re: aplayer output rate

      It is a very nice codec for voice output. We decided to use it because we started our development on picocom2 with 32MB of flash. And our device is voice guided in several languages. So it was nice that we can compress the PCM up to 1:20 and more.

      The other problem is that we use Java on our device and there is no direct access to amixer to change volume, so we scale the signal sending to a named pipe. And the named pipe is playbacked by aplay. But I was not able to convert a PCM or µlaw to something with less than 44100Hz played by aplay.

      We convert with sox, e.g. sox welcome-message.wav -t au -r 16000 -e mu-law test.au to convert the PCM to 16kHz µlaw.

      Source Code

      1. aplay test.au
      2. Playing Sparc Audio 'test.au' : Mu-Law, Rate 16000 Hz, Mono
      3. aplay: set_params:1166: Unable to install hw params:
      4. ACCESS: RW_INTERLEAVED
      5. FORMAT: MU_LAW
      6. SUBFORMAT: STD
      7. SAMPLE_BITS: 8
      8. FRAME_BITS: 8
      9. CHANNELS: 1
      10. RATE: 16000
      11. PERIOD_TIME: 125000
      12. PERIOD_SIZE: 2000
      13. PERIOD_BYTES: 2000
      14. PERIODS: 4
      15. BUFFER_TIME: 500000
      16. BUFFER_SIZE: 8000
      17. BUFFER_BYTES: 8000
      18. TICK_TIME: 0



      Can you provide a wav file with less than 44100Hz?

      Best Christian

      Re: aplayer output rate

      Hello,

      we did some more research on that problem and found a strange block in sound/soc/samsung/s3c24xx_picocom4.c which is obviously a copy of sound/soc/samsung/s3c24xx_simtec.c

      Source Code

      1. switch (params_format(params)) {
      2. case SNDRV_PCM_FORMAT_S8:
      3. bfs = 16;
      4. rfs = 256;
      5. break;
      6. case SNDRV_PCM_FORMAT_S16_LE:
      7. bfs = 32;
      8. rfs = 256;
      9. break;
      10. case SNDRV_PCM_FORMAT_S18_3LE:
      11. case SNDRV_PCM_FORMAT_S20_3LE:
      12. case SNDRV_PCM_FORMAT_S24_LE:
      13. bfs = 48;
      14. rfs = 512;
      15. break;
      16. default:
      17. return -EINVAL;
      18. }
      19. switch (params_rate(params)) {
      20. case 8000:
      21. case 11025:
      22. case 16000:
      23. case 22050:
      24. return -EINVAL;
      25. case 32000:
      26. psr = 7; //5
      27. break;
      28. case 44100:
      29. psr = 7; //5
      30. break;
      31. case 48000:
      32. psr = 7; //3
      33. break;
      34. case 64000:
      35. case 88200:
      36. case 96000:
      37. return -EINVAL;
      38. default:
      39. return -EINVAL;
      40. }


      could this be the reason for the problem? How to determine a prescaler (psr) for low kHz sampling rates?
      Sorry but this problem could be a show stopper for our product. BTW 8kHz worked fine on the picocom2.

      Best Christian