Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp606174rwe; Fri, 14 Apr 2023 07:28:11 -0700 (PDT) X-Google-Smtp-Source: AKy350b4XiVrOC+iGuK7B5800U9LKQg1g8yyqNSGzy+LAIkCUQv/6WkqoxymuEw+pwbOCpNNsF2f X-Received: by 2002:a05:6a00:1386:b0:625:cf03:e8cb with SMTP id t6-20020a056a00138600b00625cf03e8cbmr6019413pfg.4.1681482491143; Fri, 14 Apr 2023 07:28:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681482491; cv=none; d=google.com; s=arc-20160816; b=B/q8SGN7/0zxkGskVpT8fD1mEA5nRRx9ARBrcZqjvtPCx8CMf/R+QefbxPFZudp3cV p43ltH+3TNhPf35/lZNU89mzkX3n3P4ysMGhpbXTY2+O2QWSTIoXzGl/5pmYSI/Z0mBp nCJ6di3CmqrubJPzC6aCcCuxJ48Fnw2utYs10UtyBsRm//J/RfW5y00HOvg8q6dkedkQ EbP3mpxtfXQ5vm2sg+4P+zFN4sy+k6nNj+cfMl0oXvek+IiGOaNnzzvQJXy7yGJtZy/m kl1tmIbKd0slCA0oLNgZt9Jg7KBGnZLJneyivkjDs93Wtiq/63aBb5bnh4vMxl2llPuL giGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=r62Bg7taKN8ueg/SOljV3ygfYWsD/yfJ63Sah7gnkPQ=; b=aZY1+6FKlrPK0T6kSjD9zARILXozGVZI818e22NSZQb186q9GF2SeWm+p14YcdnU8l tWcoxLAZtjKrWm1ABSQXc+o1Xb9Fd/aie00qXZVm48UcorBTEoetPcnvX2LESBsj/YCB NzrQcmM4fg3hljpF8/vxhIaAlr0tVPAG8HbwAuMEu6mr0eEDz/NWQYuuM4We7fzr/91x xn5t6tQQAioV1uUaXZ7nBy2WGLs1B1OzFLL2izwiZXsir4PS+ZuXQyAhN2iSnW+yfaA1 o4ENIUw/3I4ynviJrHgsWcFwJJoRGUH1Y4ny54lc1I6WiX7+mdy3cnl8PixK8/DQ1bOo ezUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=NfzXTOro; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v190-20020a6389c7000000b0051b685209d5si2510476pgd.460.2023.04.14.07.27.55; Fri, 14 Apr 2023 07:28:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=NfzXTOro; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230496AbjDNO06 (ORCPT + 99 others); Fri, 14 Apr 2023 10:26:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230420AbjDNO0d (ORCPT ); Fri, 14 Apr 2023 10:26:33 -0400 Received: from mail-yw1-x112a.google.com (mail-yw1-x112a.google.com [IPv6:2607:f8b0:4864:20::112a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32834C64A; Fri, 14 Apr 2023 07:25:56 -0700 (PDT) Received: by mail-yw1-x112a.google.com with SMTP id 00721157ae682-54fe82d8bf5so33445747b3.3; Fri, 14 Apr 2023 07:25:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681482354; x=1684074354; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=r62Bg7taKN8ueg/SOljV3ygfYWsD/yfJ63Sah7gnkPQ=; b=NfzXTOron1qvqMumHJ8TbkBENXe0W8hViQyxOSbW5oiFrYwBM5Y1PvUiLuocP0FSju T/ZspDaJcRa4CmndQUDdbcsp5buNAYI3giOj7fxUJYss5yQdhJp7XUK5lev34FvbBYo/ AP9pcycJDxMDEKZ5P/PBeXcVv8iIPLCYOVQQg/EmVescSCpbmzeV9oeKqjXnDMeUGrsM ny9JSyRL39rWp3133GJtLcfXE4q/AGC+1ZpSJcN4wkxk2FwOvGHxRgVwBK1MUxVWKmV3 rz+7FkQvIzwWKlQ6vnSslruQgwY1wd+BgagHkS+H3rGhKCVxZgSZL7wTELmSJ8EAJkY0 b9tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681482354; x=1684074354; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r62Bg7taKN8ueg/SOljV3ygfYWsD/yfJ63Sah7gnkPQ=; b=SgCcDQ6GHoetBsKaGHmQ//+I8f99aglPMNrzszYJyZYBsLC/tWxU+DAZW9bV0jvjMi xpBLN8IbDQholqb8rpWxXO8CyU5HMHTMsT861QmAj6vMc1G6FVVhLW59xkl8HuNfvV0t YGNw9WFTfkAD/7fiuuy6q0t/taDw5hdXU/+SbXw3qNIvH6woAK/I5MVIA8VOE+EMu7CB X9EXBh8v7R4VcnSattPWIDET+Gs/WGan+QWI3z87fcrpdwTKeDmczYlEl6kRQjRN7sTf VxtZgmKcj0zJnYb6ROiif5zh0YgY0j2RjmG4gLC2pJxBFmf9D87/Jpx9VChFvZFhpJvf t96Q== X-Gm-Message-State: AAQBX9fDtWgG1BW6Wpk26K7lYUvj0AV2Dvj7d223/ia/t149/DC5KoWg KgqBBSre1FskGlmcI+4UyNHGDB/lzLYsT0RHFTithvtrMlc= X-Received: by 2002:a81:eb14:0:b0:54f:b986:9c60 with SMTP id n20-20020a81eb14000000b0054fb9869c60mr3688061ywm.7.1681482354504; Fri, 14 Apr 2023 07:25:54 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Muni Sekhar Date: Fri, 14 Apr 2023 19:55:43 +0530 Message-ID: Subject: Re: ALSA: arecord : silennce recorded as 0x80 To: Luke Koch Cc: LKML , alsa-devel , linux-sound@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 14, 2023 at 3:45=E2=80=AFPM Luke Koch w= rote: > > > On Thu, Apr 13, 2023 at 3:50=E2=80=AFPM Muni Sekhar 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 imposs= ible. Therefore the value is given a bias of 128, > making 0 the maximum negative amplitude, 255 the maximum positive, and 12= 8 the center point (or silence). Thanks for the clarification. So I tried passing signed 8-bit format (S8), and then the arecord died immediately, as mentioned below. $ arecord -f S8 test.wav Recording WAVE 'test.wav' : Signed 8 bit, Rate 8000 Hz, Mono arecord: begin_wave:2481: Wave doesn't support S8 format... For other format S16_LE, the arecord hangs for a few seconds and throws an I/O error. $ arecord -f S16_LE test.wav Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono arecord: pcm_read:2032: read error: Input/output error I am not sure why recording works only on the default format of U8. For other formats, the record either dies immediately or hangs for a timeout and then throws an I/O error. Any ideas about this behaviour? > > Best Regards, > Luke > > > --=20 Thanks, Sekhar