Apologies if this has been answered elsewhere - I have searched and couldn't find anything on this precise topic.
I've got sound working on my RasPi - I can play MP3s in VLC and the media player included with the Debian Squeeze image just fine through my TV over HDMI. But I can't get any sound out of Scratch - I either get silence or an 'invalid sound format' message from Scratch. Any ideas?
Sound in Scratch
22 posts
- Posts: 2
- Joined: Tue May 15, 2012 7:25 am
- Location: SE London
I have the same issue.
Here's how I fixed half the problem. This worked for me but I really don't know what I'm doing - I'm not familiar with debian or smalltalk so I don't recommend you try this
I found a script that I assume is written in smalltalk that runs when you run scratch. It's at /usr/bin/scratch
I removed code that *looks like* it's setting up the sound, and added code that sets the sound to use alsa drivers - which I installed on my system when I was trying to get sound to output to the jack rather than the default auto select (I'm using HDMI it a monitor with a separate audio in).
I changed the lines that say:
to say this instead
The # symbols comment out the old code so it's ignored.
Now I can make the cat meow (i.e. scratch plays the silent files) but it still won't load some of the files included in scratch.
Hope this helps, let me know if you find a better solution!
Simon
Here's how I fixed half the problem. This worked for me but I really don't know what I'm doing - I'm not familiar with debian or smalltalk so I don't recommend you try this
I found a script that I assume is written in smalltalk that runs when you run scratch. It's at /usr/bin/scratch
I removed code that *looks like* it's setting up the sound, and added code that sets the sound to use alsa drivers - which I installed on my system when I was trying to get sound to output to the jack rather than the default auto select (I'm using HDMI it a monitor with a separate audio in).
I changed the lines that say:
- Code: Select all
if pulseaudio - - check 2>/dev/null ; then
VMOPTIONS="$VMOPTIONS -vm-sound-oss"
if padsp true 2>/dev/null ; then
WRAPPER=padsp
fi
fi
to say this instead
- Code: Select all
#if pulseaudio - - check 2>/dev/null ; then
# VMOPTIONS="$VMOPTIONS -vm-sound-oss"
# if padsp true 2>/dev/null ; then
# WRAPPER=padsp
# fi
#fi
VMOPTIONS="$VMOPTIONS -vm-sound-alsa"
The # symbols comment out the old code so it's ignored.
Now I can make the cat meow (i.e. scratch plays the silent files) but it still won't load some of the files included in scratch.
Hope this helps, let me know if you find a better solution!
Simon
- Posts: 1
- Joined: Wed May 23, 2012 12:16 pm
[quote="Sharks58uk"]I have the same issue.
Here's how I fixed half the problem. This worked for me but I really don't know what I'm doing - I'm not familiar with debian or smalltalk so I don't recommend you try this
you are kidding, if you don't know what you're doing then I'm in real trouble
Took me an hour to work out where to do the typing, anyway it works a treat for me, many thanks
Re the audio socket, a man elsewhere says it has to be amplified to get any sound from it
Thanks again
JG
Here's how I fixed half the problem. This worked for me but I really don't know what I'm doing - I'm not familiar with debian or smalltalk so I don't recommend you try this
you are kidding, if you don't know what you're doing then I'm in real trouble
Took me an hour to work out where to do the typing, anyway it works a treat for me, many thanks
Re the audio socket, a man elsewhere says it has to be amplified to get any sound from it
Thanks again
JG
- Posts: 51
- Joined: Sat Mar 03, 2012 6:33 pm
jgearing wrote:Sharks58uk wrote:I have the same issue.
Here's how I fixed half the problem. This worked for me but I really don't know what I'm doing - I'm not familiar with debian or smalltalk so I don't recommend you try this![]()
you are kidding, if you don't know what you're doing then I'm in real trouble
Took me an hour to work out where to do the typing, anyway it works a treat for me, many thanks
Re the audio socket, a man elsewhere says it has to be amplified to get any sound from it
Thanks again
JG
I've had sound coming out of it just fine into my headphones (in ear style) playing from the default audio player in debian. No idea on how to get scratch working for you though!
- Posts: 6
- Joined: Wed Nov 16, 2011 12:51 pm
I have the same problem - probably a stupid question but I do not seem to have permission to make this change, am I missing something. I am trying to make the change from using Leafpad, I have tried to change the permissions but seemingly I do not have permission to to this !
- Posts: 48
- Joined: Fri May 25, 2012 8:48 pm
You may need to log in as root to do this - not as pi.
If you log in as pi, you can set the root password using 'sudo passwd root'. Then logout and log in again as root.
If you log in as pi, you can set the root password using 'sudo passwd root'. Then logout and log in again as root.
- Posts: 8
- Joined: Sun May 27, 2012 9:36 am
Hi
I have the same problem.
Please could you tell me the file path where I need to comment out the above code.
Thanks
Davy
I have the same problem.
Please could you tell me the file path where I need to comment out the above code.
Thanks
Davy
- Posts: 4
- Joined: Sat Jun 30, 2012 2:41 pm
He said it was :
[quote]I found a script that I assume is written in smalltalk that runs when you run scratch. It's at /usr/bin/scratch[\quote]
T.
[quote]I found a script that I assume is written in smalltalk that runs when you run scratch. It's at /usr/bin/scratch[\quote]
T.
"!.8inch TFT LCD + Switch Shield v2" add-on boards for sale here :
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=59&t=43286
50p goes to the Foundation
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=59&t=43286
50p goes to the Foundation
- Moderator
- Posts: 1407
- Joined: Sat Mar 03, 2012 10:59 am
- Location: Berkshire, England
Hi
Thanks for pointing that out - completely missed when I read it the first 5 times.!
The solution worked perfectly.
Much appreciated.
Regards
Dave
Thanks for pointing that out - completely missed when I read it the first 5 times.!
The solution worked perfectly.
Much appreciated.
Regards
Dave
- Posts: 4
- Joined: Sat Jun 30, 2012 2:41 pm
It took me a while (and some research) to figure out why anyone would assume this was Smalltalk - seemed like the least likley choice. It is in fact just a Bash shell script.
Any how in my Debian Wheezy image /usr/bin/scratch is an empty folder. The actual name of the file would be useful, or if anyone knows its new location?
Any how in my Debian Wheezy image /usr/bin/scratch is an empty folder. The actual name of the file would be useful, or if anyone knows its new location?
- Posts: 30
- Joined: Fri May 04, 2012 3:19 pm
I'm using the same Debian Wheezy image and I can confirm this works.Clifford wrote:It took me a while (and some research) to figure out why anyone would assume this was Smalltalk - seemed like the least likley choice. It is in fact just a Bash shell script.
Any how in my Debian Wheezy image /usr/bin/scratch is an empty folder. The actual name of the file would be useful, or if anyone knows its new location?
You just need to type...
- Code: Select all
sudo nano /usr/bin/scratch
Regards,
RandomCoder
"Defeat never comes to any man until he admits it."Josephus Daniels
- Posts: 20
- Joined: Mon Jul 16, 2012 9:12 pm
You just need to type...
- Code: Select all
sudo nano /usr/bin/scratch
Doh! I was looking for a directory called /usr/bin/scratch and was wondering why @Sharks58uk was not being very specific about the file name! That is how I interpreted
.I found a script that I assume is written in smalltalk that runs when you run scratch. It's at /usr/bin/scratch
Thanks.
- Posts: 30
- Joined: Fri May 04, 2012 3:19 pm
Works a treat
Thanks
Thanks
- Posts: 1
- Joined: Mon Aug 06, 2012 10:31 am
To those who had sound trouble even after following the posts here (changing the VMOPTIONS to use alsa and doing the amixer cset numid=3 2. Similar with many people in this and other posts, HDMI sound works with aplay or mpg123 test or mplayer playing wave/mp3 files - but not with scratch.
What I did to troubleshoot was start scratch manually in a x-term window with the alsa sound:
Once scratch was loaded, I tried to execute a sound (meow) and I got the error logged in the xterm:
So I thought there might be some sort of a conflict in sound drivers. Out of curiosity, I looked at my processes and saw that the pulseaudio daemon was also running. I killed pulseaudio
After the pulseaudio was killed, tried the scratch meow again and it worked. I'm not a linux expert, so I don't know why scratch using also does not work with the pulseaudio daemon is started. I took out the pulseaudio from being started during boot by moving the pulseaudio start script out of the /etc/init.d. All sound seems to be working fine now.
Hope this helps out those with scratch sound over HDMI issues.
What I did to troubleshoot was start scratch manually in a x-term window with the alsa sound:
- Code: Select all
/usr/lib/squeak/4.47-2357/squeakvm -encoding UTF-8 -vm-display-x11 -xshm -plugins /usr/lib/scratch/plugins/:/usr/lib/squeak/4.47-2357/ -vm-sound-alsa /usr/share/scratch/Scratch.image
Once scratch was loaded, I tried to execute a sound (meow) and I got the error logged in the xterm:
soundStart: snd_add_pcm_handler: Function not implemented
So I thought there might be some sort of a conflict in sound drivers. Out of curiosity, I looked at my processes and saw that the pulseaudio daemon was also running. I killed pulseaudio
- Code: Select all
pulseaudio --kill
After the pulseaudio was killed, tried the scratch meow again and it worked. I'm not a linux expert, so I don't know why scratch using also does not work with the pulseaudio daemon is started. I took out the pulseaudio from being started during boot by moving the pulseaudio start script out of the /etc/init.d. All sound seems to be working fine now.
Hope this helps out those with scratch sound over HDMI issues.
- Posts: 1
- Joined: Tue Mar 06, 2012 8:39 pm
Thank you very much for finding a fix to the problem which has been bugging me from the first time I tried Scratch on my Pi. All now working properly on first and latest versions of OS using a DVI monitor and analogue sound via an amplifier. Great!
- Posts: 22
- Joined: Sun Aug 28, 2011 2:50 pm
- Location: Leicester, UK
Commenting out statements relating to pulseaudio from /usr/bin/scratch and adding the extra command
VMOPTIONS="$VMOPTIONS -vm-sound-alsa"
seems to work in Scratch but disables sound in Music Player!
Any thoughts?
VMOPTIONS="$VMOPTIONS -vm-sound-alsa"
seems to work in Scratch but disables sound in Music Player!
Any thoughts?
- Posts: 4
- Joined: Mon Jul 09, 2012 10:17 am
Hi all! I'm a member of the Scratch Team who has done some work on the linux packaging. I have a couple of questions / info that might be helpful to those who are doing the packaging for rPi.
Does Raspbian use pulseaudio?
If it does, then it's probably best to use the pulseaudio driver. The current debian package uses OSS in a pulsewrapper, but I think that's because Debian doesn't use pulse (?)
You can use Alsa for playback, but the sound record functions don't often work and result in a "pink box" crash on Scratch. That's what I'm seeing when I run Scratch on my rPi with ALSA sound driver.
Pulse is supposed to emulate ALSA, so it should be fine to run Scratch with ALSA on pulse. But Pulse doesn't emulate the asynchronous ALSA functionality that Scratch needs. So, at least on Ubuntu (and I assume other distros that use pulse), it's best to use the squeak pulse audio plugin. It has recently been updated so it will work properly with 64 bit systems -- (previously it caused seg faults). Not sure if it's compatible with ARM. If rPI doesn't use pulse, then ALSA should work well AFAIK. Not sure why it's pink boxing on sound records.
Devs / packagers - I'm cc'ed on some emails about rPi and Scratch, so if you have questions, drop me a line and I'll clarify. Or use the contact us link on the Scratch website.
Love me some pi! (Makes a great home webserver!)
Amos
Scratch Community Coordinator
Does Raspbian use pulseaudio?
If it does, then it's probably best to use the pulseaudio driver. The current debian package uses OSS in a pulsewrapper, but I think that's because Debian doesn't use pulse (?)
You can use Alsa for playback, but the sound record functions don't often work and result in a "pink box" crash on Scratch. That's what I'm seeing when I run Scratch on my rPi with ALSA sound driver.
Pulse is supposed to emulate ALSA, so it should be fine to run Scratch with ALSA on pulse. But Pulse doesn't emulate the asynchronous ALSA functionality that Scratch needs. So, at least on Ubuntu (and I assume other distros that use pulse), it's best to use the squeak pulse audio plugin. It has recently been updated so it will work properly with 64 bit systems -- (previously it caused seg faults). Not sure if it's compatible with ARM. If rPI doesn't use pulse, then ALSA should work well AFAIK. Not sure why it's pink boxing on sound records.
Devs / packagers - I'm cc'ed on some emails about rPi and Scratch, so if you have questions, drop me a line and I'll clarify. Or use the contact us link on the Scratch website.
Love me some pi! (Makes a great home webserver!)
Amos
Scratch Community Coordinator
- Posts: 10
- Joined: Wed Jun 20, 2012 11:57 am
Hi folks, I modified the /usr/bin/scratch launcher script a little while ago so the vm-sound-alsa plugin is used. You'll have this version if you have the latest 2012-08-16-wheezy-raspbian.zip image. If you have an older Foundation Raspbian image, just do `sudo apt-get update && sudo apt-get install scratch`.
- Moderator
- Posts: 660
- Joined: Fri Sep 16, 2011 7:16 pm
My grandson has the Raspberry Pi so I can't test it out but, on behalf of many,
Thanks for looking into this problem.
Thanks for looking into this problem.
- Posts: 4
- Joined: Mon Jul 09, 2012 10:17 am
amending /usr/bin/scratch
pay attention to grammar , punctuation and spaces.
Worked for Me, My son is very happy and now enjoying his firs
t programme.
pay attention to grammar , punctuation and spaces.
Worked for Me, My son is very happy and now enjoying his firs
- Posts: 1
- Joined: Mon Apr 23, 2012 8:32 am
Sharks58,
The fix mostly worked for me as well. (forcing line 89 of /usr/bin/scratch: VMOPTIONS='$VMOPTIONS -vm-sound-alsa')
The exceptions were:
1. On a subsequent launch, I noticed that MP3 sounds (Cat.MP3) didn't play, and WAV sounds (Bird.WAV) did.
2. On a subsequent launch, the RaspberryPi hung (froze) when I attempted to play the Cat sound.
Brian Jester
The fix mostly worked for me as well. (forcing line 89 of /usr/bin/scratch: VMOPTIONS='$VMOPTIONS -vm-sound-alsa')
The exceptions were:
1. On a subsequent launch, I noticed that MP3 sounds (Cat.MP3) didn't play, and WAV sounds (Bird.WAV) did.
2. On a subsequent launch, the RaspberryPi hung (froze) when I attempted to play the Cat sound.
Brian Jester
Brian Jester
- Posts: 6
- Joined: Wed Jan 09, 2013 5:51 pm
- Location: Alaska
vn00325,
When I launched /usr/bin/scratch with a "-x" on the shebang line (line #1), I saw on the console:
snd_pcm_writei returned -1
This was after the fix to line 89 for "-vm-sound-alsa".
Brian Jester
When I launched /usr/bin/scratch with a "-x" on the shebang line (line #1), I saw on the console:
snd_pcm_writei returned -1
This was after the fix to line 89 for "-vm-sound-alsa".
Brian Jester
Brian Jester
- Posts: 6
- Joined: Wed Jan 09, 2013 5:51 pm
- Location: Alaska