Tiny Core Linux

Tiny Core Base => Raspberry Pi => Topic started by: bmarkus on January 02, 2013, 12:57:44 PM

Title: Sound in piCore
Post by: bmarkus on January 02, 2013, 12:57:44 PM
You can expect ALSA available in the next few days. It works fine here. Also MOCP consol music player works fine with .mp3 files including id3tag display. Volume control doesn't work, but it's a good startup.

Title: Re: Sound in piCore
Post by: sbp on January 05, 2013, 06:09:01 AM
Hi bmarkus.

Im very interested in this.
So are you able to play mp3 as well as flac files, or do I need to install these codecs as well?
Probably, I can use the import script to instal the libFLAC, libmad, libfaad codecs.
Title: Re: Sound in piCore
Post by: bmarkus on January 05, 2013, 06:11:15 AM
No import needed, extensions are in test phase. There are few players are ready too, including mocp which is the best console player in my view.

BTW, FLAC and libmad as well as libvorbis already in the repo.
Title: Re: Sound in piCore
Post by: bmarkus on January 06, 2013, 04:05:03 AM
To get sound working with the on-board hardware, just install alsa.tcz from the repo. It will load and intialize all necessary components, no configuration needed.

At the moment only CLI players are available. Try moc.tcz which is tested with .mp3 and .flac but expected to work wind libvorbis and linsndfile supported files as well as speex. For .wav aplay can be used. Look around in the repo for other players.
Title: Re: Sound in piCore
Post by: sbp on January 06, 2013, 07:42:08 AM
Dear bmarkus

Thank you for this, I installed alsa.tcz and it installed fine.

I want to build a small software player to be used for playing music and radiostations from my Squeezebox server. Therefore I also installed "Squeezelite" a cli based audio player (for info see here :http://forums.slimdevices.com/showthread.php?97046-Announce-Squeezelite-a-small-headless-squeezeplay-emulator-for-linux-(alsa-only)
 
I started the player like this: ./squeezellite and it started fine. I could control it from within the squeezebox server (on another computer) and when I directed music (a flac file) to the Tinycore raspberry computer running alsa and the squeezelite player, I could hear music from the audiojack on the raspberry.

But the quality was very low. There is a lot of loud stuttering noise in front and behind this noise I could hear the music.

When looking at the log from the squeezelite player it stated that it could not find:

[12:14:50.735754] load_flac:175 dlerror: libFLAC.so.8: cannot open shared object file: No such file or directory
[12:14:50.736822] register_pcm:191 using pcm
[12:14:50.737577] load_mad:269 dlerror: libmad.so.0: cannot open shared object file: No such file or directory

So I was wondering if my problems is caused by missing flac codec on my raspeberry?

Steen
Title: Re: Sound in piCore
Post by: bmarkus on January 06, 2013, 07:52:42 AM

When looking at the log from the squeezelite player it stated that it could not find:

[12:14:50.735754] load_flac:175 dlerror: libFLAC.so.8: cannot open shared object file: No such file or directory
[12:14:50.736822] register_pcm:191 using pcm
[12:14:50.737577] load_mad:269 dlerror: libmad.so.0: cannot open shared object file: No such file or directory

So I was wondering if my problems is caused by missing flac codec on my raspeberry?

Steen

Steen

thanks for trying it. Please install flac.tcz and libmad.tcz from the repo to have missing libs.

Bela
Title: Re: Sound in piCore
Post by: sbp on January 06, 2013, 08:49:23 AM
Thank you for the help - no difference after I installed the codec.

I have asked the developer of the player if he can see any other problems in the log file - so hopefully I will get there.

Have you been able to hear audio through the USB and the HDMI?

Steen
Title: Re: Sound in piCore
Post by: bmarkus on January 06, 2013, 09:17:58 AM
For testing, install moc.tcz and play your .mp3 and .flac files. If they are OK, it is an application issue. If still quality is pure, need further investigation.

Title: Re: Sound in piCore
Post by: sbp on January 06, 2013, 09:44:48 AM
OK

Sound like a good idea.
I just installed MOC.tcz - it went well, However how do I start it??

I read at the MOC homepage in the Faq that the command mocp should start the player - but I get mcop: command not found?

Steen
Title: Re: Sound in piCore
Post by: bmarkus on January 06, 2013, 10:35:32 AM
OK

Sound like a good idea.
I just installed MOC.tcz - it went well, However how do I start it??

I read at the MOC homepage in the Faq that the command mocp should start the player - but I get mcop: command not found?

Steen

mocp -l <filname>

will start playing in the background.

mocp --help

will list available commands.

Title: Re: Sound in piCore
Post by: bmarkus on January 06, 2013, 10:38:49 AM

Have you been able to hear audio through the USB and the HDMI?


I have no USB soundcard, so can't test.

It may happen that your TV set recognised Pi as DVI device instead of HDMI and turned off sound. Edit config.txt in /mnt/mmcblk0p1 and uncomment

#hdmi_drive=2

It will force HDMI mode. I had the same issue, doing so HDMI sound works.

Title: Re: Sound in piCore
Post by: sbp on January 06, 2013, 01:13:34 PM
Dear bmarkus

I followed your advice and mcop is playing my flac files very good. There is no distortion at all.

So the Alsa sound you have made for tinycore raspberry is working fine.

I noticed however that it complained about:
Can't load plugin libmp3_decoder: file not found.
So I can't play mp3 files but the flac files played fine anyway.

 
Title: Re: Sound in piCore
Post by: sbp on January 06, 2013, 01:27:06 PM
SUCESS::::::::::

Dear Markus verything is working now. It was simply a matter of increasing the ALSA buffer_time (ms) and period_count, from the default 20:4 to 500:4.
I might reduce it step by step.

But Squeezelite can now be used on Microcore on a Raspberry - thanks to your work.

(NB it plays both MP3 and Flac.

Once again thank you very much.

Steen
Title: Re: Sound in piCore
Post by: bmarkus on January 06, 2013, 03:40:00 PM
Good to hear it works :)
Title: Re: Sound in piCore
Post by: sbp on January 20, 2013, 06:15:56 AM
Hi bmarcus.

The sound is working fine both via the analog 3.5" jack and also via a USB DAC - so that is good.

However if I try to start the alsa mixer we get this error:

tc@box:~$ alsamixer
alsamixer: error while loading shared libraries: libform.so.5: cannot open shared object file: No such file or directory

Is this because it is not included at this stage, or is there a problem somewhere?

Steen
Title: Re: Sound in piCore
Post by: Juanito on January 20, 2013, 06:22:53 AM
This means you need an ncurses extension, no?
Title: Re: Sound in piCore
Post by: bmarkus on January 20, 2013, 06:53:59 AM
This means you need an ncurses extension, no?

Right, ncurses is a soft dependency. Load ncurses.tcz
Title: Re: Sound in piCore
Post by: sbp on January 20, 2013, 07:34:36 AM
Thank you both.

I'm really impressed and grateful for your knowledge and continued help you provide.
Installing ncurses solved the problem.

Steen
Title: Re: Sound in piCore
Post by: cast-fish on January 21, 2013, 11:19:53 AM
Hello

this is absoluely great...working analogue and hdmi sound on the Pi

thanks a lot

Vince
Title: Re: Sound in piCore
Post by: gtr2 on May 28, 2013, 06:15:29 AM
To get sound working with the on-board hardware, just install alsa.tcz from the repo. It will load and intialize all necessary components, no configuration needed.
.... Try moc.tcz which is tested with .mp3 and .flac .....

Jinxed times really, but then again ...

Code: [Select]
tce-load -wi alsa.tcz
Code: [Select]
tce-load -wi moc.tcz
Code: [Select]
alsamixer unmuteF6 -> Soundcard ( I tried both, default and 0 bcm2835 ALSA )
Code: [Select]
mocpI can see that a *.flac file is being played but no sound can be heard from the analog 3.5" jack ( moc's pcm=00% )

These are the messages I'm getting:
Code: [Select]
Can't load plugin libmp3_decoder: file not found
Running the server...
Trying ALSA...

I've read that the libmp3_decoder error can be fixed by adjusting the ALSA buffer_time.  Can someone shed some light on this (?)
As far as I know, moc has got a config file which can be imported this way:
Code: [Select]
cd ~/.moc && cp /usr/share/doc/moc/examples/config.example.gz ./ && gunzip config.example.gz && mv config.example configIs there any similar way to do it on piCore ?

Title: Re: Sound in piCore
Post by: bmarkus on May 28, 2013, 06:38:20 AM
tce-load -iw libid3tag

Title: Re: Sound in piCore
Post by: gtr2 on May 28, 2013, 06:52:16 AM
Code: [Select]
tce-load -iw libid3tag
Right, *.mp3 files are now recognized and played. Still no sound  from the analog 3.5" jack ( moc's pcm=00% ) though.
Title: Re: Sound in piCore
Post by: bmarkus on May 28, 2013, 07:00:34 AM
Just repeated your steps, FLAC and MP3 playback works fine, I can listen music with earphone plugeend into the 3.5mm jack. Still some issue with WAV, will check.

Title: Re: Sound in piCore
Post by: bmarkus on May 28, 2013, 07:11:57 AM
Of course not. Your command is invalid. Use -R OR --sound-driver
Title: Re: Sound in piCore
Post by: gtr2 on May 28, 2013, 07:23:29 AM
Of course not. Your command is invalid. Use -R OR --sound-driver
My bad, you're right. The command runs well, still no sound though.
Title: Re: Sound in piCore
Post by: bmarkus on May 28, 2013, 07:48:28 AM
I would suggest to check your settings. Maybe you have the HDMI sound output configured. Just a thought.
Title: Re: Sound in piCore
Post by: gtr2 on May 28, 2013, 08:11:01 AM
I would suggest to check your settings. Maybe you have the HDMI sound output configured. Just a thought.
I already checked that. Neither HDMI nor 3.5mm jack sound. The thing that puzzles me most is that pcm=00% in moc.
What about the config file for moc, isn't there one ? I've used moc on various Linux distros and I have always had a config file.

I don't know if this might be of interest but ...

Code: [Select]
tc@box:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
tc@box:~$ aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
default:CARD=ALSA
    bcm2835 ALSA, bcm2835 ALSA
    Default Audio Device
sysdefault:CARD=ALSA
    bcm2835 ALSA, bcm2835 ALSA
    Default Audio Device
tc@box:~$
Title: Re: Sound in piCore
Post by: bmarkus on May 28, 2013, 08:15:31 AM
I have it alway 00% but playback is fine, alsamixer does its job.
Title: Re: Sound in piCore
Post by: bmarkus on May 28, 2013, 08:23:06 AM
Is it only an mocp issue? Do you get sound from other programs? Try aplay to isolate the issue.
Title: Re: Sound in piCore
Post by: sbp on May 28, 2013, 08:40:51 AM
Hi did you remember to use:
sudo modprobe snd_bcm2835
Title: Re: Sound in piCore
Post by: bmarkus on May 28, 2013, 08:45:26 AM
Hi did you remember to use:
sudo modprobe snd_bcm2835

It is done by the ALSA kernel modules extension automatically, no need to do maually.
Title: Re: Sound in piCore
Post by: gtr2 on May 28, 2013, 09:01:21 AM
Is it only an mocp issue? Do you get sound from other programs? Try aplay to isolate the issue.
Yes, aplay works flawlessly. Well, guess what, I really don't know what happened but the 3.5mm jack sound works now! Go figure ....
Thank you so much bmarkus for your assistance and patience.

Now for the config file part:
I'm using an old one from a Debian installation ( the following command doesn't work on piCore )
Code: [Select]
cd ~/.moc && cp /usr/share/doc/moc/examples/config.example.gz ./ && gunzip config.example.gz && mv config.example configHere is an example
Code: [Select]
http://dotfiles.org/~chillu/.moc/configI changed
Code: [Select]
SoundDriver = JACK:ALSA:OSSto
Code: [Select]
SoundDriver = ALSAOtherwise moc would complain about the sound driver being invalid.

One can also have a custom keymap, just like the following one
Code: [Select]
https://github.com/ecthiender/mocp-git/blob/master/keymap.exampleUnfortunately, I had to comment a lot of entries in that file in order to make it usable on piCore.
Title: Re: Sound in piCore
Post by: gtr2 on May 28, 2013, 12:36:09 PM
I hate to say it but the sound survived a couple of reboots and I had to cobble something up again.

The following has been working so far without any trouble.
1. Create a file called .asoundrc in /home/tc
2. Enter the following
Code: [Select]
pcm.!default {
type hw
card 0
}

ctl.!default {
type hw           
card 0
}
3. Save and exit.