Right off the bat, huge kudos! The WavePro arrived today and here are my impressions after the first five minutes.
This little thing sounds great! It's the best sounding of the Arduino audio options I have at the moment. Audio quality-wise it outperforms its closest rival the Rugged Audio Shield (RAS) by far, not to mention lower quality options like the Adafruit Waveshield (WS), as well as the WTV020-SD-16P audio module and a mini-clip mp3 player hacked for arduino control. I want to post a direct audio comparison of these options soon, so you don't have to take my word for it.
It's a small thing, but the full-sized SD card holder inspires confidence, as it's the type that grabs the card and needs a push in before it releases the card. The SD slots on the Adafruit WS (normal size) and the RAS (mini SD) are the kind where you just slide the card in and out.
It's been a doddle to work with so far. I dragged and dropped the r5 software into the Arduino's libraries folder, mounted the WavePro on the back of the Arduino, plugged in the SD card that was in the Adafruit WS (with a bunch of 22kHz mono WAVs), loaded the RandomPlay example sketch and the WavePro fired up right away playing the files. Next I tried the SD that was in the RAS (44.1kHz stereo files). I've had it on now for about the last 30 minutes as I typed this and did other things, and the WavePro has been happily random-playing the files on that card.
I'm very excited, Matt, I think you've finally managed to create a high quality audio option for the Arduino platform. Right away, I'm thinking of ways to incorporate it into my multi-track loop playback project. How many of these could one conceivably run off a single Arduino at the same time?
This evening I'll test the WavePro with the ChipKit Max32 as well.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I much prefer the push-push SD card slots too - they do give an impression if higher quality, don't they? I'll let you into a little secret though - they were actually the cheaper option from my main supplier ;) But still, they're made by Molex, so you'd expect them to be pretty good.
At the moment the SS line is hard wired to D10 on the Arduino. On other projects I have done in the past I have provided a set of jumpers to select which digital line to link SS to so you can stack multiple boards together. I don't have one on this yet, and I'm not sure where I can squeeze one in, it's getting rather cramped.
Of course, if you don't mind doing it externally, then in theory you can stack as many WavePro shields as you have spare digital pins. They are just SPI, so you have the shared MOSI, MISO and SCK lines, plus one SS line per board.
At the moment the library doesn't support multiple boards, but it's a simple change to make it work.
Also, you will be limited by the amount of power the host can provide. The boards have their own 3.3V regulators for digital and audio segments which run off the 5V from the host. So, running from USB (not recommended - USB power isn't good for audio work) you have a maximum of 500mA minus the host's requirements (about 50mA), or off an external power source, around 800mA minus the host (that's the limit of the UNO's 5V regulator). I haven't yet measured the current consumption of the WavePro yet, but I am expecting it to be around the 65mA mark as that is what other projects using the same core chip have been. I'll get a more accurate figure in a bit tho.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Library support for running multiple WavePros off a single Arduino would be great - I'll add a feature request ;^)
I'll probably go the external route if I can't stack WavePros directly on the Arduino/Max32. I'd forgotten that the layout was for the Uno form-factor and haven't yet tested the WavePro with the Max32 for lack of spare jumpers ;^) I'll get to it soon.
I have, however, made an audio file comparing the WavePro with the Adafruit WaveShield and the Rugged Audio Shield here - the recordings were made straight from each device's output to a Zoom H2 recorder: http://soundcloud.com/moshang/waveshield-ras-wavepro
The results are interesting and I have a couple of concerns.
1) I noticed yesterday that the output from the WavePro is really loud. Files with little headroom appear to be distorting on the way out (I made sure that none of the loops had digital overs, or touched 0dB). There's noticeable distortion at the end of the second loop, but it's particularly apparent on the third (bass) file. And I'm positive I was not clipping during the recording - the input level was set to 80% and the clip indicator never lit on the recorder. To make the files easier to compare by ear, I normalized the Wave Shield and RAS files so that they sounded about as loud as the WavePro files. If you have a look at this screenshot from soundforge (it's of the last loop), it looks like the WavePro's output (last) looks compressed compared to the first two http://imgur.com/LwSzp
2) There are noticeable pops at the start and end (especially the ends) of playback. It's not nearly as bad as on the RAS, but on the other hand there are none of these pops on the files from the Adafruit Waveshield.
3) I did a very rough test trying to retrigger files, but it doesn't seem like gapless looping is on the cards. I wrote a simple sketch that retriggers one of the 100bpm loops after x milliseconds (60000/100 = 600ms per beat). First I followed the example from the RandomPlay sketch and preceded the "play" function by "stop". This resulted in a noticeable gap. When I removed the call to "stop", the WavePro didn't like it at all - wave playback stopped after the first repetition and I had to unplug power to get audio back. I've noticed something on the Adafruit Waveshield re. looping that may or may not be of help with this. It seemed that while I could easily retrigger the file from somewhere in the middle, it often didn't work when I wanted to retrigger at the end of the loop. It occurred to me that the Wave Shield may be closing the file before it receives my call to play from the start again. I've since started adding a second of silence to loops on the Waves Shield and retriggering from the audible end of the loop hasn't been a problem since. This trick didn't work on the RAS however, and I don't actually think that it's going to work in this case either.
In spite of these couple of issues, I'm still VERY positive about the WavePro though. If we can sort these out, this will be an unbeatable package.
Last edit: MoShang 2012-11-02
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, the audio volume is an issue, and has already been addressed here: https://sourceforge.net/p/wavepro/discussion/beta/thread/4438d7b3/#35d9 You just need to add 2 10K resistors across the existing feedback resistors on the op-amp (pins 2+3, and 4+6) to reduce it to a gain of 1. It massively improves the sound.
Due to the way the system works, manual looping as you have tried is unlikely to work - there is too much latency in the SPI command system, and starting the playback has delays as it reads the header from the SD card to get the WAV file structure. I do plan on adding a "playLoop()" function which will automatically seamlessly loop (I hope) a file until told to stop (or until the "number of loops" specified has expired?).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That'll teach me to read the other posts in the forum before I post.
I tried to follow the instructions for adding the two 10k resistors, but ran into some trouble.
I managed to solder the resistors on OK (phew, tricky little job as I'm brand new to soldering on an SMD scale), but my results were far from helpful - the left channel seemed better re. the distortion, but there was no sound coming from the right channel. In the process of probing pins 2 and 3 to check for a soldering defect, I managed to short those pins and had sound again in the right ear, so at least I know the opamp isn't fried.
I came back here to check the directions and saw that you mention pins 4 and 6 above, whereas it's 5 and 6 at the link. I'm thoroughly confused and wonder if I've even identified pin 1 correctly - on my board the v912i's beveled edge is on the edge-side of the board towards the WavePro lettering. The lettering on the v912i is right-side-up when the WavePro lettering is upside down. Wouldn't that usually put pin 1 under the "P" of WavePro rather than pin 6?
Think I'd better stop for guidance before I manage to do real damage ;^)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I really hate the way you don't get a proper end indentation on these little chips. Makes it so hard to see the orientation.
The orientation of the op-amp is the opposite to that of the dsPIC. Pin 1 is under the P, pin 4 is under the v, 5-8 are on the side nearest the dsPIC.
Resistor between 1 and 2 (eP), and between 6 and 7 (middle two of dsPIC side).
It's pretty hard to kill one of these chips. The voltages around there are only 3.3V max, and the chip can take far more than that.
The biggest problem with the signal path is with the little resistor arrays. They're fine most of the time, but occasionally don't make good contact with their pads. Check those with a magnifying glass to see that the soldering is OK. Also, make sure the pins of the op-amp are still soldered down to their pads (one may have lifted a fraction) where you have been soldering.
I actually had to replace one of the resistor packs on one of my test boards - one of the resistors went open circuit, not sure why. You might like to test each resistor in the packs to make sure they're still working with a multimeter.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have been doing some work on the firmware, and have got seamless looping working nicely - it's a "loop and forget" system - you tell it to play a loop, and it just keeps going until told to stop.
Great work Matt! Now I'm just wondering if there's some way to get feedback from the WavePro via spi when the loop occurs, or when a new sample is triggered in the que - I'm going to need some way to keep loops on various WavePros in sync with each other, or sync it to a clock.
Speaking of keeping things in sync - I've noticed that samples on my WavePro play back slightly fast - about 300ms fast on a sample that should run for 9600ms. I thought I noticed samples playing back slightly sharp compared to the ones from the RAS and Wave Shield when I did my comparison the other day, but thought I was imagining things. I've tested it more objectively with a 440Hz tone generated in SoundForge and the WavePro is indeed playing back a bit fast/sharp. I recorded the WavePro's output in Sonar and checked the pitch of both with V-vocal. I've attached a screenshot for you - the yellow line on the left is the original, the one on the right is the WavePro. It's not out by much but I foresee problems if I try to have WavePro's playing alongside RAS and WS. Easy solution is to do my project only with WavePro, but that's only assuming they're all out by the same amount ;^)
Ugh, sadly my WavePro is not very happy in the right ear after doing the resistor mod. Crackling and static and now and again just for variation, the actual signal. Bridging pins 6 and 7 makes it all better, but that's not as it should be and surely indicative of problems elsewhere. Though I've been tempted to solder a bridge between those pins just to be done with it, I'll carry on hunting for the problem. Actually, I have already been probing the pins of the resistor packs with a multimeter. Some legs on the same side seem to be connected and I've been doing my best to read the schematic and the board layout .png to see if this is how it should be. Most notably the two right legs on the middle resistor pack on the side closest to the opamp. I'm thinking I may have touched them with the soldering iron when I attached the 10k resistors.
By the way, would you mind posting some example code that'll allow me to test the loop feature?
Yes, the frequency problem is due to an inability in the dsPIC to playback at precisely 44100Hz (or whatever speed is needed) due to clock dividers etc. It's not something I can do much about I'm afraid.
Different playback frequencies have slightly different offsets, unfortunately.
I have attached an image of the tracks for the resistor arrays - should make it easier to trace.
As for feedback, there is one IO pin on the dsPIC that's not being used. I am pondering having that linkable to an IO pin on the Arduino so you can receive notifications / interrupts to specific events. Maybe have it so you can turn on/off the notification for specific things, like playback finished, looped, queue incremented, etc.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have been playing around with generating a synchronisation pulse from a WavePro that the Arduino can react to. It currently generates a pulse whenever playback finishes, or when a sample loops.
I have just uploaded a new version of the library/firmware.
I have tried some experimental clock shifting / tweaking with this version to try and get better playback frequency accuracy. Could I get you to try this version out and see if it's closer to the right frequency for playback? If you could try with different sample rates (8000, 11025, 16000, 22050, 32000, 44100, 48000) that would be great. I'm not 100% certain I got the calculations quite right, but after staring at spreadsheets for about 3 hours you do kind of go blind after a while. I have (I hope) managed to get it down to less than a 0.1% error in the playback frequencies now.
My initial testing has a 440Hz sine playing back within 1 or 2 Hz of 440 according to my DMM, though how accurate that is I can't say. It sounds pretty good though.
Also, you can solder a wire to pin 22 of the dsPIC chip if you want to get notification of end of playback / sample loop. It gives a high pulse of about 100uS or so - best performance if you attach the wire to an interrupt enabled input on the host, but the pulse is wide enough for an Arduino polling for it to pick it up (as long as it's not doing much else).
Last edit: Majenko Technologies 2012-10-30
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Whaddayaknow - I had to leave the WavePro alone for a day (ugh, busy), but coming back to it today the situation with the staticky sad right channel has resolved itself! I guess I must have built up static on that channel somehow and that it's dissipated. Either way, the WavePro is sounding better than ever with the 10k resistor mod. I've also soldered a wire to pin 22 as suggested and feel more successful at life in general. Now that we're on the same page again, I'll get back with some test results this evening.
Last edit: MoShang 2012-11-01
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks to the resistor mod the distortion is now completely gone. The pop at the start of tracks is all but completely gone too, but unfortunately I'm still getting a nasty spike at the end of files - actually I can see and hear it on all three of the musical musical loops,but not on the two drum ones.
Ive attached a screengrab from soundforge zoomed in all the way on one such spike.
Any chance you could email me one of the samples that goes pop? The source sample, not a recording of it. I am wondering if there is something about those sample files that is making it pop. I'll need to investigate them in detail.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Right, I have found a sample which clicks at the end of playing.
The problem here is that the playback routine is (currently) rather dumb. It just plays until it reaches the end of the file. It shouldn't, and I need to rewrite it so it uses the data segment size in the RIFF header.
The file that clicks has a LIST RIFF chunk at the end:
Make sure that the WAV files have ONLY a RIFF, fmt and data chunk, and all will be well. It completely fails to play if it doesn't have just those three chunks, in that order. Anything at all following the end of the data chunk will be played as if it were data.
Last edit: Majenko Technologies 2012-11-01
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok, I have just spent half an hour completely rewriting the file reading and playback routines, and they now handle the chunk sizes properly. Unknown chunk types are skipped, and the order isn't too critical - as long as the header comes somewhere before the data. I need to do some more testing before I release it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The test results are in and attached. We're looking at the yellow lines' deviation from the red reference A/440Hz. Great job! The sampling rate I'm most likely to use, 44100, looks pretty much perfect now, while 22050 and 11025 also look too close to call. 48000, 16000 and 8000 are sharp (fast) according to V-Vocal. And 32000 is flat (slow) by quite a bit. This is v.14 firmware.
Ok, there is a new version of both the library and firmware uploaded.
For the pin-22 notification you will now have to "subscribe" to the notification you are interested in:
WavePro.subscribe(SUB_LOOP);
The options are:
SUB_LOOP - notify when a sample loops
SUB_PLAY - notify when a sample starts playing
SUB_STOP - notify when a sample stops playing
SUB_QUEUE - notify when the queue shifts down a slot and the next sample starts
You can also use
WavePro.unsubscribe(...);
to turn off notification of an event.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm up to date with v.26 and have noticed that my wavs loop perfectly the first time round, but click on every repeat after that :^/ This holds true for the musical loops (01.wav, 02.wav, and 03.wav) of the ones I e-mailed you, but not for the drum loops (04.wav and 05.wav) - the drum loops seem to loop perfectly all the way through. We're so close!
Last edit: MoShang 2012-11-03
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Right off the bat, huge kudos! The WavePro arrived today and here are my impressions after the first five minutes.
This little thing sounds great! It's the best sounding of the Arduino audio options I have at the moment. Audio quality-wise it outperforms its closest rival the Rugged Audio Shield (RAS) by far, not to mention lower quality options like the Adafruit Waveshield (WS), as well as the WTV020-SD-16P audio module and a mini-clip mp3 player hacked for arduino control. I want to post a direct audio comparison of these options soon, so you don't have to take my word for it.
It's a small thing, but the full-sized SD card holder inspires confidence, as it's the type that grabs the card and needs a push in before it releases the card. The SD slots on the Adafruit WS (normal size) and the RAS (mini SD) are the kind where you just slide the card in and out.
It's been a doddle to work with so far. I dragged and dropped the r5 software into the Arduino's libraries folder, mounted the WavePro on the back of the Arduino, plugged in the SD card that was in the Adafruit WS (with a bunch of 22kHz mono WAVs), loaded the RandomPlay example sketch and the WavePro fired up right away playing the files. Next I tried the SD that was in the RAS (44.1kHz stereo files). I've had it on now for about the last 30 minutes as I typed this and did other things, and the WavePro has been happily random-playing the files on that card.
I'm very excited, Matt, I think you've finally managed to create a high quality audio option for the Arduino platform. Right away, I'm thinking of ways to incorporate it into my multi-track loop playback project. How many of these could one conceivably run off a single Arduino at the same time?
This evening I'll test the WavePro with the ChipKit Max32 as well.
Excellent - I'm glad it's working for you.
I much prefer the push-push SD card slots too - they do give an impression if higher quality, don't they? I'll let you into a little secret though - they were actually the cheaper option from my main supplier ;) But still, they're made by Molex, so you'd expect them to be pretty good.
At the moment the SS line is hard wired to D10 on the Arduino. On other projects I have done in the past I have provided a set of jumpers to select which digital line to link SS to so you can stack multiple boards together. I don't have one on this yet, and I'm not sure where I can squeeze one in, it's getting rather cramped.
Of course, if you don't mind doing it externally, then in theory you can stack as many WavePro shields as you have spare digital pins. They are just SPI, so you have the shared MOSI, MISO and SCK lines, plus one SS line per board.
At the moment the library doesn't support multiple boards, but it's a simple change to make it work.
Also, you will be limited by the amount of power the host can provide. The boards have their own 3.3V regulators for digital and audio segments which run off the 5V from the host. So, running from USB (not recommended - USB power isn't good for audio work) you have a maximum of 500mA minus the host's requirements (about 50mA), or off an external power source, around 800mA minus the host (that's the limit of the UNO's 5V regulator). I haven't yet measured the current consumption of the WavePro yet, but I am expecting it to be around the 65mA mark as that is what other projects using the same core chip have been. I'll get a more accurate figure in a bit tho.
Library support for running multiple WavePros off a single Arduino would be great - I'll add a feature request ;^)
I'll probably go the external route if I can't stack WavePros directly on the Arduino/Max32. I'd forgotten that the layout was for the Uno form-factor and haven't yet tested the WavePro with the Max32 for lack of spare jumpers ;^) I'll get to it soon.
I have, however, made an audio file comparing the WavePro with the Adafruit WaveShield and the Rugged Audio Shield here - the recordings were made straight from each device's output to a Zoom H2 recorder:
http://soundcloud.com/moshang/waveshield-ras-wavepro
The results are interesting and I have a couple of concerns.
1) I noticed yesterday that the output from the WavePro is really loud. Files with little headroom appear to be distorting on the way out (I made sure that none of the loops had digital overs, or touched 0dB). There's noticeable distortion at the end of the second loop, but it's particularly apparent on the third (bass) file. And I'm positive I was not clipping during the recording - the input level was set to 80% and the clip indicator never lit on the recorder. To make the files easier to compare by ear, I normalized the Wave Shield and RAS files so that they sounded about as loud as the WavePro files. If you have a look at this screenshot from soundforge (it's of the last loop), it looks like the WavePro's output (last) looks compressed compared to the first two http://imgur.com/LwSzp
2) There are noticeable pops at the start and end (especially the ends) of playback. It's not nearly as bad as on the RAS, but on the other hand there are none of these pops on the files from the Adafruit Waveshield.
3) I did a very rough test trying to retrigger files, but it doesn't seem like gapless looping is on the cards. I wrote a simple sketch that retriggers one of the 100bpm loops after x milliseconds (60000/100 = 600ms per beat). First I followed the example from the RandomPlay sketch and preceded the "play" function by "stop". This resulted in a noticeable gap. When I removed the call to "stop", the WavePro didn't like it at all - wave playback stopped after the first repetition and I had to unplug power to get audio back. I've noticed something on the Adafruit Waveshield re. looping that may or may not be of help with this. It seemed that while I could easily retrigger the file from somewhere in the middle, it often didn't work when I wanted to retrigger at the end of the loop. It occurred to me that the Wave Shield may be closing the file before it receives my call to play from the start again. I've since started adding a second of silence to loops on the Waves Shield and retriggering from the audible end of the loop hasn't been a problem since. This trick didn't work on the RAS however, and I don't actually think that it's going to work in this case either.
In spite of these couple of issues, I'm still VERY positive about the WavePro though. If we can sort these out, this will be an unbeatable package.
Last edit: MoShang 2012-11-02
Yes, the audio volume is an issue, and has already been addressed here: https://sourceforge.net/p/wavepro/discussion/beta/thread/4438d7b3/#35d9 You just need to add 2 10K resistors across the existing feedback resistors on the op-amp (pins 2+3, and 4+6) to reduce it to a gain of 1. It massively improves the sound.
The pop is also known (https://sourceforge.net/p/wavepro/discussion/beta/thread/4438d7b3/#e796) and I am in the process of updating the firmware to stop it happening.
Due to the way the system works, manual looping as you have tried is unlikely to work - there is too much latency in the SPI command system, and starting the playback has delays as it reads the header from the SD card to get the WAV file structure. I do plan on adding a "playLoop()" function which will automatically seamlessly loop (I hope) a file until told to stop (or until the "number of loops" specified has expired?).
That'll teach me to read the other posts in the forum before I post.
I tried to follow the instructions for adding the two 10k resistors, but ran into some trouble.
I managed to solder the resistors on OK (phew, tricky little job as I'm brand new to soldering on an SMD scale), but my results were far from helpful - the left channel seemed better re. the distortion, but there was no sound coming from the right channel. In the process of probing pins 2 and 3 to check for a soldering defect, I managed to short those pins and had sound again in the right ear, so at least I know the opamp isn't fried.
I came back here to check the directions and saw that you mention pins 4 and 6 above, whereas it's 5 and 6 at the link. I'm thoroughly confused and wonder if I've even identified pin 1 correctly - on my board the v912i's beveled edge is on the edge-side of the board towards the WavePro lettering. The lettering on the v912i is right-side-up when the WavePro lettering is upside down. Wouldn't that usually put pin 1 under the "P" of WavePro rather than pin 6?
Think I'd better stop for guidance before I manage to do real damage ;^)
You know, you might be right ;)
I really hate the way you don't get a proper end indentation on these little chips. Makes it so hard to see the orientation.
The orientation of the op-amp is the opposite to that of the dsPIC. Pin 1 is under the P, pin 4 is under the v, 5-8 are on the side nearest the dsPIC.
Resistor between 1 and 2 (eP), and between 6 and 7 (middle two of dsPIC side).
It's pretty hard to kill one of these chips. The voltages around there are only 3.3V max, and the chip can take far more than that.
The biggest problem with the signal path is with the little resistor arrays. They're fine most of the time, but occasionally don't make good contact with their pads. Check those with a magnifying glass to see that the soldering is OK. Also, make sure the pins of the op-amp are still soldered down to their pads (one may have lifted a fraction) where you have been soldering.
Last edit: Majenko Technologies 2012-10-27
I actually had to replace one of the resistor packs on one of my test boards - one of the resistors went open circuit, not sure why. You might like to test each resistor in the packs to make sure they're still working with a multimeter.
I have been doing some work on the firmware, and have got seamless looping working nicely - it's a "loop and forget" system - you tell it to play a loop, and it just keeps going until told to stop.
I also have seamless sample queueing working too:
http://soundcloud.com/majenko/randomfunk
Great work Matt! Now I'm just wondering if there's some way to get feedback from the WavePro via spi when the loop occurs, or when a new sample is triggered in the que - I'm going to need some way to keep loops on various WavePros in sync with each other, or sync it to a clock.
Speaking of keeping things in sync - I've noticed that samples on my WavePro play back slightly fast - about 300ms fast on a sample that should run for 9600ms. I thought I noticed samples playing back slightly sharp compared to the ones from the RAS and Wave Shield when I did my comparison the other day, but thought I was imagining things. I've tested it more objectively with a 440Hz tone generated in SoundForge and the WavePro is indeed playing back a bit fast/sharp. I recorded the WavePro's output in Sonar and checked the pitch of both with V-vocal. I've attached a screenshot for you - the yellow line on the left is the original, the one on the right is the WavePro. It's not out by much but I foresee problems if I try to have WavePro's playing alongside RAS and WS. Easy solution is to do my project only with WavePro, but that's only assuming they're all out by the same amount ;^)
Ugh, sadly my WavePro is not very happy in the right ear after doing the resistor mod. Crackling and static and now and again just for variation, the actual signal. Bridging pins 6 and 7 makes it all better, but that's not as it should be and surely indicative of problems elsewhere. Though I've been tempted to solder a bridge between those pins just to be done with it, I'll carry on hunting for the problem. Actually, I have already been probing the pins of the resistor packs with a multimeter. Some legs on the same side seem to be connected and I've been doing my best to read the schematic and the board layout .png to see if this is how it should be. Most notably the two right legs on the middle resistor pack on the side closest to the opamp. I'm thinking I may have touched them with the soldering iron when I attached the 10k resistors.
By the way, would you mind posting some example code that'll allow me to test the loop feature?
Last edit: MoShang 2012-10-29
Yes, the frequency problem is due to an inability in the dsPIC to playback at precisely 44100Hz (or whatever speed is needed) due to clock dividers etc. It's not something I can do much about I'm afraid.
Different playback frequencies have slightly different offsets, unfortunately.
I have attached an image of the tracks for the resistor arrays - should make it easier to trace.
I have started a Wiki entry for the Arduino Library API: https://sourceforge.net/p/wavepro/wiki/Arduino%20Library/
To start a loop playing, use WavePro.play_loop("file.wav");
To stop it, just call WavePro.stop();
As for feedback, there is one IO pin on the dsPIC that's not being used. I am pondering having that linkable to an IO pin on the Arduino so you can receive notifications / interrupts to specific events. Maybe have it so you can turn on/off the notification for specific things, like playback finished, looped, queue incremented, etc.
I have been playing around with generating a synchronisation pulse from a WavePro that the Arduino can react to. It currently generates a pulse whenever playback finishes, or when a sample loops.
Here's two WavePro shields playing together:
http://soundcloud.com/majenko/randomjazz
I have just uploaded a new version of the library/firmware.
I have tried some experimental clock shifting / tweaking with this version to try and get better playback frequency accuracy. Could I get you to try this version out and see if it's closer to the right frequency for playback? If you could try with different sample rates (8000, 11025, 16000, 22050, 32000, 44100, 48000) that would be great. I'm not 100% certain I got the calculations quite right, but after staring at spreadsheets for about 3 hours you do kind of go blind after a while. I have (I hope) managed to get it down to less than a 0.1% error in the playback frequencies now.
My initial testing has a 440Hz sine playing back within 1 or 2 Hz of 440 according to my DMM, though how accurate that is I can't say. It sounds pretty good though.
Also, you can solder a wire to pin 22 of the dsPIC chip if you want to get notification of end of playback / sample loop. It gives a high pulse of about 100uS or so - best performance if you attach the wire to an interrupt enabled input on the host, but the pulse is wide enough for an Arduino polling for it to pick it up (as long as it's not doing much else).
Last edit: Majenko Technologies 2012-10-30
That's great! I haven't had a chance to test yet, but will get on it as soon as I can and report back.
Whaddayaknow - I had to leave the WavePro alone for a day (ugh, busy), but coming back to it today the situation with the staticky sad right channel has resolved itself! I guess I must have built up static on that channel somehow and that it's dissipated. Either way, the WavePro is sounding better than ever with the 10k resistor mod. I've also soldered a wire to pin 22 as suggested and feel more successful at life in general. Now that we're on the same page again, I'll get back with some test results this evening.
Last edit: MoShang 2012-11-01
I'm current with the v.14 firmware and library, but haven't yet had a chance to test at different sample rates.
I did however rerecord my earlier samples for the comparison test with the RAS and Wave Shield and have uploaded a new version.
http://soundcloud.com/moshang/waveshield-ras-wavepro
Thanks to the resistor mod the distortion is now completely gone. The pop at the start of tracks is all but completely gone too, but unfortunately I'm still getting a nasty spike at the end of files - actually I can see and hear it on all three of the musical musical loops,but not on the two drum ones.
Ive attached a screengrab from soundforge zoomed in all the way on one such spike.
Last edit: MoShang 2012-11-01
Any chance you could email me one of the samples that goes pop? The source sample, not a recording of it. I am wondering if there is something about those sample files that is making it pop. I'll need to investigate them in detail.
Right, I have found a sample which clicks at the end of playing.
The problem here is that the playback routine is (currently) rather dumb. It just plays until it reaches the end of the file. It shouldn't, and I need to rewrite it so it uses the data segment size in the RIFF header.
The file that clicks has a LIST RIFF chunk at the end:
and that is the source of the click.
Make sure that the WAV files have ONLY a RIFF, fmt and data chunk, and all will be well. It completely fails to play if it doesn't have just those three chunks, in that order. Anything at all following the end of the data chunk will be played as if it were data.
Last edit: Majenko Technologies 2012-11-01
Ok, I have just spent half an hour completely rewriting the file reading and playback routines, and they now handle the chunk sizes properly. Unknown chunk types are skipped, and the order isn't too critical - as long as the header comes somewhere before the data. I need to do some more testing before I release it.
In my old RandomJazz track you could distinctly hear clicks at the end of some of the samples. Those are now gone completely!
Here's a nice shiny new rendition to prove it: http://soundcloud.com/majenko/random-jazz-redux
The test results are in and attached. We're looking at the yellow lines' deviation from the red reference A/440Hz. Great job! The sampling rate I'm most likely to use, 44100, looks pretty much perfect now, while 22050 and 11025 also look too close to call. 48000, 16000 and 8000 are sharp (fast) according to V-Vocal. And 32000 is flat (slow) by quite a bit. This is v.14 firmware.
Last edit: MoShang 2012-11-02
Ok, there is a new version of both the library and firmware uploaded.
For the pin-22 notification you will now have to "subscribe" to the notification you are interested in:
The options are:
You can also use
to turn off notification of an event.
I'm up to date with v.26 and have noticed that my wavs loop perfectly the first time round, but click on every repeat after that :^/ This holds true for the musical loops (01.wav, 02.wav, and 03.wav) of the ones I e-mailed you, but not for the drum loops (04.wav and 05.wav) - the drum loops seem to loop perfectly all the way through. We're so close!
Last edit: MoShang 2012-11-03
Samples 01, 02 and 03 all have an extra "JUNK" chunk at the end of them. I am thinking this may be what is causing the click.
Nailed it!
Go grab r29 and prepare to be dazzled with loopy goodness :)