timrowledge
Posts: 1347
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Sound for Squeak/Scratch

Sun Jan 13, 2013 1:04 am

It’s been while since the first versions of Squeak went out into the world of RISC OS and I still haven’t made the sound output work. I’d like to fix that and make Scratch more interesting – it seems like RISC OS might be getting some more interest as part of that project.

I have no idea at all about sound on RISC OS. I have no more idea about sound on OS X or linux or Windows, but there is working code for those three platforms to help work out what is expected. I’m hoping to find someone with an interest in sound that can help to get this done.

Please; think of the children….
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Sound for Squeak/Scratch

Sun Jan 13, 2013 1:23 am

The sound SWI's for RISC OS are documented in the PRM that comes with RISC OS Pi. They should be in SDFS::RISCOSpi.$.Documents.Books.PRMs (assuming that you are running off the provided SDCard Image, and have not renamed the drive or moved the documents).

I can not be of any more help than this as I do not know or use Squeak or Scratch.

QUESTION: Beings that you are running RISC OS and BBC BASIC is a structured language (unlike other BASICs); would it not make more since to teach BBC BSIC as the begining language?

Especialy as you can do almost anything for RISC OS in BBC BASIC (even advaned WIMP programs [WIMP = GUI]), and by the time they learn BBC BASIC they will know pointers, inderect addressing, SWIs, and much more. Further I can not think of another language that has as low of an entry barier as BBC BASIC, and still teaches everything (even assembly if you wish to take it that far).
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Sound for Squeak/Scratch

Sun Jan 13, 2013 1:26 am

Oh almost forgot: The sound SWIs are documented in PRM4/PDF beginning on page 4-18 (the 28th page in the PDF file).
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

pygmy_giant
Posts: 1562
Joined: Sun Mar 04, 2012 12:49 am

Re: Sound for Squeak/Scratch

Sun Jan 13, 2013 1:30 am

BASIC does not have the 'oo' factor (object orientated).

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Sound for Squeak/Scratch

Sun Jan 13, 2013 2:06 am

This us true. I personaly think that t is beter to get into OO after you understand how everythng works. I know quite a few people that started out in OO languages that can not wrap there head around doing OO in ANSI C, because they ever learned the mechanics behind OO, beyond the most abstract simplifications.

On the other han most that learn the opisite way around have no trouble with doing OO in ANSI C, Assembly languag, or even BBC BASIC.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

AMcS
Posts: 184
Joined: Sun Jan 06, 2013 11:23 am
Location: Dublin, Ireland

Re: Sound for Squeak/Scratch

Sun Jan 13, 2013 1:13 pm

BASIC does not have the 'oo' factor (object orientated).
While that is true is it a problem in the context of a novice programmer or young person starting off in programming ?

OO is an *abstract* concept and as such for someone "just starting out", particularly a young person, it's best to put as few obstacles in the way to their learning as possible. I'd rather have someone start with a simpler (non-OO) language and progress to a more complex OO one later (when they feel ready for it) than to confront them with OO and have them give up and be put off at the very start.

BBC BASIC was *designed* to assist in good programming practice (yes it does have GOTO and GOSUB - but you can avoid these by using named procedures and functions, it had long variable names when others restricted you to single letters !) - and has proven itself with generations of school children - in fact I wouldn't be surprised if many people here started with it and then moved onto other languages. For education it just works.

If someone is proposing alternatives fine, but every language has it's pros and cons - not having OO in the context of someone just starting off in programming is, in my humble opinion, not particularly a big issue - if the person persists with programming they can always return to it later (anyway it's probably best that ultimately a person gets the chance to use a procedural non-OO language (BBC BASIC is arguably as good as any other), OO Based ones (take your pick...) and possibly even functional ones.

Learning programming is a process, if someone persists with it that is to the benefit of the person, they will in time learn other languages and will (hopefully) be open minded enough to choose the one(s) that best fulfil whatever programming tasks they undertake.

timrowledge
Posts: 1347
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: Sound for Squeak/Scratch

Sun Jan 13, 2013 8:09 pm

I have the PRMs (in fact I still have my copy of the original PRM single volume wire spiral bound from 1987 with pencilled in corrections and some hand-written comments from sophie wilson) but despite trying to make sense of the sound stuff on several occasions I've never been able to comprehend the connection between the system described and what I need to get working for Squeak.

I'd like to direct most of the conversation on this to the riscosopen forums in an attempt to keep a comprehensible thread going - https://www.riscosopen.org/forum/forums/11/topics/1629

Essentially I suspect I need the backend code from an mp3 player app, or perhaps a brain dump from someone that wrote such.
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Sound for Squeak/Scratch

Sun Jan 13, 2013 10:32 pm

Reading the thread you pointed out on Sound For Skueak/Scratch on the ROOL forum:

1:) It sounds like the system needs suport for a simple sampled sound output. Is this correct?

2:) What bit resolution, Sample frequency, and endian does this Squeak/Scratch sound system use natively?

3:) In what format is sound stored in these buffers in Squeak/Scratch.

As I stated earlier I do not know either Squeak or Scratch, though having read a couple of quick articles it sounds like the ideal third programming to teach a kid, after they have a good grasp on procedural programming and a usable understanding of ARM assembly.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Sound for Squeak/Scratch

Sun Jan 13, 2013 10:43 pm

Further one of the posts in that RISC OS forum points to another resorce that looks fairly helpful, and includes an example.
Here is the link:
http://www.acornarcade.com/articles/Bui ... x1209.html
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

neilf
Posts: 72
Joined: Sun Nov 11, 2012 8:14 am

Re: Sound for Squeak/Scratch

Sun Jan 13, 2013 11:04 pm

One of the posts in that RISC OS forum points to another resource that looks fairly helpful...
That's an excellent article - well worth bookmarking - thanks for pointing it out.

Ironically it was written by Jeffrey Lee, the man almost single-handedly responsible for getting Risc OS onto the R-Pi. He had 'a little help from his friends' of course, but huge chucks of the adapted code are down to him. Same goes for the Risc OS Beagleboard port.

timrowledge
Posts: 1347
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: Sound for Squeak/Scratch

Tue Jan 22, 2013 5:34 am

Good progress to report; I'm getting almost-correct noises out of the pi.
Is anyone out there familiar with the SharedSoundBuffer and StreamManager modules by John Duffell?
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

timrowledge
Posts: 1347
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: Sound for Squeak/Scratch

Thu Jan 24, 2013 3:14 am

Looks like scratch works ok on the pi. A bit slow I have to admit but cats meow, circles honk like geese, saving a project changes the window title, trying to record sounds doesn't crash (somebody made a right mess of the sound record code in that ancient image) and loading new image and sound samples works.
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Sound for Squeak/Scratch

Thu Jan 24, 2013 4:32 am

And now that I have had a chance to look at scrach a bit I would say that it makes a good precursor to teaching kids to program. This gives something to get the 4, 5, and 6 year kids interested. Kind like it was with LOGO Turtle Graphics in our day (and then you find out that LOGO can do so much more and are hooked on programming for life).
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

timrowledge
Posts: 1347
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: Sound for Squeak/Scratch

Mon Jan 28, 2013 5:44 am

There is now a RISC OS Squeak 4.0 with actual sound output available for testing - try http://www.rowledge.org/tim/squeak/Sque ... RISCOS.zipto download a bundle of the entire squeak setup, including the DeepKeys and SharedSoundBuffer modules, the Squeak .source file already installed and the image/changes file ready to go.

And if that seems to work, you might try a very sketchy Scratch try-out by downloading http://www.rowledge.org/tim/squeak/Scratch-RISCOS.zip – but you’ll need to have grabbed theSqueak package first in order to have the deepkeys/ssb modules.
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

tvjon
Posts: 783
Joined: Mon Jan 07, 2013 9:11 am

Re: Sound for Squeak/Scratch

Tue Jan 29, 2013 11:09 am

Sound seems fine on that download thanks.

I haven't used Scratch before (or RISCOS actually), although seen it's there on the Linux distribution, but I much prefer the responsiveness & generally better (to me) thought out implementation of an OS for educational purposes as RISCOS so far appears to be than Linux.

The step size for motion seems to be considerably shorter than in this basic tutorial I've briefly watched:

http://www.teach-ict.net/ks3/year7/game ... Basics.swf

so I'll see what I can find out.

timrowledge
Posts: 1347
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: Sound for Squeak/Scratch

Thu Jan 31, 2013 11:37 pm

A new version of RISC OS Scratch is now available - it includes the improved scratch image, better install info and all the OS modules required. Please give it a try.

http://www.rowledge.org/tim/squeak/Scratch_RISCOS-2.zip
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

pygmy_giant
Posts: 1562
Joined: Sun Mar 04, 2012 12:49 am

Re: Sound for Squeak/Scratch

Sat Feb 02, 2013 3:25 am

"Scratch may have gone wrong. Click Continue to try to try to resume or Quit to stop scratch."

"Return code too large"

I can see no DeepKey module as mentiones in the instructions so I think I am missing a piece....(?)

pygmy_giant
Posts: 1562
Joined: Sun Mar 04, 2012 12:49 am

Re: Sound for Squeak/Scratch

Sat Feb 02, 2013 6:06 pm

Nope - double checked - no Deepkey folder in the download as referred to in the instructions - bits missing - please put me straight if I'm wrong.

Anyone else got this working???

I really wnat my son to have a go with scratch on RISC OS as the posts relating to Linux scratch indicate performance problems.

pygmy_giant
Posts: 1562
Joined: Sun Mar 04, 2012 12:49 am

Re: Sound for Squeak/Scratch

Sat Feb 02, 2013 7:18 pm

Ah - just started working for no reason?! - thanks....!

timrowledge
Posts: 1347
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: Sound for Squeak/Scratch

Sat Feb 02, 2013 7:51 pm

Hi there pygmy_giant,
Well I see you got it working before I got around to reading todays posts but I'm interested to try to work out what went wring initially. (Huh 'wring'? Surely shame mistake of fisher?)

You should see four files in the ZIP
!!!!ReadFirst (I really want you to read that first…)
!Boot
!Scratch
!System

The copy of deepkeys is in the !Boot folder and *should* get installed by doing the boot merge described in !!!!ReadFirst. The copy of the SharedSoundBuffer & StreamManager modules should be in the !System folder and get installed by the System merge also described in !!!!ReadFirst.

It's certainly possible that I didn't describe how to do the install very well and I won't be at all offended if somebody offers an improved procedure. I've taken a look at using the !PackMan system for downloading but it explicitly disavows the ability to install deepkeys, which kinda spoils things.

Can you recall anything about what you did before the error came up? I haven't seen that exact error caused by Squeak (which is underneath Scratch) in… well, decades. What is your CPU setting in the !Configure window? I've been trying to rotate around them to test for issues but I can almost guarantee Murphy will have obscured some issue or other. What other apps were running? Was there by any chance a file named squeak/vmlog that appeared anywhere (possibly inside the !Scratch folder) ?
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

pygmy_giant
Posts: 1562
Joined: Sun Mar 04, 2012 12:49 am

Re: Sound for Squeak/Scratch

Sun Feb 03, 2013 3:26 am

Can you recall anything about what you did before the error came up?
I was doing nothing - I switched on with the sole intention of installing Scratch.
I haven't seen that exact error caused by Squeak (which is underneath Scratch) in… well, decades. What is your CPU setting in the !Configure window?
Arm 5 Compatability mode - is that wrong?
What other apps were running?
None
Was there by any chance a file named squeak/vmlog that appeared anywhere (possibly inside the !Scratch folder) ?
Not that I saw / can find.

Thanks again for all your hard work :)

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Sound for Squeak/Scratch

Sun Feb 03, 2013 11:52 am

I had actually got the same errors when I took a look at Squeak to see how the sound was working. It turned out to be simple, not enough memory allocated in the Wimpslot for squeak the default is:
Wimpslot -min 400k -max 700k
change to:
Wimpslot -min 800k -max 2048k
and all seems well.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

timrowledge
Posts: 1347
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: Sound for Squeak/Scratch

Sun Feb 03, 2013 6:29 pm

Hmph. Well that *is* strange, since obviously I've been running with the settings in the !boot file. I wonder what could make such a difference? Nearly all the memory Squeak/Scratch uses is in the large DA you would see upon opening the Tasks window; the VM itself doesn't really use a lot beyond the C stack and a few malloc'd buffers.

Guess we'll have to keep an eye on this; though it's a bit naff that you have to manually do this kind of thing. What is this, a 1980's OS ;-)
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Sound for Squeak/Scratch

Mon Feb 04, 2013 2:49 am

Odd, that does make this a puzzle, if it runs well with the default settings and is using duynamic areas for most things.

I have no idea why this works for some and not others????????????????????
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

pygmy_giant
Posts: 1562
Joined: Sun Mar 04, 2012 12:49 am

Re: Sound for Squeak/Scratch

Mon Feb 04, 2013 3:08 pm

I was using a 256mb rev 1.

Return to “RISCOS”