No sound after startx


25 posts
by freemink » Sat May 26, 2012 5:12 am
Hi,

Struggling to get any audio in X using Debian Squeeze

From command line I have built hello_audio.bin and that plays fine over hdmi
I do sudo modprobe before startx
I have created config.txt as suggested elsewhere (hdmi_drive=2)

Still nothing in X.

Any assistance/pointers greatly appreciated.

Thanks
Posts: 2
Joined: Sat May 26, 2012 5:04 am
by sorinm » Sat May 26, 2012 7:08 am
Use alsamixer to set your volume then alsactl store to save it.

I recommend using a cmd line player like mpg123 (mpg321) to test from cmd line the audio capabilities.
User avatar
Posts: 138
Joined: Sat Mar 03, 2012 10:41 am
Location: Romania
by g3sna » Sun May 27, 2012 11:49 am
Try this. Before startx type:

sudo modprobe snd_bcm2835

Then startx
Posts: 20
Joined: Sun Dec 25, 2011 8:04 pm
by AviateX14 » Sun May 27, 2012 4:20 pm
If the sudo modprobe command works, you can use this (my :D) patch to add it to the startup routine so you don't have to type it every time :P Just go here and download this file and untar the file to your 'pi' driectory. Then open terminal and type;
Code: Select all
./basic_sound_patch/fixsound


And once it's done reboot :P

Note: It will warn you about LSB and such, ignore it :)

Hope this helps,
-AvX
"It is pitch black. You are likely to be eaten by a grue."
User avatar
Posts: 13
Joined: Sun May 27, 2012 3:14 pm
Location: Rotherham, England, UK, Planet Earth, The Alpha Quadrant
by DavidMS » Sun May 27, 2012 4:43 pm
Thanks this worked for me
Posts: 65
Joined: Fri May 25, 2012 8:48 pm
by Grumpy Mike » Sun May 27, 2012 6:26 pm
Well being a Linux beginner opened up LXTerminal and tried
./basic_sound_patch/fixsound
and it said Permission denied
so I tryed:-
sudo ./basic_sound_patch/fixsound
and it said command not found?
any idea what to try next?
User avatar
Posts: 779
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
by AviateX14 » Sun May 27, 2012 6:54 pm
Erm, look in your 'pi' folder, is there a folder called 'basic_sound_patch'? Note, not basic_sound_patch.tar.gz
"It is pitch black. You are likely to be eaten by a grue."
User avatar
Posts: 13
Joined: Sun May 27, 2012 3:14 pm
Location: Rotherham, England, UK, Planet Earth, The Alpha Quadrant
by freemink » Sun May 27, 2012 7:14 pm
Thanks for help.

I reloaded the OS and using a different HDMI port I now have audio over hdmi. No audio in Scratch, but that's for another day...
Posts: 2
Joined: Sat May 26, 2012 5:04 am
by Grumpy Mike » Sun May 27, 2012 7:17 pm
AviateX14 wrote:Erm, look in your 'pi' folder, is there a folder called 'basic_sound_patch'? Note, not basic_sound_patch.tar.gz

Yes, I decompressed it on my Mac and transferred the folder called 'basic_sound_patch' into the pi folder on an SD card.
User avatar
Posts: 779
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
by AviateX14 » Sun May 27, 2012 7:23 pm
Erm, I'm not sure this will work, but you could try going into the folder, right-clicking it, and running it with LXTerminal, though I don't know if that will work for certain.
"It is pitch black. You are likely to be eaten by a grue."
User avatar
Posts: 13
Joined: Sun May 27, 2012 3:14 pm
Location: Rotherham, England, UK, Planet Earth, The Alpha Quadrant
by Grumpy Mike » Sun May 27, 2012 8:25 pm
When you do that absolutely nothing happens, the icons just laugh at you.
I have checked the permissions on the files and I have read and write permission.

Sadly this is what I am finding with Linux, a lot of stuff simply doesn't work.
User avatar
Posts: 779
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
by piglet » Sun May 27, 2012 8:31 pm
Grumpy Mike wrote:Sadly this is what I am finding with Linux, a lot of stuff simply doesn't work.


I'll fix it for you:

Grumpy Mike wrote:Sadly this is what I am finding with Linux, a lot of stuff simply doesn't work like Windows.
User avatar
Posts: 562
Joined: Sat Aug 27, 2011 1:16 pm
by AviateX14 » Sun May 27, 2012 8:36 pm
Right, I'll go and find an easier way for you to do that and get back to you asap.

Linux is a massive change, more so from Mac where everything is colourful and easy, it might take a while to get used to, it relies much more on commands (unless you were using one of the more popular distros, but as of yet they aren't supported)this guide gives a nice overview of it, and teaches the basics.
"It is pitch black. You are likely to be eaten by a grue."
User avatar
Posts: 13
Joined: Sun May 27, 2012 3:14 pm
Location: Rotherham, England, UK, Planet Earth, The Alpha Quadrant
by Grumpy Mike » Sun May 27, 2012 8:48 pm
piglet wrote:
Grumpy Mike wrote:Sadly this is what I am finding with Linux, a lot of stuff simply doesn't work.


I'll fix it for you:
Grumpy Mike wrote:Sadly this is what I am finding with Linux, a lot of stuff simply doesn't work like Windows.


I take deep offense to that :o You would know if you actually bothered to read what I put that I am on a Mac and have been ever since my first one in 1984. I have been doing embedded work since 1975 and electronics since the mid 60s. I have NEVER used windows willingly and find it totally stupid. How do you turn off a windows computer, you click on the button that says start. Yer logical!

What I say is true a lot of Linux stuff does not work, that is one reason why I wanted to explore the Pi. However if you have nothing useful to say then shut up! You are one of the reasons why Linux gets a bad name.
User avatar
Posts: 779
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
by AviateX14 » Sun May 27, 2012 9:12 pm
Grumpy Mike, I've found an easier way.

First of all, have you set a root user password yet? If not, go to step one, if you have, step two.

Step One
1) Logon to your pi as normal, open terminal and type:
Code: Select all
sudo passwd root

2) Enter a password of your choice, just make sure you know it.
3) Exit terminal and shutdown your pi.

Step 2
1) Turn on your pi, when it prompts you to login, type the username, root and the password as whatever you selected in step one.
2) Enter the command startx to bring up the GUI.
3) Open the file browser and go to the directory /etc/ and find the file 'modules' (You can do this quickly by just typing 'modu' in the etc folder
4) Right click the file, Open with > Other > Leafpad > OK
5) Create a new line beneath vchiq and type:
Code: Select all
snd_bcm2835

6) Save the file, reboot, login as normal, it should work.

Hope this helps!
-AvX
"It is pitch black. You are likely to be eaten by a grue."
User avatar
Posts: 13
Joined: Sun May 27, 2012 3:14 pm
Location: Rotherham, England, UK, Planet Earth, The Alpha Quadrant
by Grumpy Mike » Sun May 27, 2012 9:33 pm
OK AviateX14 - thanks for your suggestions

I tried again but this time doing the decompression on the Pi, the results were different.
When you say:-
Note: It will warn you about LSB and such, ignore it

Does that include saying there is no such file as sound-init
chmod: cannot access /etc/init.d/sound-init no such file or directory
update-rc.d: error: unable to read /etc/init.d/sound-init
Done.

It looks to me a whole lot of other nothing is being done.

Why would decompressing the file in a different place make any difference?

EDIT. While typing this I got your latest message.
I would amend step 3 to say
3) Open the file browser and go to the directory /etc/ , by clicking the up arrow in the window bar
being new I had a bit of trouble with that.

Anyway the result is it does work this time, and my LXMusic player is producing sound. Thank you very much. :D :D

As a learning exercise any idea why the original instructions would not work for be where as they seemed to work for that other guy?
User avatar
Posts: 779
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
by AviateX14 » Sun May 27, 2012 9:52 pm
Ah, I'm glad I helped, happy to be of service, feel free to PM me anytime in the future :)

I'm glad you told me about that problem, it hadn't occurred to me until now, the reason a whole lot of nothing was happening is because in my script I had the relative path, not the absolute path to the sound-init. As for why it wouldn't work after unpacking on the Mac, I'd imagine something similar to this. Thankyou for telling me, I've updated it now :P
"It is pitch black. You are likely to be eaten by a grue."
User avatar
Posts: 13
Joined: Sun May 27, 2012 3:14 pm
Location: Rotherham, England, UK, Planet Earth, The Alpha Quadrant
by AviateX14 » Sun May 27, 2012 9:58 pm
The working version is now here should anyone need it in the future.
"It is pitch black. You are likely to be eaten by a grue."
User avatar
Posts: 13
Joined: Sun May 27, 2012 3:14 pm
Location: Rotherham, England, UK, Planet Earth, The Alpha Quadrant
by MarshallBanana » Sun May 27, 2012 10:34 pm
Grumpy Mike wrote:As a learning exercise any idea why the original instructions would not work for be where as they seemed to work for that other guy?


probably because execute-permissions were not set on the file due to copying it to your pi from the mac? when in a terminal typing "ls -l" will show contents of the current folder with more info about each file/folder, the file-permissions are in the first part which looks like
-rwxrw-r-- pi users blablabla
drwxr-xr-x root root blalblbla
or similar... if the first letter is a d it means its a directory/folder/whatever-the-name-is-you-are-used-for them. there are others (like links, character and block devices, but they won't matter for the current explaination). on your file the first character there should have been - as its a normal file... the next part is: 3 letters owner-user permissions, 3 letters group permissions, 3 letters "all other users" permissions
of these permissions a r means "is allowed to read", a w is "can write to" and an x means "can execute it", so r-x means "can read it, can execute it but may not write to it"
after this letter-combinations the owner and the group is listed.

meaning in my first example "-rwxrw-r-- pi users" means that
a) it is a normal file
b) the user "pi" may read file, write to file and execute file
c) all other users in the group "users" may only read and write to file
c) all other users of the system that are not in the group "users" can only read it

so after your fist try there was probably the execute "x" permission missing, so a
chmod a+x filename would probably have been the solution in the first place... (give x permissions to everyone)

(on terminal doing "man chmod" would give you the manual pages for the chmod with a more in depth explaination of the chmod possibilities)
Posts: 24
Joined: Sat Jan 21, 2012 9:19 pm
by Grumpy Mike » Mon May 28, 2012 1:31 pm
Thanks Marshal,
I thought it might be something to do with permissions but when I checked it on the desktop it said I had read / write permission. It looks like there are more permissions than that.

I can only assume that DavidMS took the idea and implemented it in a more educated way than just following orders. ;)
Thanks again for the explanation.
User avatar
Posts: 779
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
by bredman » Mon May 28, 2012 3:23 pm
AviateX14 wrote:The working version is now here should anyone need it in the future.


This is an innovative way to fix the problem, but it is very roundabout.

The correct way to start a module automatically is to add its name to the file /etc/modules. Exact instructions are...

Enter the command
sudo nano /etc/modules

You will find yourself in a editor. Add the following line at the end of the file.
snd_bcm2835

To save the file press ctrl-o. To exit the editor press ctrl-x. Job done!
Posts: 1413
Joined: Tue Jan 17, 2012 2:38 pm
by saintalan » Mon May 28, 2012 7:03 pm
Thanks AviateX14 now have sound in the little media player and manged to fill my HDMI monitor with no underscan!

Cheers

Alan
Posts: 10
Joined: Sun Feb 26, 2012 11:20 am
by SN » Tue May 29, 2012 3:33 pm
Using mplayer as my player of choice (at the moment) and I'm finding that I get random lockups - it freezes - usually after less than 20 seconds
If i Ctrl-Z it the following gets generated
Code: Select all
[AO_ALSA] Write error: Operation not permitted
[AO_ALSA] Trying to reset soundcard.
[AO_ALSA] alsa-lib: pcm_hw.c:558:(snd_pcm_hw_prepare) SNDRV_PCM_IOCTL_PREPARE failed (-16): Device or resource busy

If I restart it with fg or bg it continues to play for a while and then stops again
Is there a fix for this yet?
Steve N – binatone mk4->intellivision->zx81->spectrum->cbm64->cpc6128->520stfm->pc->raspi ?
User avatar
Posts: 1009
Joined: Mon Feb 13, 2012 8:06 pm
Location: Romiley, UK
by MattHawkinsUK » Tue May 29, 2012 8:01 pm
Grumpy Mike wrote:How do you turn off a windows computer, you click on the button that says start. Yer logical!


Given you eject a floppy disk on a Mac by dragging it to a trash can I think the score is fairly even ... and don't get me started on Mac's where the power button was next the floppy drive where most other computers would have an obvious eject button! Every time I accidentally turned one off when trying to eject a disk a little piece of my brain died.

Ignoring Linux in general, the Pi is a different beast and if it wasn't a challenge to tinker with most people would be bored with it already ;-)
My Raspberry Pi blog and home of the BerryClip Add-on board : http://www.raspberrypi-spy.co.uk/
Follow me on Google+, Facebook and Twitter (@RPiSpy)
User avatar
Posts: 479
Joined: Tue Jan 10, 2012 8:48 pm
Location: UK
by handuel » Sun Jul 29, 2012 1:49 pm
The issue with permissions was the fact that you had read/write permissions, but not execute permissions to the file. For future refference, and to anyone reading the thread, execute permissions can be given using chmod +x "filename"

Also I understand that you were frustrated when you said that's the problem with linux, it just doesn't work, please can you refrain from saying stuff like that in the future. Many of the people helping you will (like me) be members of the linux community, and we don't nesscarilly take kindly to people insulting linux. This may mean that they may be less inclined to help you :cry: Anyway I hope you enjoy your pi, have fun :)
Posts: 15
Joined: Sun Jul 29, 2012 1:45 pm