View unanswered posts | View active topics It is currently Sat Sep 20, 2014 1:53 am



Reply to topic  [ 41 posts ]  Go to page Previous  1, 2
 PWM Sound Driver 
Author Message

Joined: Sat Jul 17, 2010 3:11 am
Posts: 19
Location: CA
Post 
It doesn't recognize "OC8RS" so it definitely has a different name, I'm just having a tough time finding it.

_________________
- Eviscerate Core


Tue Aug 17, 2010 9:38 pm
Profile
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 291
Post 
This is what sucks about having a zillion versions of header files, the best thing to do is look in the data sheet, and then do a grep thru the header file for "OC" and "output comapare" and hopefully, you can find the header section that defines these names..

Andre'


Tue Aug 17, 2010 11:07 pm
Profile WWW
User avatar

Joined: Sat Nov 21, 2009 6:16 pm
Posts: 10
Post 
Eviscerate Core,

To test my sound driver i used your sound files. They played nicely in my hardware. Is there any way I could get my hands on your (compiled) C# program to convert wav files to unsigned char arrays? can it downsample?

My game is kinda dull without sounds.

Thanks


Sat Aug 21, 2010 2:13 pm
Profile

Joined: Fri Jul 08, 2005 7:01 am
Posts: 6
Location: Iowa
Post 
On the topic of sound, I found this Boulder Dash game someone created for the PIC18 that supports VGA and a 4 voice sound player. I think this would be worth looking into just for the sound routines alone.

http://www.pic24.ru/doku.php/en/osa/articles/vga_game


Sat Aug 21, 2010 3:35 pm
Profile WWW

Joined: Sat Jul 17, 2010 3:11 am
Posts: 19
Location: CA
Post 
To s4w2099, my program is stripped apart right now as I am experimenting with different ways to do the audio. It doesn't even save as arrays anymore, but I'll try to find the time to get it working this weekend. When I finish all my drivers, I'll eventually release a fully functioning version of the program. That's not going to be for a while though.

To JT, thanks for the post. I checked out the code, and there are definitely some neat routines going on in that game. I like how he made note lists for the music, and his program reads through it. I want to attempt something similar to that, but using sampled sounds. So say I have a trumpet sample of middle C, I want to be able to play that sample back at varying frequency to reproduce entire octaves.

_________________
- Eviscerate Core


Sat Aug 21, 2010 11:15 pm
Profile
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 291
Post 
Someone port this to the XGS PIC-16!!!

Andre'


Sun Aug 22, 2010 12:25 am
Profile WWW
User avatar

Joined: Sat Nov 21, 2009 6:16 pm
Posts: 10
Post 
Nice, thanks.

I remembered a great tool to do something similar. A while ago I took a class on basic DSP. We used MATLAB, to process the audio. Then, what I did was to download a MATLAB knock off (open-source) that has some functions to read/write and process wav files. This program is called Octave. Since this is a math program its easy to scale, downsample and manipulate the data. Sure, you can also plot it to see what it looks like, FFT and all.

Here is the code I run from Octave's console:

[y, Fs, bits] = wavread('siren.wav');
y=y.*100;
y=y+abs(min(y));
fp=fopen('output.txt', 'w');
fprintf(fp, '%d, ', y);
fclose(fp);

It is pretty obvious what it does. Reads a wav file into an array called 'y', then it multiplies the array by 100 (thats my volume), then it shifts all the data above the y axis (no negative values), then it simply dumps all the data as integer to the file output.txt

The result is a very nice sound. I guess it could be better though. The wav file sounds a lot better when played in the computer. But it is a start.

:-)


Sun Aug 22, 2010 2:14 am
Profile
User avatar

Joined: Sat Nov 21, 2009 6:16 pm
Posts: 10
Post 
BTW JT:

Thanks for the link, that guy is very good. It is a very nice, tight little program. Sounded very decent in the video.


Sun Aug 22, 2010 2:31 am
Profile
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 291
Post 
I haven't heard of that one -- looks like C syntax, that's pretty cool :)

Andre'


Sun Aug 22, 2010 3:32 am
Profile WWW
User avatar

Joined: Sat Nov 21, 2009 6:16 pm
Posts: 10
Post 
necron wrote:
I haven't heard of that one -- looks like C syntax, that's pretty cool :)

Andre'


Yes, C syntax for many things. The most common C IO functions are supported by MATLAB/octave like printf, fprintf etc. They are really cool because you can use them to format your output as wished.


Sun Aug 22, 2010 3:23 pm
Profile
Site Admin
User avatar

Joined: Fri Aug 08, 2003 7:01 am
Posts: 20
Location: Utah, USA
Post 
necron wrote:
I haven't heard of that one -- looks like C syntax, that's pretty cool :)

Andre'


Octave is just the free open source version that mimics matlab.

Kind of like open office is to Microsoft office.

_________________
Gimp


Sun Aug 22, 2010 7:52 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 41 posts ]  Go to page Previous  1, 2

Who is online

Users browsing this forum: No registered users and 0 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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware.