Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Guilherme Longo <grlongo.ireland@gmail.com>
To: alsa-devel@alsa-project.org
Subject: Re: Controling wave amplitude using alsa api !! (pcm interface ???????)
Date: Wed, 05 Aug 2009 08:35:49 -0300	[thread overview]
Message-ID: <4A796E95.6080008@gmail.com> (raw)
In-Reply-To: <4A7863EB.5090207@gmail.com>

Hi again.

I've got half of my work done with it. I found the values of the samples 
been analyzed, **BUT* *it is given in a strange unity!

while (count-- > 0) {
                 res = sin(phase) * 15000;
                 ires.i = res;
                 tmp = ires.c;
               * printf("som -> %g\n", res);  // Here I get the values*
                 for (chn = 0; chn < channels; chn++) {
                        for (byte = 0; byte < (unsigned int)bps; byte++)
                                 *(samples[chn] + byte) = tmp[1];
                                  samples[chn] += steps[chn];
                 }

Now, how can I transform this samples in a more human understandable 
notation as in Db unity for example?
Is there any alsa api function to control it? Should I use the mixer  
interface somehow?

This is the output:

som -> 11976.3
som -> 11387
som -> 10752.9
som -> 10076.6
som -> 9360.7
som -> 8608.02
som -> 7821.53
som -> 7004.31
som -> 6159.56
som -> 5290.63
som -> 4400.9
som -> 3493.89
som -> 2573.15
som -> 1642.3
som -> 704.996
som -> -235.076
som -> -1174.22
som -> -2108.76
som -> -3035.01
som -> -3949.33
som -> -4848.14
som -> -5727.91

Thanks!
Guilherme Longo wrote:
> Hi all!
>
> Mates, I am following the example PCM.C that I found at alsa web site. 
> its a sine wave generator.
> I am looking for a control that alsa provides to control the amplitude 
> of the wave.
>
> As I could found so for, there is just frequency control... I didn't 
> find any amplitude control.
>
> * I don't want to control the volume using alsamixer or even my 
> sound... I want to generate a wave with predefined amplitude.
>
> Does anyone could give me a little help??
>
> Thanks a lot!
>
>

  parent reply	other threads:[~2009-08-05 11:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-04 15:18 [PATCH 3/3] ASoC: add machine driver for i.mx27_visstrim_m10 board javier Martin
2009-08-04 16:38 ` Controling wave amplitude using alsa api !! (pcm interface ???????) Guilherme Longo
2009-08-04 17:08   ` John L. Utz III
2009-08-05 11:35   ` Guilherme Longo [this message]
2009-08-04 19:54 ` [PATCH 3/3] ASoC: add machine driver for i.mx27_visstrim_m10 board Mark Brown

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=4A796E95.6080008@gmail.com \
    --to=grlongo.ireland@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    /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