Kernel Newbies archive mirror
 help / color / mirror / Atom feed
From: Luke Koch <lu.ale.koch@gmail.com>
To: Muni Sekhar <munisekharrms@gmail.com>
Cc: alsa-devel <alsa-devel@alsa-project.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-sound@vger.kernel.org,
	kernelnewbies <kernelnewbies@kernelnewbies.org>
Subject: Re: ALSA: arecord : silennce recorded as 0x80
Date: Fri, 14 Apr 2023 12:15:29 +0200	[thread overview]
Message-ID: <CAPDUAqPVDi4TgAja92tMqMp6rGAyC-eabS_6+W0zThKfsZAxGA@mail.gmail.com> (raw)
In-Reply-To: <CAHhAz+haVH-4Hgsz0PpTgUSW1pX4XxwxXwEd7nLVb0sFFwQwCg@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1102 bytes --]

On Thu, Apr 13, 2023 at 3:50 PM Muni Sekhar <munisekharrms@gmail.com> wrote:
>
> Hi all,
>
> I recorded the silence on the default audio card by running "arecord
> -d 5 test.wav."
>
> Once it exited, I checked the contents by running "hexdump test.wav,"
> and I see that silence is recorded as a sequence of 0x80 instead of
> 0x00.
>
> 0000000 4952 4646 0024 8000 4157 4556 6d66 2074
> 0000010 0010 0000 0001 0001 1f40 0000 1f40 0000
> 0000020 0001 0008 6164 6174 0000 8000 8080 8080
> 0000030 8080 8080 8080 8080 8080 8080 8080 8080
> 0000040 8080 8080 8080 8080 8080 8080 8080 8080
> ...
>
> What might be the reason for silence being recorded as 0x80 instead of
0x0?
>
>
> --
> Thanks,
> Sekhar

This is what I found after Googling a bit:
Since you didn't specify a format, arecord defaults to 8 bit format (U8).
Being unsigned, a negative value for maximum negative amplitude is
impossible. Therefore the value is given a bias of 128,
making 0 the maximum negative amplitude, 255 the maximum positive, and 128
the center point (or silence).

Best Regards,
Luke

[-- Attachment #1.2: Type: text/html, Size: 1486 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

      reply	other threads:[~2023-04-14 10:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-13 13:49 ALSA: arecord : silennce recorded as 0x80 Muni Sekhar
2023-04-14 10:15 ` Luke Koch [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=CAPDUAqPVDi4TgAja92tMqMp6rGAyC-eabS_6+W0zThKfsZAxGA@mail.gmail.com \
    --to=lu.ale.koch@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=munisekharrms@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 read-only IMAP folder(s) and NNTP newsgroup(s).