Piezo transducers have limited frequency range, they would not sound well on lower frequency, thus guitar sound may not be able to be replicated well.
Ok, then i'll use the buzzer for the 'greeting card mode ' ^^
but the idea that was jumping in my head was to reuse the same melody generator (with a rock tune) to try to emulate a guitar to put it inside a teddy bear ^^ :p then i was thinking of a little speaker and some shaping circuitry to emulate fuzzy or any guitar like sound.
It's possible to do this with any additive harmonic synthesis using as a base the squarewave and a little ban of filters or any gimmick? or it's too complicated and i must use something like "roman black's 1bit sound" instead???
Posted on: July 19, 2012, 03:49:10 03:49 - Automerged
XC8 with PIC12F675 is OK, I used it without troubles.
It is simply PICC from Hi-Tech.
ok, in fact it s my first time with c compilers (i 'm using mikroC too but i'm testing XC because of the announced very shrink optimal space after compilation )
so the plan was:
setting up the variables associated to the musical note (value to compare each T0 interrupt and number of times the loop is performed)
enable the TO interrupt
perform a fixed delay ... by polling the TMR1IF in the main loop. (no Wreg involved in this task, so as i understood it's not deprecated when the TMR0 interrupt arrive)
(so i enable the TMR1ON then i poll and finally when the delay is completed i disable the TMR1ON)
and so on after recharging my variable registers to play a new note
first thing i did was to put a progressive scale list, it worked ok, but for an unexpected reason it auto looped without reaching the last notes ... i solved it forcing the system to do a while(1) {;} at the end ...
then i changed the list to play a song, then it played just one note ...after saying 'grrr' i added a built in delay ( __delay_ms(500)) at the start of the list of notes) and it worked...
b
then the song grew and when i was reaching the 256B first block no note was played ... another 'grr', then i added another __delay_ms(200) and it played the rest of the notes, thats why i'm a little bit surprised ...
void interrupt isr(void)
{
INTCONbits.T0IF = 0;
++count;
if (count==vcount)
{
LED1= !LED1;
count=0;
TMR0=vTMR0;
}
T0IF=0;
}
to cut paste in macro way
#define C4() vTMR0=91;vcount=4
and the polling ...
delay200(void)
{ TMR1ON=1;
while(!TMR1IF)
{;}
LED2=! LED2;
TMR1IF=0;
TMR1ON=0;
}
then i use in the code as :
....
ei(); // enable global interrupts
while (1)
{
__delay_ms(500);//__delay_ms(500);
// __delay_ms(500);__delay_ms(500);__delay_ms(200);
INTCONbits.T0IE=1;
B3();delay200(); // and the rest of the notes ...
...
best regards.