6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu Nov 14, 2024 4:56 pm

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: MP3, Ogg, Wav, etc.
PostPosted: Tue Feb 14, 2006 11:07 pm 
Offline

Joined: Thu Jul 07, 2005 12:34 am
Posts: 23
Location: Minnesota
Hay, I was wondering if anyone had ever done anything with the 6502 that envolved sound files like mp3, ogg, wav, etc. What I'm looking for is there experiances and the limitations and programing of it. Thanks.

bvold, :D


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Feb 15, 2006 7:17 pm 
Offline

Joined: Thu Jan 16, 2003 12:55 pm
Posts: 64
Location: Indianapolis
wav would be really easy. All the samples I play are just plain 8-bit unsigned PCM. You'll want it in an optimal format, converting or decoding it (at high sample rates like 44.1khz) for every sample will take some major CPU time.

If the CPU is supposed to be doing anything else at the same time you'll want a timer that can trigger an IRQ. Any timing variations in the code during playback will make it sound like crap for sure.

Actually I was planning on doing a whole bunch of sample stuff on NES (1.789mhz 6502). So I thought I'd put a PIC MCU in my design for the interrupts and stuff, soon I realized I could just generate all my samples in the PIC and feed it to the NES. So now I've got a nice-sounding little 4-channel synth, and the only part the 6502 has to do is this (well, besides setting the samples/freqs/volumes etc.):

Code:
irq:
 pha
 lda $5000 ; in from PIC
 sta $4011 ; out to DAC
 pla
 rti


So I kinda cheated.. heheh. But I had to do, to get the results I wanted. You need to multiply (by volume) and add up the result to mix several channels with volume control. Or use some lookup tables to scale it. One sample at a time is a lot easier.

I doubt mp3 or ogg would be any good for 6502, but I'd be happy if someone surprised me. :)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Feb 15, 2006 11:11 pm 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
Memblers wrote:
I doubt mp3 or ogg would be any good for 6502, but I'd be happy if someone surprised me. :)


The problem is not the CPU architecture. The problem is clock speed. Even a 68020 at 8MHz will have a very hard time keeping up with Ogg or MP3.

You need at least a 50MHz machine or faster to be able to begin to play MP3s/Oggs in real-time. Otherwise, you'll want to pre-convert the audio to a more suitable format before playing.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Feb 17, 2006 9:28 pm 
Offline

Joined: Thu Jan 16, 2003 12:55 pm
Posts: 64
Location: Indianapolis
kc5tja wrote:
Memblers wrote:
I doubt mp3 or ogg would be any good for 6502, but I'd be happy if someone surprised me. :)


The problem is not the CPU architecture. The problem is clock speed. Even a 68020 at 8MHz will have a very hard time keeping up with Ogg or MP3.


Yeah, I'm always thinking in terms of real-time. For me, that's 1.79Mhz and there's not much more than 100 cpu cycles between samples at 44.1khz. DPCM or ADPCM might be worth looking into. That should be doable in real time.

I remember making my old 486/66 struggle to play MP3 files in Cubic Player, heheh (it almost could).


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Feb 17, 2006 10:49 pm 
Offline

Joined: Sun Sep 15, 2002 10:42 pm
Posts: 214
I looked at decoding MP3s on low-end processors before, and came to the conclusion that you needed about 10-15 MIPS in order to decode in realtime.

A 6502 at 2 Mhz would only be about 0.7 MIPS, so this is impractical.

There are a few MP3 decoder peripheral chips. If you used one, then it might become practical.

Toshi


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: