Hi all,
I went on several forum before but can't find any help there for the moment.
Hope you guys can help me to understand the following issue:
I'm currently developping a piece of software to play a song file accross multiple PC (currently simple laptop with poor speaker but that's next step). I m consequently splitting a WAV song file into individual mono channel PCM data file, each of them to be played by a different laptop.
I got correctly my mono channel file but I'm not able to play it correctly in my software. I don't know currently if it comes from my soft or from the laptop or else.
My misunderstanding starts there:
1) If a play my mono channel PCM file using linux sox:
play -b 16 -e signed-integer -c 1 -r 44100 -t raw Channel1.raw
It plays nice but with same sound duplicated on two laptop speaker. Why not only on Left ? or Right ? setting the -c 1 should not switch the sound card to mono ?
2) If I play this mono file using my home made C software using basically:
snd_pcm_sframes_t written = snd_pcm_writei(soundDevice,buffer.data,size);
it fails (ie it is played correctly but frequency is doubled as if it reads from the buffer two samples at a time (stereo) and not only (mono) thus artificially doubling the rate.
SoundDevice being configured in SND_PCM_ACCESS_RW_INTERLEAVED and SND_PCM_FORMAT_S16_LE. but I can't force the mono setting or the max channel = 1 in the software, as it is refused.
ret = snd_pcm_hw_params_set_channels (_soundDevice, hw_params, 1)) is returning -22 (EINVAL). Why is this refused ? due to laptop soundcard internal configuration ? or some trick in asoundrc could help me ?
Thanks in avance for your help because I'm a little bit stuck there since days...
Snarf
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all,
I went on several forum before but can't find any help there for the moment.
Hope you guys can help me to understand the following issue:
I'm currently developping a piece of software to play a song file accross multiple PC (currently simple laptop with poor speaker but that's next step). I m consequently splitting a WAV song file into individual mono channel PCM data file, each of them to be played by a different laptop.
I got correctly my mono channel file but I'm not able to play it correctly in my software. I don't know currently if it comes from my soft or from the laptop or else.
My misunderstanding starts there:
1) If a play my mono channel PCM file using linux sox:
play -b 16 -e signed-integer -c 1 -r 44100 -t raw Channel1.raw
It plays nice but with same sound duplicated on two laptop speaker. Why not only on Left ? or Right ? setting the -c 1 should not switch the sound card to mono ?
2) If I play this mono file using my home made C software using basically:
snd_pcm_sframes_t written = snd_pcm_writei(soundDevice,buffer.data,size);
it fails (ie it is played correctly but frequency is doubled as if it reads from the buffer two samples at a time (stereo) and not only (mono) thus artificially doubling the rate.
SoundDevice being configured in SND_PCM_ACCESS_RW_INTERLEAVED and SND_PCM_FORMAT_S16_LE. but I can't force the mono setting or the max channel = 1 in the software, as it is refused.
ret = snd_pcm_hw_params_set_channels (_soundDevice, hw_params, 1)) is returning -22 (EINVAL). Why is this refused ? due to laptop soundcard internal configuration ? or some trick in asoundrc could help me ?
Thanks in avance for your help because I'm a little bit stuck there since days...
Snarf