Author Topic: Software Contribution to EEVBlog  (Read 10688 times)

0 Members and 1 Guest are viewing this topic.

Offline VeramacorTopic starter

  • Regular Contributor
  • *
  • Posts: 111
Software Contribution to EEVBlog
« on: November 24, 2009, 05:30:28 pm »
Since Dave's latest Video was all about pic micros,  I though I'd share with everyone a utility I wrote for the pic.

I'd like to keep it simple, but I am looking for good suggestions to improve it.  I've been experimenting with pic micros myself recently,  And I had a desire to program songs or melodies into the pic and drive a tiny radioshack speaker.

I couldn't find anything on the internet directly, so I came up with a utility that allows you to compose your song or melody, and convert those notes and durations into syntax compilers can understand.

This utility has a quick keyboard that allows you to directly input the notes, and when your done composing, just click 'Generate Syntax' and your off!  I tried to make the notes entry as painless as possible.  You are limited to one sound channel currently and probably want to keep it one channel for simplicity.

I'm thinking of a midi import routine next.

If anyone would be kind enough to donate sound generation syntax for their favorite compiler, I would be more than happy to include in the next release.  Particularly a good 'C' routine as that is not my first language.   All variants are welcome as it will make it easy for everyone.

I dubbed it 'Picano'  (Piano + Pic)  Dave can make fun of me even more than the 'Arduino' brand, I'm ready for it :)

Software is FREE and you can make it better by checking it out and "Takin it Apaaaaaaght!"


Here is the link:

http://acstech.serveftp.com/PicanoSetup.exe

Oh yea, I included a sample file created using picano called "Waltzing Matilda" lol.  Its a real hacked (bad) version so dont expect too much.  Share your own creations back to EEVBlog.


« Last Edit: November 24, 2009, 05:32:52 pm by Veramacor »
 

Offline armandas

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: jp
    • My projects
Re: Software Contribution to EEVBlog
« Reply #1 on: November 24, 2009, 10:35:27 pm »
How are people supposed to make it better, if you don't provide the source code? By saying "take it apart" you don't actually mean "reverse engineer", do you? :P
 

Offline VeramacorTopic starter

  • Regular Contributor
  • *
  • Posts: 111
Re: Software Contribution to EEVBlog
« Reply #2 on: November 25, 2009, 01:05:52 am »
Be glad to provide the source!

Its a VB6 project - not the latest .net or C,  but I've recently heard the saying,  "The best language is the one you learned".

Have fun.

 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17815
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Software Contribution to EEVBlog
« Reply #3 on: November 30, 2009, 09:22:40 pm »
this is a great idea, can you include the mikroe basic sytax as well ?
 

Offline adam1213

  • Regular Contributor
  • *
  • Posts: 120
  • Country: au
Re: Software Contribution to EEVBlog
« Reply #4 on: January 02, 2010, 05:38:29 am »
Have a look at http://www.beyondlogic.org/pic/ringtones.htm

I tried to run your program but was put off by having an installer and requiring a restart.

 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17815
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Software Contribution to EEVBlog
« Reply #5 on: January 04, 2010, 12:52:51 pm »
whats wrong with having an installer ? its a neat program, all you have is a written assembly program, this IS a computer program that will generate the code for several languages, a great help to beginners and fast development
 

Offline jahonen

  • Super Contributor
  • ***
  • Posts: 1054
  • Country: fi
Re: Software Contribution to EEVBlog
« Reply #6 on: January 08, 2010, 07:03:38 pm »
I posted this as comment to Dave's "Useful Resistor Calculation Tool" post on the main page. I'll post it here too in case all people don't read all the comments.

Here is another resistor calculator (optimizer) for Windows I wrote, and has become quite standard tool at my work for choosing the optimal regulator feedback resistors, opamp feedback resistors or something similar.

http://koti.mbnet.fi/jahonen/Electronics/ResOptimizer/

It doesn’t have series optimization (I might add it in the future), but it has some nice other features, like parallel resistor combinations with divider (of course the search space grows easily too large to complete the search in reasonable time), possibility to create custom resistor series (resistor series are loaded from text files, so you can tweak them if necessary), and disabling of some not-wanted values. Or you can make list of the resistors you have to try to build the divider from using only those ones.

Sorry if I hijacked this thread, but the title seemed somewhat generic.

Regards,
Janne
 

Offline Brett

  • Contributor
  • Posts: 19
Re: Software Contribution to EEVBlog
« Reply #7 on: January 26, 2010, 06:36:26 am »
Valentine's Day musical card, here I come!
 

Offline VeramacorTopic starter

  • Regular Contributor
  • *
  • Posts: 111
Re: Software Contribution to EEVBlog
« Reply #8 on: February 02, 2010, 01:40:41 pm »
this is a great idea, can you include the mikroe basic sytax as well ?


Simon,

The mikroe MikroBasic syntax looks exactly the same as the MikroBasic syntax.  Just take out the ';' characters at the end of each line and test.  Not 100% sure the mikroe C syntax will work as I do not have the compiler,   just looking at the reference manual.   I'll make the change if it does work on your end

V
 

Offline Murphy

  • Regular Contributor
  • *
  • Posts: 54
Re: Software Contribution to EEVBlog
« Reply #9 on: February 02, 2010, 05:12:08 pm »
Hey that's kinda cool. I'll have to figure out how to make sounds in ASM.
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17815
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Software Contribution to EEVBlog
« Reply #10 on: February 02, 2010, 05:55:48 pm »
this is a great idea, can you include the mikroe basic sytax as well ?


Simon,

The mikroe MikroBasic syntax looks exactly the same as the MikroBasic syntax.  Just take out the ';' characters at the end of each line and test.  Not 100% sure the mikroe C syntax will work as I do not have the compiler,   just looking at the reference manual.   I'll make the change if it does work on your end

V

Thanks, also I expect I could use asm and incorporate it into a mikroebasic program as they alow you to do that
 

Offline VeramacorTopic starter

  • Regular Contributor
  • *
  • Posts: 111
Re: Software Contribution to EEVBlog
« Reply #11 on: February 02, 2010, 09:05:16 pm »

ASM would be a great addition -  If anyone wants to figure out how to create frequence tones in ASM I'll include the syntax

If you could take into account the clock speed (4Mhz, 10Mhz, 20Mhz etc) that would be really cool

J
 

Offline Murphy

  • Regular Contributor
  • *
  • Posts: 54
Re: Software Contribution to EEVBlog
« Reply #12 on: February 09, 2010, 01:09:57 am »
How long is the silent space between notes when Picano is playing a song, 30ms or so?
 

Offline VeramacorTopic starter

  • Regular Contributor
  • *
  • Posts: 111
Re: Software Contribution to EEVBlog
« Reply #13 on: February 09, 2010, 02:11:31 pm »
When the notes are played on the pic, they run together.   I included a 'Rest' key so you can get around that.   I defaulted the 1/4 note to be around 250 milliseconds.   All that does is generate the syntax for creating a 250ms delay (ex.  waitms 250)

So if you have a song for example,  Jingle Bells...

Sound_Play(114, 250)
Sound_Play(114, 250)
Sound_Play(114, 500)
Sound_Play(114, 250)
Sound_Play(114, 250)
Sound_Play(114, 500)
Sound_Play(114, 250)

...the first 7 notes will all run together so the result will be a long note 2.25 seconds long.  I probably should put in a delay, but I would have to put delay lines so the syntax would be...

Sound_Play(114, 250)
{wait 30ms}
Sound_Play(114, 250)
{wait 30ms}
Sound_Play(114, 500)
{wait 30ms}
Sound_Play(114, 250)
{wait 30ms}
Sound_Play(114, 250)
{wait 30ms}
Sound_Play(114, 500)
Sound_Play(0, 30)
Sound_Play(114, 250)
{wait 30ms}

Assuming 30 ms sounds good.   What do you think? Maybe have an option to include a short 30ms delay?



Been playing around with a midi import routine,  Most imports currently fall flat on their face,  I'm a ways away from getting it right, but attached is metallica's song 'No remorse'.   Parts of the rhythm and lead guitars are in it.  Play it on the PC speaker.  Your PC speaker never sounded so rockin!

Here is Picano with my first attempt at Midi Import btw:

http://acstech.serveftp.com/PicanoSetup.exe


You would probably need a EEPROM chip if you have a mid range pic like I do to fit the whole song in.

V
« Last Edit: February 09, 2010, 03:32:29 pm by Veramacor »
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17815
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Software Contribution to EEVBlog
« Reply #14 on: February 10, 2010, 12:54:12 pm »
you should put dekays in between notes, I can play the recorder and keyboard a little and can tell you that your reproductions will be laughable at best without the pause
 

Offline VeramacorTopic starter

  • Regular Contributor
  • *
  • Posts: 111
Re: Software Contribution to EEVBlog
« Reply #15 on: February 10, 2010, 05:59:18 pm »
30 milliseconds sounds about right -

Here is the update...

http://acstech.serveftp.com/PicanoSetup.exe


* added a 30ms pause between every note

V
 

Offline Murphy

  • Regular Contributor
  • *
  • Posts: 54
Re: Software Contribution to EEVBlog
« Reply #16 on: February 11, 2010, 11:19:43 pm »
I've been working on an ASM program that produces the same notes as the keyboard on Picano but It's different I don't think it would fit into the code generator as is. I'll post it once its a little bit more complete though.


Why is the ID for a rest -10? All the other notes are positive numbers.
« Last Edit: February 11, 2010, 11:32:55 pm by Murphy »
 

Offline VeramacorTopic starter

  • Regular Contributor
  • *
  • Posts: 111
Re: Software Contribution to EEVBlog
« Reply #17 on: February 16, 2010, 01:02:54 pm »
No reason other than to separate from the rest of the notes.  Index 0 I think is used for the first note.  The keys are a VB control array and zero is used I believe already.


Just added Great Cow Basic!
http://acstech.serveftp.com/PicanoSetup.exe

I'm going to talk to the guys who maintain GCB to see if I can include their free compiler into the program.  I don't see why not, since this program is free anyway.  

What that would let the program do is compile a .hex file that plays music on the port of choice.    All that is left is to download the .hex file to the pic using your programmer.

J
« Last Edit: February 16, 2010, 01:50:34 pm by Veramacor »
 

Offline Murphy

  • Regular Contributor
  • *
  • Posts: 54
Re: Software Contribution to EEVBlog
« Reply #18 on: February 16, 2010, 10:10:22 pm »
That would be really cool. Especially if you combine it with commands to turn other pins on or off (can just insert them between notes).

I'm done with my program and probably won't work on it anymore for a whole bunch of reasons, mainly because I'm not musically talented enough to get the tune I wanted it to play to sound right. =P

It's functional if anyone wants it but doing this in assembly just isn't that practical unless you're trying to make it do a whole bunch of stuff at the same time its playing music, and in that case it would make more sense to use a PWM module. Was a cool learning exercise though.
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17815
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Software Contribution to EEVBlog
« Reply #19 on: February 17, 2010, 07:38:08 am »
the basis of music are not that difficult especially for a programmers mind, all you need is the sheet music for a tune and to be able to ready it and you will very easily get it to play on the micro
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf