CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Sounds and Melodys 16F887

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
benni



Joined: 28 Jun 2012
Posts: 28

View user's profile Send private message

Sounds and Melodys 16F887
PostPosted: Wed Sep 19, 2012 10:32 am     Reply with quote

Hello,

I want ask if someone knows the chords for the Tetris melody in the example of: EX_TONES.c
OR
is there is a way to write a .wav file in the PIC?

Thanks for the Help
Regards Benni
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Wed Sep 19, 2012 12:19 pm     Reply with quote

How well versed are you in PCM format wave file playback?

Do you expect the 887 to have the required HARDWARE?

What is the purpose of this question?
Darren Rook



Joined: 06 Sep 2003
Posts: 287
Location: Milwaukee, WI

View user's profile Send private message Send e-mail

Re: Sounds and Melodys 16F887
PostPosted: Wed Sep 19, 2012 3:54 pm     Reply with quote

benni wrote:
Hello,

I want ask if someone knows the chords for the Tetris melody in the example of: EX_TONES.c
OR
is there is a way to write a .wav file in the PIC?

Thanks for the Help
Regards Benni


LOL.

ex_tones.c / tones.c takes frequency. Therefore -

Get sheet music here:
http://www.gamemusicthemes.com/pdf/GameBoy/Tetris_-_Theme_A.pdf

Convert note to frequency here:
http://www.phy.mtu.edu/~suits/notefreqs.html

Please post youtube of this working when done.
_________________
I came, I saw, I compiled.
benni



Joined: 28 Jun 2012
Posts: 28

View user's profile Send private message

PostPosted: Thu Sep 20, 2012 10:19 am     Reply with quote

Hey,

Does someone knows to read notes and could translate this to me please?

Regards Benni
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Thu Sep 20, 2012 12:09 pm     Reply with quote

google

READ MUSIC notation

and also

MUSIC NOTE FREQUENCY


this is web research 101
benni



Joined: 28 Jun 2012
Posts: 28

View user's profile Send private message

PostPosted: Thu Sep 20, 2012 12:46 pm     Reply with quote

I already googled -.-

I just don't find the notes that are in the pdf file of the Tetris theme...
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Thu Sep 20, 2012 12:49 pm     Reply with quote

i think you must agree that :
Quote:

notes that are in the pdf file of the Tetris theme...



is not a CCS problem
rald



Joined: 04 Sep 2013
Posts: 25

View user's profile Send private message

PostPosted: Sat Mar 14, 2015 6:11 pm     Reply with quote

hello

I have been trying to create a very simple laser sound saved into the internal eeprom of a pic 12F683, I have read the documents about tones but I have not idea about how to create those sounds.
does anyone know how can I convert a wav file or create this kind of sounds for microcontroller?

thanks
Ttelmah



Joined: 11 Mar 2010
Posts: 19496

View user's profile Send private message

PostPosted: Sun Mar 15, 2015 2:25 am     Reply with quote

For basic tunes, the 'simple' way is to start with a piece of music.
Look for things written to be played on monotonic instruments (like a xylophone etc.).
Take this, and work out the names of each note. Then put these into ex_tones.

.wav files are direct bitstreams. You don't have the storage size, or the hardware to handle these on a PIC, without a lot of work. Potentially it would be possible on one of the larger PIC's (PIC24 for example), to read such a file from an SD card (it'd get hard to handle all the possible variants, since .wav can contain streams that loop, streams at different sample rates, or even streams that are compressed), but the standard LPCM stream would be relatively 'doable', and this could then be output using a DAC at the constant rate (normally 44.1KHz). However this is a fairly 'large' project.

One system that is much easier to code in the PIC, is 'midi'. This is a serial interface at a relatively low data rate, which in it's simplest form has messages like 'note on', and the tone/emphasis data for the note. It is possible to generate a controller to receive this data relatively easily with a PIC. There are programs on the web, that will convert .wav files to midi streams (understand you lose 90% of the data in the wav file, and end up with a sequence of midi commands to play the basic tune). The output these produce can then be played by a PIC. Some years ago, I wrote a crude 'organ' using a PIC this way, and hardware has got much more capable since this time.
drh



Joined: 12 Jul 2004
Posts: 192
Location: Hemet, California USA

View user's profile Send private message

PostPosted: Sun Mar 15, 2015 7:55 am     Reply with quote

Start here..http://www.romanblack.com/picsound.htm

Good luck.
_________________
David
rald



Joined: 04 Sep 2013
Posts: 25

View user's profile Send private message

PostPosted: Sun Mar 15, 2015 12:18 pm     Reply with quote

Hi guys,

thanks for respond,

about the romanblack program, I used it but I can not undestand how to use the files. do you have any example that I can use to get an idea?

I am going to research about MIDI and see if I can find some solution.

regreats
necati



Joined: 12 Sep 2003
Posts: 37
Location: istanbul

View user's profile Send private message

PostPosted: Mon Mar 16, 2015 12:19 am     Reply with quote

http://larios.tecnologia.ws/iBlog/archives/6632
balboa



Joined: 24 Mar 2015
Posts: 8
Location: Syria

View user's profile Send private message

how to use it
PostPosted: Fri Mar 27, 2015 1:16 pm     Reply with quote

drh wrote:
Start here..http://www.romanblack.com/picsound.htm

Good luck.

would you please tell us how to use the exported file
temtronic



Joined: 01 Jul 2010
Posts: 9221
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Mar 27, 2015 1:48 pm     Reply with quote

pretty simple

export the sound file as either a PIC .asm file or a MikroC .c file

It's up to you to convert the data into CCS C compatible format. real easy if you know how to use edit features in windows...

Save as filename.pcs ( Pic C Sound file extention) or whatever you want.

Depending on how big your PIC is and the soundfile, you have a couple options.
1) if saved on a flashdrive, simply cut code to read the data and send to an I/O pin with R-C filter as shown in the documentation

2) if small enough to be contained in the PIC codespace,save as const data.

either way will work. I did it for the 16F877 about 10 years ago as it was a bit easier than using a PC ISA sound card...

cheers
Jay
balboa



Joined: 24 Mar 2015
Posts: 8
Location: Syria

View user's profile Send private message

thank you for help
PostPosted: Sat Mar 28, 2015 12:41 pm     Reply with quote

temtronic wrote:
pretty simple

export the sound file as either a PIC .asm file or a MikroC .c file

It's up to you to convert the data into CCS C compatible format. real easy if you know how to use edit features in windows...

Save as filename.pcs ( Pic C Sound file extention) or whatever you want.

Depending on how big your PIC is and the soundfile, you have a couple options.
1) if saved on a flashdrive, simply cut code to read the data and send to an I/O pin with R-C filter as shown in the documentation

2) if small enough to be contained in the PIC codespace,save as const data.

either way will work. I did it for the 16F877 about 10 years ago as it was a bit easier than using a PC ISA sound card...

cheers
Jay
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group