transposition of sound

LPG

New Member
Hi,

I have a project in mind for a sort of programmable instrument.
Does anyone know how I would:

Record a sound frequency to a variable
(I would now add X to it)
play it back

thanks for any help or advise.
 

hippy

Ex-Staff (retired)
COUNT or PULSIN could be used to determine the frequency of an input but it would only work well for pure tones and very clean signals. Most sound isn't a pure tone so I doubt whatever you want will be achievable with a PICAXE ( or many other micros for that matter ).

Playback is another issue. PWMOUT can generate a signal of a certain frequency, but only a square wave.

You'll need to describe your application in greater detail for more precise answers. Is amplitude important, is it a point-sample of frequency or a continuous, changing frequency you need to handle ? What is tha source of the sound, what frequencies ?
 

LPG

New Member
I think I am ok as far as code goes. but what sensor do I use. and what does it send to the picaxe? If i want to replicate a tone will a square wave do?

thanks, LPG
 

westaust55

Moderator
The square wave would give a "sound" but not a pure tone/note.

A square wave is in effect the fundamental frequency plus all odd harmonics.

You could try adding a series RC filter to "shape the waveform a little. Values would be dependent upon the frequencies you are trying to generate.

Try doing a Google search for "RC Networks".
 

Dippy

Moderator
"...but what sensor do I use"

- I have heard of a device called a 'micropohone', I believe they convert sound to electricity. Not sure, i've never used one ;)

- no doubt some cheapskate will tell you to use a 10penny piezo transducer stuck to a yoghurt pot.

- I also believe that there are numerous examples of microphone amplifers to get the signal to a usable level. Don't forget you want a signal 0-5V. Proper amps tend to be true +/- AC so you may have to rectify or offset the signal.

- If you are using Pulsin then you can get away with a lower Vin.

- any non-pure-sine source is going to produce some wonderful results.
 

hippy

Ex-Staff (retired)
I think I am ok as far as code goes. but what sensor do I use. and what does it send to the picaxe?
What sensor you use will depend on where you are getting your input from. It may be a microphone it may be a signal from a HiFi amp. Both would provide an analogue voltage, but to use COUNT or PULSIN you would probably want to convert that to a digital voltage (0V/+V).

If i want to replicate a tone will a square wave do?
That depends on how closely you want to replicate the original. If the original sound was a square wave then yes, if it was not then perhaps no.

There are two questions to every application development; "using this, what can I achieve" and "what do I need to achieve this". Until any 'this' is well defined neither questions can be answered in any depth.
 

vttom

Senior Member
FYI - I believe you can buy ICs that are self-contained sound-recording/playback devices. I'm willing to bet that you could easily drive one of these from a PICAXE using PWMOUT as the sample clock. To raise the pitch of a sound, play it back at a higher frequency than you sampled it. To lower the pitch, play it back at a lower frequency.
 
Top