Dangerous Prototypes

In development => Project logs => Topic started by: Markus Gritsch on March 17, 2011, 12:52:15 pm

Title: Pitch Shifter (Transposer)
Post by: Markus Gritsch on March 17, 2011, 12:52:15 pm
Hi,

in this project, I used a PIC24FJ to sample the audio signal at a variable sample rate into a small ring-buffer worth about 20 ms of sounddata. Playback is done at a fixed rate yielding the transposed pitch.

A video of the board in action is available here:
    http://www.youtube.com/watch?v=_KwS2qCCGzs (http://www.youtube.com/watch?v=_KwS2qCCGzs)

A quick hand drawn schematic and the firmware is attached.
Title: Re: Pitch Shifter (Transposer)
Post by: sqkybeaver on March 17, 2011, 03:03:11 pm
this is awesome, i have been thinking about using a dspic for a small effects processor, any idea how much this taxes the pic24?
Title: Re: Pitch Shifter (Transposer)
Post by: Markus Gritsch on March 17, 2011, 03:27:35 pm
Yes.  The PIC24F is clocked at 32 MHz/16 MIPS.  The output-ISR runs at 62.5 kHz (this gives nice 8 bit PWM resolution), the input-ISR depending on the selected pitch at 31.25 kHz - 125 kHz.  With this configuration the pitch-down case is more expensive and the input-ISR causes quite some jitter on the output-ISR.  Under this worst-case condition, the PIC24F has not much time left in the main loop.  However, the firmware was written in a hurry and the algorithem can probably be refined a bit.  However, for this simple task there is no need to use a dsPIC or PIC24H.
Title: Re: Pitch Shifter (Transposer)
Post by: miro on March 17, 2011, 04:07:45 pm
Hi Markus,
I am investigating for some time whether the 24HJ or dspic33 could be used as a I/Q SSB, AM, CW demodulator for a SDR radio (+/- 24 or 48kHz I an Q analog signals, 12bit ADC) or not. My dspic33 runs 55Mips stable and pic24HJ 50Mips stable. Any experience with that? Miro
Title: Re: Pitch Shifter (Transposer)
Post by: Markus Gritsch on March 17, 2011, 04:14:06 pm
No, never done something in this field.
Title: Re: Pitch Shifter (Transposer)
Post by: sqkybeaver on March 17, 2011, 04:21:28 pm
[quote author="miro"]I am investigating for some time whether the 24HJ or dspic33 could be used as a I/Q SSB, AM, CW demodulator for a SDR radio (+/- 24 or 48kHz I an Q analog signals, 12bit ADC) or not. My dspic33 runs 55Mips stable and pic24HJ 50Mips stable. Any experience with that? Miro[/quote]

i am interested in sdr too, if you start a new thread on that topic i jump in too.

i have been looking into the g59 by gennisis radio http://http://www.genesisradio.com.au/ and am not convinced that this is an ideal situation for myself.
Title: Re: Pitch Shifter (Transposer)
Post by: alexwhittemore on March 18, 2011, 04:58:46 am
Could you describe theory of operation a bit? I still don't quite follow but I'm very interested.
Title: Re: Pitch Shifter (Transposer)
Post by: Markus Gritsch on March 18, 2011, 09:33:09 am
Take a look at the section 'Pitch Conversion' on this site: http://elm-chan.org/works/vp/report.html (http://elm-chan.org/works/vp/report.html)
Title: Re: Pitch Shifter (Transposer)
Post by: Markus Gritsch on March 18, 2011, 09:42:25 am
The attached pictures show the backside of the board, the battery holder and the foam rubber which lies between them.  The interconnections are done using some insulated wire from an old relais, which is currently my preferred prototyping method.
Title: Re: Pitch Shifter (Transposer)
Post by: miro on March 18, 2011, 10:27:21 am
@sqkybeaver: not sure the sdr topic is of general interest here at DP.. I've built few softrock radios (rx) which are very simple and good performer (http://www.wb5rvz.com/sdr/ (http://www.wb5rvz.com/sdr/)). They have an analog output (I/Q) which needs to be fed into a stereo sound card. I guess an overclocked dspic33 might have enough power to demodulate the SSB without need of a PC. M.
Title: Re: Pitch Shifter (Transposer)
Post by: tuffstuff on June 19, 2011, 10:47:12 pm
Hi, I'm just a newbie at this stuff. I understand the schematics of this project but I don't know how to install the firmware for the ICs. Could anyone point me how I might do this with this chip set and code? What gear I'll need and software? I've been looking all over for a project like this and I'm excited about the learning curve. Thanks for the help!
Title: Re: Pitch Shifter (Transposer)
Post by: sqkybeaver on June 19, 2011, 11:00:48 pm
[quote author="tuffstuff"]Hi, I'm just a newbie at this stuff. I understand the schematics of this project but I don't know how to install the firmware for the ICs. Could anyone point me how I might do this with this chip set and code? What gear I'll need and software? I've been looking all over for a project like this and I'm excited about the learning curve. Thanks for the help![/quote]

at the very least you will need a pickit2, however i suggest getting a pickit3, microchip has video tutorials they should cover the basics.

this however is a very basic circuit. and can be built using veraboard or simple proto-board.
Title: Re: Pitch Shifter (Transposer)
Post by: ian on June 20, 2011, 09:09:30 am
@Markus - I know this is an old thread, but how do you remove the enamel from the wire you're using for prototyping? I bought some 'enameled wire', but it is a pain to remove the coating. I tried a knife to scrape it off, and also a bit of sand paper.
Title: Re: Pitch Shifter (Transposer)
Post by: Markus Gritsch on June 20, 2011, 09:27:22 am
I melt it away.  Place a small droplet of solder to the tip of the soldering iron and move the transformer wire slowly into the droplet.  Repeat this until 1 to 2 mm of the wire is tinned.  Then I solder this one end to the board, route the wire to its second connection, cut it and melt the coating away also on this side.

Melting it away really only works from the end of the wire.  Heating it up in the middle seems only to melt the coating, but it stays on the wire, so no contact with the tin is made.

You may have smelled it already a lot of times in your life, but the fumes of burning polyurethane contain small values of Toluol-di-Isocyanat, which can cause cancer.  So try to not inhale the fumes.  I blow them away and have the window open when soldering.
Title: Re: Pitch Shifter (Transposer)
Post by: ian on June 20, 2011, 09:31:24 am
Thanks for the tip, I'll try that!
Title: Re: Pitch Shifter (Transposer)
Post by: Markus Gritsch on June 20, 2011, 09:49:29 am
Some links from the master :)

http://elm-chan.org/docs/wire/wiring_e.html (http://elm-chan.org/docs/wire/wiring_e.html)

http://elm-chan.org/docs/wire/wcd.jpeg (http://elm-chan.org/docs/wire/wcd.jpeg)
Title: Re: Pitch Shifter (Transposer)
Post by: arhi on June 20, 2011, 12:02:58 pm
why not get proper wrapping wire?

http://uk.farnell.com/roadrunner/rrp-12 ... /dp/967348 (http://uk.farnell.com/roadrunner/rrp-123/wiring-pencil/dp/967348)
and refils:
http://uk.farnell.com/jsp/search/produc ... KU=5017233 (http://uk.farnell.com/jsp/search/productdetail.jsp?SKU=5017233)

The way it works is that "coating" is heat resistant until 360-400C (depends on the type of wire) so you normally use it, and when you want to solder it just push the temp of your iron up, tin the wire at any spot you like (works in the middle too) and reduce temp to what you normally solder with and solder the wire. Since coating is heat resistant even when you go to 400C with your wire the coating will be removed only where you touch it with iron so it is possible to wire a very fine pitch chip ...
Title: Re: Pitch Shifter (Transposer)
Post by: Markus Gritsch on June 20, 2011, 12:12:05 pm
[quote author="arhi"]why not get proper wrapping wire?[/quote]

I think we already talk about the same thing.
Title: Re: Pitch Shifter (Transposer)
Post by: arhi on June 20, 2011, 01:30:04 pm
[quote author="Markus Gritsch"]I think we already talk about the same thing.[/quote]

Are you sure as

[quote author="Markus Gritsch"]Melting it away really only works from the end of the wire.  Heating it up in the middle seems only to melt the coating, but it stays on the wire, so no contact with the tin is made.
[/quote]

does not apply to the wrapping wire I linked from farnell? You touch it with 400C solder in the middle of the wire - it removes the coating and tins the wire.

Maybe it's the same thing only you are using iron that's not hot enough so you don't kill the PU fast enough .. The pic you linked looked like you are using the softer thicker wire
Title: Re: Pitch Shifter (Transposer)
Post by: Markus Gritsch on June 20, 2011, 02:09:08 pm
[quote author="arhi"]Maybe it's the same thing only you are using iron that's not hot enough so you don't kill the PU fast enough[/quote]

Yes, because turning the temperature up to 400, wait until it gets hot enough, melt the PU, turn the temperature down, wait until its 350 again and solder the part is not my preferred workflow for fast prototyping :)  Melting the PU from the ends at 350 works fine for me, and I can solder the part in the same step without waiting.
Title: Re: Pitch Shifter (Transposer)
Post by: arhi on June 20, 2011, 04:06:57 pm
Well I solder most stuff at below 300C as I use solder with lead. Going to 400C from 260C takes 2-3 seconds ... but I do prefer to use 2 soldering irons as tip develops ugly black gue on top of it at 400C so I keep one iron with old tip at 400C and main one at 260C .. works like a charm :D
Title: Re: Pitch Shifter (Transposer)
Post by: Markus Gritsch on June 20, 2011, 04:53:46 pm
Excellent idea.  I think I will have to get a second iron too, since the gue really starts to annoy me.  I tried this silly lead-free solder which
* requires a higher soldering temperature,
* leads, because of this higher temperature, and because of the different flux to the black gue you described,
* contains flux which produces more poisonous fumes (at least I read that somewhere) than the rosin flux found in leaded solder.

So a second iron and good old leaded solder it has to be :)
Title: Re: Pitch Shifter (Transposer)
Post by: arhi on June 20, 2011, 05:25:07 pm
I actually "made the second iron myself" :) ... and I plan to revise the electronics and add some PI[D] control to firmware when I come back from vacation in august. Attm it works great and accepts hakko pencils (i actually use some cheap hakko clone pencils that I get for cca 10E a piece but they work great :D) but I want to change the 3 button design to a rotary encoder with button and I want to add PI[D] control as that way I can keep the tip dead on even when soldering big pieces...
Title: Re: Pitch Shifter (Transposer)
Post by: sqkybeaver on June 20, 2011, 05:37:31 pm
[quote author="arhi"]Well I solder most stuff at below 300C as I use solder with lead. Going to 400C from 260C takes 2-3 seconds ... but I do prefer to use 2 soldering irons as tip develops ugly black gue on top of it at 400C so I keep one iron with old tip at 400C and main one at 260C .. works like a charm :D[/quote]

i have an old weller wp-40  that i use for larger components, has a swttch that runs the ac through a diode for "low power mode" it does not regulate temp. but is a decent standby

[quote author="ian"]@Markus - I know this is an old thread, but how do you remove the enamel from the wire you're using for prototyping? I bought some 'enameled wire', but it is a pain to remove the coating. I tried a knife to scrape it off, and also a bit of sand paper.[/quote]

i have used an x-acto to scrape the wire, time consuming. i have tried a mini torch to melt/burn the insulator away, however it is much more messy than i like. ill try the solder ball trick next time.
Title: Re: Pitch Shifter (Transposer)
Post by: benquick on March 05, 2013, 10:56:36 am
i know it has been some time since this project was developed, but i'm interested in doing it myself. since i'm a newbie in the world of programming in would like to know, what am i supposed to do with those two phyton files (crossfade.py and scale.py) included in rar archive.

any help will be greatly appreciated.:)
Title: Re: Pitch Shifter (Transposer)
Post by: Markus Gritsch on March 05, 2013, 11:26:13 am
crossfade.py was used to check how the crossfade method performed on two test sine waves.
scale.py generates the values to transpose the data according to the musical scale.

You don't need to run them yourself.
Title: Re: Pitch Shifter (Transposer)
Post by: benquick on March 05, 2013, 12:23:04 pm
thank you for the reply!
so i simply upload hex generated from main.c file and that's it? is it okay if i compile using mikroc or some other software?
Title: Re: Pitch Shifter (Transposer)
Post by: Markus Gritsch on March 05, 2013, 12:38:04 pm
No, you have to use Microchips C30 and MPLAB IDE to get it to compile without modifications.
Title: Re: Pitch Shifter (Transposer)
Post by: manmachine on March 05, 2013, 12:43:01 pm
Hi,

    Could this project be modified ,to take audio file in an SDcard as input, instead of actual audio input signal,thus avoiding input sampling ?
    Also,  How far AVR chips  are suitable to do job like this?  Your thoughts please.
Thanks.

manmachine.
Title: Re: Pitch Shifter (Transposer)
Post by: manmachine on March 05, 2013, 12:43:14 pm
Hi,

    Could this project be modified ,to take audio file in an SDcard as input, instead of actual audio input signal,thus avoiding input sampling ?
    Also,  How far AVR chips  are suitable to do job like this?  Your thoughts please.
Thanks.

manmachine.

Sorry, double post. Please delete,Thanks.
Title: Re: Pitch Shifter (Transposer)
Post by: Markus Gritsch on March 05, 2013, 01:22:08 pm
[quote author="manmachine"]
Could this project be modified ,to take audio file in an SDcard as input, instead of actual audio input signal,thus avoiding input sampling ?
manmachine.[/quote]
Yes.
[quote author="manmachine"]
Also,  How far AVR chips  are suitable to do job like this?  Your thoughts please.
[/quote]
I don't think an Arduino ist fast enouth to do this at a high sample rate.
Title: Re: Pitch Shifter (Transposer)
Post by: manmachine on March 06, 2013, 08:04:17 pm
Than you for answering.
Can you please shed some light on this (pitch shifting a file on SDcard).


manmachine.
Title: Re: Pitch Shifter (Transposer)
Post by: Markus Gritsch on March 06, 2013, 08:19:47 pm
Use some FAT library (e.g. Chans "FatFS" or Microchips "MDD File System") and instead of reading the data from the ADC use the chosen library API to read the samples from a WAV file on the SD card.

My code varies the input sampling speed and has a constand output sampling speed.  With the data coming from an SD card, it has to be the other way around.
Title: Re: Pitch Shifter (Transposer)
Post by: Bobbymobile on June 05, 2013, 07:54:40 pm
How could I buy the pitch shifter
I work in sales
Music store
Title: Re: Pitch Shifter (Transposer)
Post by: Markus Gritsch on June 06, 2013, 05:06:49 pm
I didn't build the pitch shifter to sell it.  However, the schematic and firmware are available, so everyone with a little experience in electronics should be able to build you one.
Title: Re: Pitch Shifter (Transposer)
Post by: matseng on June 06, 2013, 05:16:29 pm
Marcus,  would you mind if I tweaked it a bit and turned into a kit and tried to sell a handful of them?
Title: Re: Pitch Shifter (Transposer)
Post by: Markus Gritsch on June 06, 2013, 08:40:25 pm
Hi Mats, I really would like to see it being available as a kit!  You totally have my blessing.  And I am sure the design could be improved a lot :)
Title: Re: Pitch Shifter (Transposer)
Post by: matseng on June 07, 2013, 07:05:40 am
That's great!  I'll have to build it myself first, so I'll add a few pic24's to my next order from Element14 and play around with it.
Title: Re: Pitch Shifter (Transposer)
Post by: Markus Gritsch on June 07, 2013, 07:13:10 am
IIRC I used some optimization value >1 in the firmware to get enough speed on the PIC24F.  Today I would use a small PIC32MX1, which was not available back then.