Waveshield - a question - play speed

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Waveshield - a question - play speed

Postby rasterblaster » Thu Jul 03, 2008 3:34 am

Firstly, is it possible to adjust the playback rate of a sample, I saw someone do it with a hard wired variable resistor, however what I want to do is have a soundeffect a 'Pulsing Hum' that changes pace when a input pin is grounded, and then slows back down when its open.

If you give the 'speed' an imaginary number lets say it needs to work like this.

Contact open
'Pulsing Hum' effect plays at constant speed '2'
Contact closes
'Pulsing Hum' effect slowly ramps up to play at constant speed '8' (faster) and keep playing at that rate
Contact opens
'Pulsing Hum' effect slowly ramps down to play at constant speed '2'

also, if it was in the "ramp up" process and had reached speed '6' and the contact opened, it would just go from '6' back down to '2' again...

So basically where ever it is at when a contact opens or closes, it will move from that point either down to '2' or up to '8' depending on the state of the contact...


I hope that makes sense... Its for a sci-fi 'power generator' sound effect, which when activated will ramp up in pitch and speed, but slow back down if a safety switch is activated (ie someone opens it up)
I was going to use different sound effects for up and down, but getting them to sync and play without a gap would be a pain. If I just use the one soundeffect looping continously and adjust the speed, it will 'play fluently'

so the above question is doing it with the software, the other idea is to have ANOTHER arduino control this one (the hard wired variable resistor part).... which might be even easier, and allow more flexibility to tie in with other effects.... thoughts???
I imagine that you can use one to control another (just by hooking up the output pins to the input pins?)

Marty
if you like science fiction art and sci-fi sculpture, have a look at my website www.marty.com.au
rasterblaster
 
Posts: 11
Joined: Wed Jul 02, 2008 4:51 am
Location: Melbourne, Australia

Postby adafruit » Thu Jul 03, 2008 9:01 pm

the resistor has nothing to do with it, really, its just the sensor. you can do your effect in one arduino without much difficulty.

http://ladyada.net/make/waveshield/library.html
User avatar
adafruit
 
Posts: 10485
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Postby rasterblaster » Mon Jul 14, 2008 8:13 am

ladyada wrote:the resistor has nothing to do with it, really, its just the sensor. you can do your effect in one arduino without much difficulty.

http://ladyada.net/make/waveshield/library.html


Well My waveshield turned up today, and I am having a play (thanks for the fast shipping too!)

I have adjusted "wave.dwSamplesPerSec" and it does not seem to change anything.. the pitch or the speed...

is that the one you would adjust to change the pitch on the fly while playing a sample?
if you like science fiction art and sci-fi sculpture, have a look at my website www.marty.com.au
rasterblaster
 
Posts: 11
Joined: Wed Jul 02, 2008 4:51 am
Location: Melbourne, Australia

Postby adafruit » Mon Jul 14, 2008 5:16 pm

are you changing the variable while the audio plays? it will -reset- the next time its played
User avatar
adafruit
 
Posts: 10485
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Postby rasterblaster » Mon Jul 14, 2008 6:30 pm

As I understand, when the wav is first played, it finds out what the sample rate is from the file, and fills in that variable. (that is what you mean by it resets it I gather)

So the test code I did was to that demo program that finds the samples on the card and plays them one after the other.
it outputs the currently playing name and then "...." as it plays.
I added a line to display the sample rate every time it outputs a "." that works fine.

I then told it to increase the sample rate a bit each time it outpits a "." and display that.
It shows the variable is changing as the sample plays, but the sound does not change. (I have tried various rates of increase, nothing makes a difference) The sample its self goes for about 20seconds... and with an adjustment from 17K to 25K within that time on a 22K file, the sound change should be noticable...

This is the snippit of code - what am I doing wrong?

void playcomplete(char *name) {
playfile(name);
wave.dwSamplesPerSec = wave.dwSamplesPerSec - 5000;
while (wave.isplaying) {
putstring(".");
delay(300);
Serial.print(wave.dwSamplesPerSec);
wave.dwSamplesPerSec = wave.dwSamplesPerSec + 200;
}
card.close_file(f);
}
if you like science fiction art and sci-fi sculpture, have a look at my website www.marty.com.au
rasterblaster
 
Posts: 11
Joined: Wed Jul 02, 2008 4:51 am
Location: Melbourne, Australia

Postby rasterblaster » Tue Jul 15, 2008 9:22 pm

Ahh I just found a sketch on the net, and I see that it needs to be Set...

wave.setSampleRate(wave.dwSamplesPerSec);
fixes the problem

I aso gotta say that your wave shield frikkin kicks ass.. This has to be the most fun and usefull thing I have purchased off the internet in the last 10 years. SERIOUS!

Its going to give some serious WOW! factor to my sculptures. Thanks so much!
:D
if you like science fiction art and sci-fi sculpture, have a look at my website www.marty.com.au
rasterblaster
 
Posts: 11
Joined: Wed Jul 02, 2008 4:51 am
Location: Melbourne, Australia

Postby adafruit » Thu Jul 17, 2008 2:42 pm

ugh OK let me fix this
User avatar
adafruit
 
Posts: 10485
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc


Return to Arduino Shields from Adafruit

Who is online

Users browsing this forum: No registered users and 9 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [100]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[33]
LCDs & Displays[48]
Components & Parts[69]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[108]
 
Wireless[14]
Cables[60]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[69]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]