chipKIT® Development Platform

Inspired by Arduino™

Polyphonic musical sampler

Created Mon, 07 Nov 2011 00:11:40 +0000 by serveurperso


serveurperso

Mon, 07 Nov 2011 00:11:40 +0000

Now with a fast integer linear interpolation and echo !

Need only a speaker on OC1 PWM (pin 3 of Uno32)

http://www.youtube.com/watch?v=8LdxwfSsjZM

Realtime playback of a very lightweight MIDI-like format (http://code.google.com/p/miditones). 40KHz 10 bits output compare PWM can use any 8-bit loop/sample...

This is not a lib but it work like Arduino Playtune (http://code.google.com/p/arduino-playtune/), encode any midi file with :

miditonesV1.3.exe -t16 C:...\yourmidifile

Cut&past the score[] data and adjust the first line #define CHANNELS 14

Pascal


Dano

Sat, 12 Nov 2011 22:42:10 +0000

Really nice, thanks for sharing! :D


spencoid

Tue, 15 Nov 2011 17:42:46 +0000

I get compile errors when trying the sketch. The following are not declared. Do you have an updated version or is there something wrong with the modified IDE? or is there something that i don't understand about using the new modified IDE to compile this stuff?

OpenTimer2(T2_ON | T2_PS_1_1, 1024); OpenOC1(OC_ON | OC_TIMER2_SRC | OC_PWM_FAULT_PIN_DISABLE, 0, 0);


serveurperso

Tue, 15 Nov 2011 23:08:57 +0000

I get compile errors when trying the sketch. The following are not declared. Do you have an updated version or is there something wrong with the modified IDE? or is there something that i don't understand about using the new modified IDE to compile this stuff? OpenTimer2(T2_ON | T2_PS_1_1, 1024); OpenOC1(OC_ON | OC_TIMER2_SRC | OC_PWM_FAULT_PIN_DISABLE, 0, 0);

Hi,

Yes it need timer.h and outcompare.h,

Are you using a testing release like mpide-0022-windows-20110907-test ?

It seems to me that there is a bug on this version ? because it don't include the \hardware\pic32\compiler\pic32-tools\pic32mx\include\peripheral\ header files,

If you add the following lines, it work :

#include "C:\YOUR_PATH\mpide-0022-windows-20110907-test\hardware\pic32\compiler\pic32-tools\pic32mx\include\peripheral\outcompare.h"

#include "C:\YOUR_PATH\mpide-0022-windows-20110907-test\hardware\pic32\compiler\pic32-tools\pic32mx\include\peripheral\timer.h"

I am doing a standalone PIC32-only Amiga soundtracker MOD player !

Have fun

Pascal


spencoid

Wed, 16 Nov 2011 03:06:46 +0000

i downloaded the following mpide-0022-windows-20110822.zip it dos not contain any of the necessary stuff you mention. where do i get a complete package with the correct compiler and all the other stuff? i can not find anything else on the download page of the chipkit web site. it seems that support is very minimal for this board.


spencoid

Wed, 16 Nov 2011 03:07:46 +0000

i downloaded the following mpide-0022-windows-20110822.zip it dos not contain any of the necessary stuff you mention. where do i get a complete package with the correct compiler and all the other stuff? i can not find anything else on the download page of the chipkit web site. it seems that support is very minimal for this board.


spencoid

Wed, 16 Nov 2011 03:21:04 +0000

sorry, i got confused with the different Arduino IDE's on this computer. the path you suggest is in fact there. i added the includes and it still doesn't work. is there a problem with the two different IDEs(original and modified for the chipkit) sharing the same registry entries and not being able to co-exist? if so, what can i do to be able to develop for both the original Arduino and also the chipkit Pic32 version?


spencoid

Wed, 16 Nov 2011 03:26:53 +0000

this is the whole list of errors i get when i include the include lines. there must be something missing from my package. where can i get all that i need to compile this sketch?

In file included from sampler.cpp:21: C:\Arduino\mpide-0022-windows-20110822\hardware\pic32\compiler\pic32-tools\pic32mx\include\peripheral\outcompare.h:45:21: error: p32xxxx.h: No such file or directory In file included from sampler.cpp:23: C:\Arduino\mpide-0022-windows-20110822\hardware\pic32\compiler\pic32-tools\pic32mx\include\peripheral\timer.h:43:28: error: peripheral/int.h: No such file or directory sampler.cpp: In function 'void setup()': sampler:344: error: 'T2_ON' was not declared in this scope sampler:344: error: 'T2_PS_1_1' was not declared in this scope sampler:344: error: 'OpenTimer2' was not declared in this scope sampler:345: error: '_OC1CON_ON_POSITION' was not declared in this scope sampler:345: error: '_OC1CON_OCM_POSITION' was not declared in this scope sampler:345: error: 'OpenOC1' was not declared in this scope sampler:348: error: 'T1_INT_ON' was not declared in this scope sampler:348: error: 'T1_INT_PRIOR_3' was not declared in this scope sampler:348: error: 'ConfigIntTimer1' was not declared in this scope sampler:349: error: 'T1_ON' was not declared in this scope sampler:349: error: 'T1_PS_1_1' was not declared in this scope sampler:349: error: 'OpenTimer1' was not declared in this scope sampler.cpp: At global scope: sampler:381: error: variable or field '__ISR' declared void sampler:381: error: '_TIMER_1_VECTOR' was not declared in this scope sampler:381: error: 'ipl3' was not declared in this scope sampler:417: error: expected `}' at end of input


serveurperso

Wed, 16 Nov 2011 06:31:46 +0000

I re-downloaded

mpide-0022-windows-20110822.zip - mpide 0022 windows 20110822

here

https://github.com/chipKIT32/chipKIT32-MAX/downloads

TEST IS OK !!!!


serveurperso

Wed, 16 Nov 2011 06:39:03 +0000

sorry, i got confused with the different Arduino IDE's on this computer. the path you suggest is in fact there. i added the includes and it still doesn't work. is there a problem with the two different IDEs(original and modified for the chipkit) sharing the same registry entries and not being able to co-exist? if so, what can i do to be able to develop for both the original Arduino and also the chipkit Pic32 version?

Check each time the board model under menu :

Tool / Board / chipKIT MAX32 or UNO32.... or any other board you use.

Same for serial port.

These values are shared for all version of mpide and original arduino ide.

Pascal


spencoid

Wed, 16 Nov 2011 06:56:30 +0000

THANKS!!!!!!!!!!!!!!!!! It compiles now. I think it was just that I had not chosen a board. I should have some fun figuring this out and converting it to what I need which is a very much simplified use.


jerm2000

Fri, 16 Mar 2012 09:25:45 +0000

There is an easier way...

put these at the top of your code:

#include <peripheral/timer.h>
#include <peripheral/outcompare.h>

:D


Ryan K

Thu, 22 Mar 2012 20:20:01 +0000

or you can (my personal preference) avoid using the peripheral libraries completely and modify the registers themselves. Such as T2CON for timer 2 or OC1CON for Output compare 1. Just a thought.

PR2 = 1024;
T2CON = (1 << 15); //Equivalent to OpenTimer2(T2_ON | T2_PS_1_1, 1024);

http://ww1.microchip.com/downloads/en/DeviceDoc/PIC32MX_Datasheet_v2_61143B.pdf

Best Regards, Ryan K