coolcrab
Posts: 4
Joined: Thu Nov 14, 2013 11:37 am

GPIO as volume/pitch control

Mon Dec 09, 2013 12:16 am

So I was wondering how I can setup a blockwave that will change pitch and volume when the sensor gets triggered.
I'm trying to make a alarm that buzzes when someone is near with a higher pich when he is closer.

So lets say 0-3.3v range for 0-100% audio and pitch from low to high. (Can't find any tutorials on doing this.)

Also is it smarter to use the GPIO pins to control the audio or should I use the audio jack port?

User avatar
davef21370
Posts: 897
Joined: Fri Sep 21, 2012 4:13 pm
Location: Earth But Not Grounded

Re: GPIO as volume/pitch control

Mon Dec 09, 2013 3:16 am

It's either 0v or 3.3v, there's no in between. Look into PWM, that should do your audio. And I'd probably use an ultrasound sensor to measure the distance, pre-built, i2c.

Dave.
Apple say... Monkey do !!

coolcrab
Posts: 4
Joined: Thu Nov 14, 2013 11:37 am

Re: GPIO as volume/pitch control

Mon Dec 09, 2013 11:12 am

I got a adc, so its possible :P

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: GPIO as volume/pitch control

Mon Dec 09, 2013 12:42 pm

coolcrab wrote:
Also is it smarter to use the GPIO pins to control the audio or should I use the audio jack port?
If you can do it with the analog audio jack then that's clearly better. GPIO pins are digital (two states HIGH or LOW, no in betweens).

Most of the hits I found on Google use a Texas Instruments CD4067 analog mux/demux to do volume control
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Return to “Python”