# Sound but no Sound



## Dave Lister (Jun 5, 2020)

I've been playing with this for a few days now, and have gotten to that dangerous stage of making random attempts with whatever clues my searches yield. So before I completely make a pig's ear of it.

I currently can get sound out of my desktop speakers from the audio-output jack-socket at the rear of the PC tower, if the sound is from a Youtube video running on the Firefox browser. However, I don't get any sound output if I try and play a standard test wav file (piano2.wav) or an mp3 file (hendrix.mp3 - who else).  

eg.

```
# play piano2.wav

piano2.wav:

 File Size: 1.21M     Bit Rate: 1.54M
  Encoding: Signed PCM    
  Channels: 2 @ 16-bit   
Samplerate: 48000Hz      
Replaygain: off         
  Duration: 00:00:06.31  

In:100%  00:00:06.31 [00:00:00.00] Out:303k  [      |      ]        Clip:0
```


Also, and which is probably related, I cannot record mic input (or possibly playback), yet if I tap, whistle or talk into the mic it comes through the speaker albeit with slightly poor quality. My mic is similarly plugged into the audio-input jack-socket at the rear of the PC tower.

Initial applications I tried to test sound include `xoscope` - which has a trace but doesn't respond to any mic input, `audacity` - which appears to record, but nothing plays back.  I've also installed among other things `pulseaudio, ffmpeg, moc, and mplayer`.

From the outset I followed the instructions in the `7.2 Setting up the Sound card chapter in the Handbook.`

I've added changes to config files:-

```
# cat /boot/loader.conf
cuse_load="YES"
snd_hda_load="YES"
fuse_loader="YES"
```

Here's rc.conf, though I don't think it is involved.

```
# cat /etc/rc.conf
hostname="red-dwarf"
ifconfig_fxp0="DHCP"
sshd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
dbus_enable="YES"
hald_enable="YES"
gdm_enable="YES"
sddm_enable="YES"
slim_enable="YES"
devfs_system_ruleset="localrules"
cupsd_enable="YES"
devfs_system_ruleset="system"
#webcamd_enable="YES"
```

dmesg yields

```
# dmesg | grep pcm
pcm0: <Realtek ALC882 (Rear Digital 10ch/2.0)> at nid 20,22,21,23,30 and 31 on hdaa0
pcm1: <Realtek ALC882 (Analog 2.0/5.1)> at nid 27 and 26,28,24 on hdaa0
```

I also changed:-

```
# systctl hw.snd.default_unit=1
hw.snd.default_unit: 1 -> 1
```

Mixer output is:-

```
# mixer
Mixer vol      is currently set to  78:78
Mixer pcm      is currently set to 100:100
Mixer line     is currently set to  71:71
Mixer mic      is currently set to  67:67
Mixer cd       is currently set to  50:50
Mixer rec      is currently set to  26:26
Mixer igain    is currently set to 100:100
Recording source: line, mic, cd
```

I have tried :-

```
# sysctl hw.snd.default_auto=1
hw.snd.default_auto: 0 -> 1
```

but that doesn't seem to have any effect either.

Under the MATE gui, from Applications->Sound & Video->Sound my Sound Preference have Input set to `/dev/dsp1` and Output set to `/dev/dsp0`

Any help would be much appreciated.


----------



## tuxador (Jun 5, 2020)

Did you try to plug your speaker /headphone on both  the front jack and the rear jack?


----------



## Dave Lister (Jun 5, 2020)

tuxador said:


> Did you try to plug your speaker /headphone on both  the front jack and the rear jack?



Only tried the mic on both front and back ports - back works but front doesn't.  The speaker has always been on the back, but since it plays music on Youtube fine, I figured that the output port isn't the problem there.  Firefox is seemingly doing something right with sound that the rest of the system isn't.

EDIT: Possibly something to do with HTML5 or pulseaudio.


----------



## Dave Lister (Jun 5, 2020)

FIREFOX


```
# pkg info firefox
firefox-76.0.1_2,1
Name           : firefox
Version        : 76.0.1_2,1
Installed on   : Tue May 26 15:56:35 2020 UTC
Origin         : www/firefox
Architecture   : FreeBSD:12:i386
Prefix         : /usr/local
Categories     : www
Licenses       :
Maintainer     : gecko@FreeBSD.org
WWW            : http://www.mozilla.com/firefox
Comment        : Web browser based on the browser portion of Mozilla
Options        :
    ALSA           : on
    CANBERRA       : off
    DBUS           : on
    DEBUG          : off
    FFMPEG         : on
    GCONF          : on
    JACK           : on
    LIBPROXY       : off
    OPTIMIZED_CFLAGS: on
    PROFILE        : on
    PULSEAUDIO     : on
    SNDIO          : on
    TEST           : off
Shared Libs required:
    libdbus-glib-1.so.2
    libgtk-x11-2.0.so.0
    libXext.so.6
    libpango-1.0.so.0
    libfreetype.so.6
    libpixman-1.so.0
    libcairo.so.2
    libgtk-3.so.0
    libffi.so.6
    libxcb-shm.so.0
    libX11-xcb.so.1
    libXt.so.6
    libwebp.so.7
    libcairo-gobject.so.2
    libatk-1.0.so.0
    libevent-2.1.so.7
    libplc4.so
    libvpx.so.6
    libXcomposite.so.1
    libxcb.so.1
    libgdk_pixbuf-2.0.so.0
    libgio-2.0.so.0
    libssl3.so
    libXfixes.so.3
    libwebpdemux.so.2
    libnss3.so
    libnssutil3.so
    libnspr4.so
    libgobject-2.0.so.0
    libglib-2.0.so.0
    libharfbuzz.so.0
    libicuuc.so.66
    libdav1d.so.4
    libdbus-1.so.3
    libXdamage.so.1
    libgraphite2.so.3
    libgdk-x11-2.0.so.0
    libpng16.so.16
    libXrender.so.1
    libaom.so.2
    libfontconfig.so.1
    libicui18n.so.66
    libsmime3.so
    libX11.so.6
    libgdk-3.so.0
Annotations    :
    FreeBSD_version: 1201000
    cpe            : cpe:2.3:a:mozilla:firefox:76.0.1:::::freebsd12:x86:2
    no_provide_shlib: yes
    repo_type      : binary
    repository     : FreeBSD
Flat size      : 188MiB
Description    :
Mozilla Firefox is a free and open source web browser descended from the
Mozilla Application Suite. It is small, fast and easy to use, and offers
many advanced features:

o Popup Blocking
o Tabbed Browsing
o Live Bookmarks (ie. RSS)
o Extensions
o Themes
o FastFind
o Improved Security

WWW: http://www.mozilla.com/firefox
```

AUDACITY


```
# pkg info audacity
audacity-2.3.3_2
Name           : audacity
Version        : 2.3.3_2
Installed on   : Wed Jun  3 15:18:11 2020 UTC
Origin         : audio/audacity
Architecture   : FreeBSD:12:i386
Prefix         : /usr/local
Categories     : audio
Licenses       : GPLv2+
Maintainer     : xxjack12xx@gmail.com
WWW            : https://www.audacityteam.org/
Comment        : GUI editor for digital audio waveforms
Options        :
    DEBUG          : off
    DOCS           : on
    DYNLOAD        : off
    FFMPEG         : off
    FLAC           : on
    ID3TAG         : on
    LADSPA         : on
    LAME           : off
    LV2            : off
    MAD            : on
    MOD_NYQ_BENCH  : off
    MOD_SCRIPT_PIPE: off
    NLS            : on
    SBSMS          : on
    SOUNDTOUCH     : on
    SSE            : off
    TWOLAME        : on
    VAMP           : on
    VORBIS         : on
    VST            : on
Shared Libs required:
    libmad.so.0
    libexpat.so.1
    libid3tag.so.0
    libpango-1.0.so.0
    libFLAC.so.8
    libcairo.so.2
    libvorbisenc.so.2
    libsndfile.so.1
    libgtk-3.so.0
    libsoxr.so.0
    libcairo-gobject.so.2
    libatk-1.0.so.0
    libwx_gtk3u_xrc-3.1.so.3
    libtwolame.so.0
    libSoundTouch.so.1
    libgdk_pixbuf-2.0.so.0
    libasound.so.2
    libgio-2.0.so.0
    libwx_baseu_net-3.1.so.3
    libwx_gtk3u_qa-3.1.so.3
    libogg.so.0
    libwx_gtk3u_html-3.1.so.3
    libwx_baseu_xml-3.1.so.3
    libglib-2.0.so.0
    libFLAC++.so.6
    libgobject-2.0.so.0
    libwx_gtk3u_core-3.1.so.3
    libintl.so.8
    libvorbis.so.0
    libvamp-hostsdk.so.3
    libvorbisfile.so.3
    libwx_baseu-3.1.so.3
    libgdk-3.so.0
    libportaudio.so.2
    libpangocairo-1.0.so.0
Annotations    :
    FreeBSD_version: 1201000
    cpe            : cpe:2.3:a:audacity:audacity:2.3.3:::::freebsd12:x86:2
    repo_type      : binary
    repository     : FreeBSD
Flat size      : 22.9MiB
Description    :
Audacity is a program that lets you manipulate digital audio
waveforms. In addition to letting you record sounds directly from
within the program, it imports many sound file formats, including
WAV, AIFF, AU, IRCAM, MP3, and Ogg Vorbis. It supports all
common editing operations such as Cut, Copy, and Paste, plus it will
mix tracks and let you apply plug-in effects to any part of a sound. It
also has a built-in amplitude envelope editor, a customizable
spectrogram mode and a frequency analysis window for audio
analysis applications.

WWW: https://www.audacityteam.org/
```

Anyone know how I might turn FFMPEG on in Audacity?


----------



## Dave Lister (Jun 8, 2020)

I tried adding mpg123 command line mp3 player, then playing an mp3 file:-

```
# mpg123 -a /dev/dsp1.0 "02 - Hunter.mp3"
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
    version 1.25.13; written and copyright by Michael Hipp and others
    free software (LGPL) without any warranty but with best wishes
[src/libout123/modules/oss.c:178] error: Can't open /dev/dsp1.0!
[src/libout123/libout123.c:455] error: Found no driver out of [sndio,oss] working with device /dev/dsp1.0.
main: [src/mpg123.c:314] error: out123 error 3: failure loading driver module
```

So it seems like I am looking for a driver (sound card I guess) for dsp1.0


----------



## George (Jun 8, 2020)

> Anyone know how I might turn FFMPEG on in Audacity?


You would need to recompile it with that option turned on. Basically, you'd need to build it via ports (with `make config install clean`.

/dev/dsp%d is created by sound().

Just to get it right. You have sound in Firefox, but not in other apps? 

This is from the handbook: "When unsure which driver to use, load the snd_driver module, `kldload snd_driver`."


----------



## Dave Lister (Jun 8, 2020)

Elazar said:


> You would need to recompile it with that option turned on. Basically, you'd need to build it via ports (with `make config install clean`.
> 
> /dev/dsp%d is created by sound().
> 
> ...


Thanks, I have reinstalled Audacity and I saw ffmpeg as an install option so I checked it. Still can't play mp3s or wav files though - which is now important as I just transferred 20 gigs of mp3 files over to my hard drive.

To confirm yes, I have sound in Firefox - Youtube audio plays no problem.

I've also loaded the snd_driver.


----------



## hruodr (Jun 9, 2020)

I have similar problems with packaged VoIP softphones. No one works, at least not out of the box. Perhaps the who built the packages did not test them with a frish FreeBSD installation. But mpg123 do work.


----------



## George (Jun 9, 2020)

> mpg123 -a /dev/dsp1.0 "02 - Hunter.mp3"


For me, this works: `mpg123 -a /dev/audio "myfile.mp3"`


----------

