Monday, 15 February 2010

Mary had a ...

Had a go out sound in - and couldn't get it to work at first, so I went for a nice ride. Just a casual 58km with a long beer and pizza stop at a mate's on the way. I was a little sore and tired by the time I got home (mostly from the saddle; haven't ridden that bike much for ages), but after a decent sleep, not a hint of soreness.

After I got home and became bored with TV I decided to have a search on the net about sound again - and the vital clue - aux-in is line-level and not mic-level (well I should've known that but it all goes through the same amps). So the code was working after-all, I plugged a laptop out into line-in and got some results.



Actually I worked out that if I use a speaker (or headphones) as the line-in, I can get enough signal as well, but I left the gain at 0dB for a line-level signal.

Then I wrote a very simple synthesiser loop which plays 'mary had a little lamb' (badly) with a triangle-wave and simple ADSR envelope (in true SID-chip style!), and then jumps to a rather annoying 440Hz sound which phases from side to side, whilst showing the line-in waveform on the screen (as in the screenshot).

Source in audo-beep.c, which includes all of the initialisation code as well.

There's a commented line in the init:
aregw(AV_ATX2ARXPGA, (7 << 3) | 7);
which can send the digital signal from line-in directly to the output. But the signal is really rather awful, and doesn't seem to match the data received, with lots of clipping and nastiness. Probably some bad interaction with the synethsiser data, and not biasing things properly.

This code doesn't use DMA, so is about as simple as you can get whilst still making noises.

Hmm, I wonder what to do next. Having USB for keyboard and mouse is a real pain, it's pretty hard to do much interesting `computer' stuff when you only have a serial port for communications.

Now to get 'mary had a little lamb' out of my head ...

8 comments:

Jason Kridner said...

Is there an entry for PuppyBits on the BeagleBoard project page?

NotZed said...

Not sure - I don't think so.

Jason Kridner said...

Can I encourage you to add one to http://beagleboard.org/project so that people can find a starting point that is free of an operating system.

NotZed said...

Sigh, yet another login to forget.

I guess it's at a usable enough stage to add something, done.

Jason Kridner said...

It is using OpenID to avoid exactly that problem. I do have some problems with some OpenID providers. I welcome patches to fix that bug.

DaniGermany said...

Great Work!!!

DaniGermany said...

...bur i've problems to play with interrupts.

You have disaled "cpsie if" , why?
Is there a way to use interrupts for gpio and timer?


daniel

p.s. sorry for my rusty english

NotZed said...

"...bur i've problems to play with interrupts.

You have disaled "cpsie if" , why?
Is there a way to use interrupts for gpio and timer?"

Yes there is, although I too have had trouble getting it to work (see much earlier posts on frustrations with timers).

Interrupts are just disabled since I don't use them yet, and I know the interrupt routines are not working. That's something I was going to look at in the future. Probably soon, since I have hit some road-blocks for other ideas, and I need to work them out eventually.