Sound is NOT built into base MicroCore or TinyCore, sound is implemented via extensions. There are two options for sound with TC (as of 2009-09-30):
OSS
Alsa
If Alsa is adopted you may then consider using the sound server called pulseaudio.
OSS
Loading OSS.tcz should be enough to enable your sound automatically.
When first loaded you may like to open a terminal and run command….ossinfo to see if your card is detected.
If ok, you may wish to open cpanel…click on system stats then modules to see what modules are loaded.
Using this information, you can then navigate to
/usr/lib/oss/conf and related folders to tweak any setting you may need
Mixer levels
Either open a terminal and run command ossmix or I prefer to install the graphical mixer ossxmix.tcz
By default, oss has un-muted the normal outputs and inputs with volumes raised to an acceptable level.
Feel free to adjust volumes and un-tick to mute.
Persistence
Assuming you need persistence use root powers to edit your
/opt/.filetool.lst to add line
| usr/lib/oss/etc |
|---|
If needed add other conf lines to above file, if you needed to change any.
Then reboot, with backup, to test its ok.
(warning …aus9 is not an oss or alsa expert)
ALSA
You may need a number of packages not shown in the dependencies for the alsa package.
If you have the space and download bandwith I suggest you install a graphical mixer such as alsamixergui or you can use a terminal mixer called alsamixer from package alsa-config.tcz
The info page mentions multiple ways of installing…running and tweaking your alsa.
They include running sudo alsaconf or running alsasound
It can get tricky if you need to set a certain sound device to use index=0 or you prefer different mixer levels for multiple sound devices. Generally speaking it is better to set up one device and know its weaknesses and strengths and in theory can be setup by running sudo alsaconf.
alsaconf is not so good with multiple devices. YMMV
Alsa config link
If you need to change your model or use a quirk etc….please read this link and then follow the steps below.
http://www.kernel.org/doc/Documentation/sound/alsa/ALSA-Configuration.txt
Using sudo alsaconf
under construcion
Firstly, please update your apps thru the control panel…..”Update Apps”. Next try
sudo alsaconf
If it works you may be able to configure your device. But if you have multiple devices you may need to tweak your config files
The script searches for sound devices in its database and may offer you the correct device first time.
If you have an ISA also known as a non-plug in and play device, there is more searching to be done using that option.
If you can not see your device thru either of those searches then you will need to consider either OSS or run alsasound manually with a modprobe parameter or ask on the forums for help.
If this is the first time you have run alsaconf it will create a file /etc/modprobe.conf
Please ignore the literal offering to edit this file.
The script will not start an editor if you choose Yes…..but it is safe to choose Yes if your sound card was correctly detected
Next we see the alsaconf script jump to alsasound script.
You are likely to want to run a mixer to tweak the settings as basic alsamixer uses mixer levels from the file in alsasound….and that may not be your best option.
For those with portables you may need to lower the sound but for those with external desktop speaker (that include their own volume settings) I tend to raise mine to the max and then use the speaker controls to control the volumes. YMMV
Other parts of the wiki address mixer levels.
Next you can see the script end, even if you have yet to tweak your mixer levels.
Mixer levels are in another part of the wiki.
below is my image is showing the output of file /etc/modprobe.conf
Persistence
Add these files to your /opt/.filetool.lst
opt/alsa etc/modprobe.conf etc/asound.state
Note etc/asound.state is only required if you need to set better mixer levels from the defaults
If its needed then we also need to “restore” the correct levels using a command in bootlocal.sh like
/usr/local/sbin/alsactl restore
Tweaking /etc/modprobe.conf
under construction
Using alsasound
If alsaconf does not work for you, or if you have multiple devices and got lost in tweaking your /etc/modprobe.conf then you can try configuring sound using the script called alsasound and my method involves some manual tweaking depending on whether you need to set index or model other configs
Start the daemon with
sudo /usr/local/etc/init.d/alsasound start
Play some sound or as a normal user, run in terminal
speaker-test
Until you get levels or mutes correct…let it run loop after loop…..End the process by pressing the Control + C keys.
Otherwise run it as …..speaker-test -l 20…..where I have chosen 20 loops you can choose a different number
TC appears to use udev rules so sudo alsaconf may not be necessary.
Use a mixer to unmute Master and PCM levels and other settings as needed and raise the volumes.
On my host, onboard Intel with no tweaking my basic alsamixer looks like this after unmuting and adjusting levels
Create a sound mixer level config file (= /etc/asound.state) by running
sudo alsactl store
TIP the above command does not care what your previous settings were, so if the last setting gave errors, you can keep on tweaking and running that command until you are happy.
More information on how to use alsamixer is shown here
Persistence
Assuming you need persistence, we add the following lines using root powers to file /opt/bootlocal.sh
(add 2 lines as shown below)
| /bin/sleep 5 |
|---|
| /usr/local/etc/init.d/alsasound start |
|---|
To restore our new mixer level we need to edit with root powers the file /opt/.filetool.lst (note the dot please)
(add one line….note there is no / before the etc foldername)
| etc/asound.state |
|---|
Things we might do using alsaconf or alsasound
Reboot with backup
Reboot and test that your backup is correct. I suggest a small speaker-test or play some music?
Above image is for 2 loops a test on reboot.
Change default mixer levels for one sound device
If mixer level defaults to something you want to change, then for your preferred mixer change your levels for this session.
Next save those settings to a new file or edit the current file if you previously created it called /etc/asound.state
sudo alsactl store
This command can be issued numerous times with changing your mixer levels but be aware the command creates (or overwrites) your /etc/asound.state.
If you use alsamixer to set the levels….set them then press escape then issue the sudo alsactl store command
Next we need to add that file to your /opt/.filetool.lst as
etc/asound.state
Change default mixer levels for more than one sound device
If you have multiple devices and the defaults are wrong, try forcing your save mixer level command to unique filenames that you store in /home/tc
eg
sudo alsactl -f /home/tc/internal.state store
However you may need to blacklist the other sound device as mentioned in the other part of the wiki and assuming you used /home/tc there should be no need to add any file from this folder to your backup filetool.lst
However I have only one sound device so can not test.
So then we blacklist the internal module and see if the default mixer levels are ok for other device (maybe an usb sound device that portable people tend to use?)
and so we save a config for that with a slightly different filename
eg
sudo alsactl -f /home/tc/usb.state store
We then have a few choices to make?
(a) We could manually set “restore” the levels by command
eg
sudo alsactl -f /home/tc/usb.state restore
if on boot, our current defaults were incorrectly set to any internal device.
b) But its more likely that you use a certain device “always” and so we add the full pathway to bootlocal.sh
manual alsasound stuff
I will need to change this order later
Sound device models
I assume you are on TC series 3x
You may have a sound device that needs a setting to configure your sound device to get the relevant mixer channels.
I shall show you how to do it but first consider this new image. Compared to the earlier image, this one has more settings. Note that not all mixer channels have been set correctly but surround sound and other options are now available to me.
There are a series of steps which we need to go through and you do so only because your current settings are not sufficient.
Step 1
Identify your sound module. Yours may differ.
lsmod | grep snd | grep 0 |
eg my intel shows as
Step 2
Undo any persistence that restored your /etc/asound.state and-or ran any alsasound in /opt/bootlocal.sh
Step 3
Edit with root powers /mnt/somewhere/boot/grub/menu.lst (or if grub2 grub.cfg to remove your module by using a boot code.
eg
kernel blah blah blacklist=snd_hda_intel
(or for grub2
linux blah blah blacklist=snd_hda_intel)
For more on bootcodes check out the wiki at bootcodes
Step 4
Next we add stuff to bootlocal as that is actioned after the kernel has already loaded.
eg (in a code box for wiki format reasons)
##!/bin/sh - put other system startup commands here /sbin/modprobe snd_hda_intel model=5stack /usr/local/etc/init.d/alsasound start /bin/sleep 5 /usr/local/sbin/alsactl -f /home/tc/asound.state restore
In above example I only needed to get my mixer channels correct but you may need to blacklist soundcards etc. More on that later.
If you have USB sound devices please add a sleep after modprobing them (to start them after removal).
I found I need a small sleep after alsasound startup….YMMV
As TC is fast to reboot, it should not be long to test each time delay if you need any.
Intel cards due their varied codecs can still be troublesome and are more likely to need a sleep command as well.
Step 5
Reboot with backup. Your home/tc/asound.state does not yet exist so ALSA will use defaults values and we do not care as on reboot we will change them.
Step 6
Run alsamixer (or some other mixer) as a normal user to set volume levels and mute settings.
Step 7
Save those settings to a new pathway…..Not the default pathway please.
sudo alsactl -f /home/tc/asound.state store
Step 8
Reboot with backup to test.
Sound index values
As a general rule, most software applications, wanting to play or record sound, prefer to use the first detected sound device.
We call this index=0 even if you have not setup any index value.
If you have 2 or more or sound devices, from time to time you may need the index value to change because of the use of different software packages.
Lets look at someone with an internal device and an external device.
Options are:
A) Default, allow Alsa which is inside kernel to detect internal device first giving it the index=0 value.
Then you insert your usb or external device and so it gets index=1.
Due to the delay in populating usb devices, it might also be possible to leave your usb sound device connected at boot and still end up with index=1 for that external device.
b) Person finds internal device deficient for their use so blacklists the relevant sound moudule that would have enabled it, so on boot up, no internal sound is detected.
Now plugging in any external device will automatically get the first index value which is index=0.
C) Person finds internal sound device deficient but may occassionaly need it.
So we blacklist the sound module just as for (B) but create a bootlocal line to enable that internal device to be given index=1.
There is no need to create an udev rule to give the usb device index=0 because index=0 will be given to the device, when installed as its available.
The difference from B is that …..internal is index=1 and any inserted external is index=0
D) Person has 2 external devices and one internal.
More likely to need an udev rule, but by inserting in a particular order you should be able to grant index=0 against your favourite external sound device while blacklisting internal as per (B) or (C)
You may need to force a sound device not to use or to use a certain index number.
This can be tricky unless you have a good understanding of the results by blacklisting and modprobing in a certain order.
Lets show how to change index values for your existing device first?
Follow all steps for the model section but change the line to probe for your sound module to
/sbin/modprobe snd_hda_intel index=1
After reboot I run some commands in my terminal and lets look at this image
The first command displayed my mixer for sound card index=1 which I set.
The second command attempted to display my mixer for index=0, but as I have only one sound device, it found nothing so gave an error…which is what I want!
Example of 3 devices
Now that you can see that you can force your existing card to not use index=0….index=0 is available to other sound devices.
Lets pretend that a basic TC install for 3 sound devices (internal or external) showed the following index values
sound device A…index=0
sound device B…index=1
sound device C…index=2
Lets pretend that C must be index=0 but you don't care about the other order.
Then …in any order…bootlocal has modprobe -r (removals) for sound device A, B and C.
OR if you have the 3.x series amend your grub menu.lst or grub2 grub.cfg to include the new blacklist=module_name bootcode.
Without any “index=n” your next modprobe to load …must be C's ok?
Quirks
My intel card can't be tested for quirks as my sound is good.
But if you read the link you will see there are some quirks especially for AC97 cards.
For example it might be…..
/sbin/modprobe snd_intel8x0 ac97_quirk=hp_only
Combined line
I see no reason why a combination can not work on the one line.
eg /sbin/modprobe snd_hda_intel model=5stack index=1 quirk=x
Blacklisting of sound devices
For each target….add the relevant bootcode to blacklist the relevant module or modules to your bootloader config file, either menu.lst or grub.cfg
Explanation
When your kernel boots, your grub(grub2) boot code blacklists or stops your sound kernel module loading.
If you have 2 or more sound devices, the next card will get index=0 unless you tweak for that as well.
On bootlocal action, your currect “wrong” index or wrong mixer settings etc will be set by the defaults in /usr/local alsasound stuff.
Then your restore function kicks in and hopefully you arrive that the correct model, the correct quirk, the correct index etc.
If problems ....troubleshooting tips for Alsa
As we may have multiple files such as the persistence for grub(2) for blacklisting modules, mixer levels either at /etc/asound.state or somewhere else and scripts in /opt/bootlocal.sh……we may need some independent checks to help us if you have sound issues?
lsmod | grep snd |
to check that your blacklisting of relevant sound modules is still effective. If not, check if any upgrade has overwritten any of your files. This command is useful as an intermediate check that blacklisting works before adding modprobe for your sound device in bootlocal.
So if you had correct sound and now you don't, copy your bootlocal elsewhere and cull the real file with root powers to test that your grub blacklisting of sound modules actually works now.
Then add one line of your copied bootlocal to your real file and reboot after each change to try and catch any typos etc.
lsmod command hopefully will show both the hardware kernel module and the codec module.
alsamixer -c N
Where N=0 or 1 or 2 etc….to check the mixer levels where you have set (or unset) the index values.
If you have a portable with no USB speaker/mixers….you are likely to rely on the mixer levels to give you the correct volumes.
However, I have a desktop with external adjustable speakers and a voip headset with adjustable headphone output.
Try setting your volume for the headphone (front) mixer level to some number other than the one showing for your Master. So when you run it next time, with persistence you can quickly see ….its still set correctly?
cat /proc/asound/cards
checks what cards Alsa reports. Also shows interrupt number…..to independently test this and any shared IRQs try
cat /proc/interrupts
aplay -L aplay -l
Top command lists device names and bottom command list soundcards or digital audio devices including SPDIF
cat /proc/asound/card0/codec#0 | grep Codec |
to name your codec and
cat /proc/asound/card0/codec#0
a longer output to show you what mixer settings are available to you.
When a quirk a necessary…..its because the PINS are linked to the wrong setting. You can not influence the PINS directly.
I had sound and now I don't ?
Yes this can happen for a number of reasons.
a) The kernel has changed and so has the Alsa version, needing a new tweak?
Please read the info file for alsa or related packages such as
http://distro.ibiblio.org/pub/linux/distributions/tinycorelinux/3.x/tcz/alsa.tcz.info
b) Your grub has changed and your old menu.lst or grub.cfg no longer works and needs correcting. (This is unlikely for grub-legacy but may be more of an issue for grub2 but as you have to do things manually to either grub…..it is unlikely but mentioned as a possibility)
c) If Alsa has changed then so too has the hardware module, so you may no longer need a quirk?
d) If Alsa has changed so too may have the codec module.
e) You are using persistence and have not backed up the relevant files for persistence.
f) You have a rogue software application that STILL has control over your sound device and needs “killing”
Try
lsof | grep snd |
lsof is a separate package that you like to download.
Normal microphones
If you have normal 3.55 mm orange colour connector microphone, you may still need to do some tweaking.
Firstly record a sample through your mic and then play it back.
Naturally ensure you hear sound (out) before posting you have faulty mic settings please.
There is a catch in alsamixer. When you press the TAB key to go to input devices = capture devices…..you may see the word mic or not.
For my hardware, the setting can be changed from
mic (= back connector)
front mic
line
and I have 2 sliders and 2 settings in my alsamixer.
In above image, I have paired slider 1 with setting one and slider 2 with setting 2 so it reads
…the first capture device is raised volumes for input to max and is set to front mic….with its mux set to zero
…the second capture device is zeroed for back mix with dmux set to zero.
How to activate your mic
If your alsamixer volume for the input device (mic) can not be raised its muted so press the SPACE BAR in alsamixer to unmute or activate the mic then use the page up or down or arrow up or down to set the volume levels.
Above image shows the capture device=mic is active because there are red volume numbers and its been set to 79. Its input source has been tweaked to front mic….relevant only to those who have more than one mic input.
The mux setting is like a kind of mic amplifier and I suggest you do not use it unless with volumes maxed etc, you can not hear sufficient volume.
Note when raised …..mux….can lead to distortion.
How to change setting for mic
Press the right hand arrow until you get to either input source (0) or input source (1)…….then press the up key or the down key to change. Note that these keys are one way and do not offer the ability to cycle thru all the optins….so try going all the way up and all the way down (using arrow keys) to know your options please.
Recording and testing voice mic inputs
Try using terminal commands to record and replay your mic recording.
eg
arecord -d 10 /tmp/test.wav aplay /tmp/test.wav
The -d 5 means duration of 5 seconds, feel free to alter.
You can also see options arecord –help but I am mainly interested in the fact that you can hear your voice not the quality, and that volume is reasonable.
Normal feedback to mic due to having your mic close to speakers or by having the input slider too high can be tweaked by repeating the same set of commands…..interspersed with running alsamixer and tweaking the settings.
If you intend to do snazzy or sophicated voice recordings, please check out
Webcam microphones
I have an usb lead connected to a desktop pc that has a webcam.
It has no sound out, but a mic in.
Run alsamixer in a terminal or another mixer if you prefer. I then press F6 to show a range of sound devices and select by arrow my webcam.
Press F4 or press TAB key cycle thru to get to the input or capture section.
Depending on whether you are using skype or video recording, you may need to save a backup of your mixer levels for that webcam.
For problems with microphones see Forums, e.g. http://forum.tinycorelinux.net/index.php?topic=2083.msg16436#msg16436
Other web resources and credits
TC maintainers for OSS and Alsa
- -Jason W, Juanito, Curaga
http://alsa.opensrc.org/index.php/Main_Page
http://alsa.opensrc.org/index.php/TroubleShooting
http://alsa.opensrc.org/index.php/AlsaTips
(Above good for naming devices like PCM etc)
http://alsa.opensrc.org/index.php/Sound_Cards:_Introduction
http://wiki.archlinux.org/index.php/Advanced_Linux_Sound_Architecture
(Above covers a multitude of stuff including poor sound, sound pops, stutters etc)















