alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Clemens Ladisch <clemens@ladisch.de>
To: Luca Longhi <lucavermei@gmail.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: Create a stereo sound with alsa
Date: Sat, 28 Jul 2012 11:36:08 +0200	[thread overview]
Message-ID: <5013B288.7030304@ladisch.de> (raw)
In-Reply-To: <CAAiKgkvXysxM4q5kharx+BNS66_bQKAToByws46f53U0SoF59g@mail.gmail.com>

Luca Longhi wrote:
> Hi. I've written a code to play two different sine wave (same amplitude and
> f1=440Hz f2=600Hz) one on the left channel and the other on the right
> channel. It seems to be working. I've tried doing the same thing using two
> different sounds file (stereo) but the result is wrong.

>   err=snd_pcm_hw_params_set_format(handle, params, SND_PCM_FORMAT_S16_LE);	//16bit per campione=2byte per campione
>     ...
>     char * buffer1;
>     char * buffer2;
>     char * risultato;
>     ...
> 		{v1=buffer1[j1];}
> 		{v2=buffer2[j2];}
> 		risultato[i++]=v1;
> 		risultato[i++]=v2;

The device expects 16-bit samples, but you write 8-bit values.


Regards,
Clemens

      reply	other threads:[~2012-07-28  9:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-28  8:26 Create a stereo sound with alsa Luca Longhi
2012-07-28  9:36 ` Clemens Ladisch [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5013B288.7030304@ladisch.de \
    --to=clemens@ladisch.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=lucavermei@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).