My audio package (16bit, 4channel, sample based, w/sequencer)
XlogicX
Posts: 18
This is a 16-bit, 4-channel, sample based audio driver. It uses 3-cogs (not including the interpreted cog). I know this isn’t the first one out there; I enjoyed using Nick Sabalausky’s driver. However, I wanted something to call my own, and I wanted to add more features. The first feature that I created that makes this driver stand out is to be able to decrease the bit quality on the fly; such as going from 16-bit to 3-bit. This is also why I will never have a sample for a square wave, I just use any even duty sample and make it 1-bit <SPAN style="FONT-FAMILY: Wingdings; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-char-type: symbol; mso-symbol-font-family: Wingdings"><SPAN style="mso-char-type: symbol; mso-symbol-font-family: Wingdings">J
This is the first serious ASM code that I have written that wasn’t just flashing a light. So I’m sure I may have done some things in my code that look weird or stupid. To put it in perspective, I started 2 months ago not knowing how to pass more than one variable to a cog, not knowing about ctra, not understanding the concept of movs and movd in loops, and not yet grasping the propellers implementation of the object orientation. I had to completely re-write the program 2 times over. I would say 80-90% of my time was spent troubleshooting simple things that typos caused (those ones are less obvious than logical problems, to me). I’m happy to say that it works now, and I have overcome all of those things that I did not know. Also, I’m going to have to make a donation to the people that created GEAR if I can, I made heavy use out of that debugger/emulator.
The only part of the driver that I am completely finished with is the PCM engine; any added code to the main loop will lower the frequencies, and I don’t want to have to re-do the whole CON table of notes.
My next changes will probably be to the mixer engine (add more effects) and to add more wave samples.
I attached the driver, and a demo file (music2) that demonstrates a couple of its features (for version 2.0). I'll try to post updates as I do new Smile to it.
Edit: I'm sure not everyone will want to jump out of their seats and find their prop board with an audio setup to test this. Here are some links to the corresponding mp3 samples of said demo files:
(music2.spin)
www.phx2600.org/forum/download/file.php?id=11
(music_021.spin)
www.phx2600.org/forum/download/file.php?id=12
Driver currently in version 2.4
Post Edited (XlogicX) : 10/24/2009 1:21:49 PM GMT
This is the first serious ASM code that I have written that wasn’t just flashing a light. So I’m sure I may have done some things in my code that look weird or stupid. To put it in perspective, I started 2 months ago not knowing how to pass more than one variable to a cog, not knowing about ctra, not understanding the concept of movs and movd in loops, and not yet grasping the propellers implementation of the object orientation. I had to completely re-write the program 2 times over. I would say 80-90% of my time was spent troubleshooting simple things that typos caused (those ones are less obvious than logical problems, to me). I’m happy to say that it works now, and I have overcome all of those things that I did not know. Also, I’m going to have to make a donation to the people that created GEAR if I can, I made heavy use out of that debugger/emulator.
The only part of the driver that I am completely finished with is the PCM engine; any added code to the main loop will lower the frequencies, and I don’t want to have to re-do the whole CON table of notes.
My next changes will probably be to the mixer engine (add more effects) and to add more wave samples.
I attached the driver, and a demo file (music2) that demonstrates a couple of its features (for version 2.0). I'll try to post updates as I do new Smile to it.
Edit: I'm sure not everyone will want to jump out of their seats and find their prop board with an audio setup to test this. Here are some links to the corresponding mp3 samples of said demo files:
(music2.spin)
www.phx2600.org/forum/download/file.php?id=11
(music_021.spin)
www.phx2600.org/forum/download/file.php?id=12
Driver currently in version 2.4
Post Edited (XlogicX) : 10/24/2009 1:21:49 PM GMT
Comments
I will update the original post with attachments of the new version, and another demo (music_021_demo.spin). This demonstrates these new effects, and it demonstrates the ability to use multiple channels (of which I forgot to demo on the last version).
Turn down your volume before you try them.
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Visit the: The Propeller Pages @ Warranty Void.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
-Phil
But out of curiosity, why did you pick P31 as the Audio Out. That's normally reserved for programming and serial interface?
P10 would have been a good choice for Demo Board users.
Looking forward to updates.
Jim
@hover1: Heh, I use Pin31 because I like to "hear" my chip get programmed [noparse]:)[/noparse], no really, this is the reason for it. You're reasoning for Pin10 makes sense, this is why I made the pin number a parameter for the PlayNote function. I actually had it hard coded for pin 31 up until recent versions of the driver, but I made it configurable just because that's better style. A lot of the newer changes I made to the program was mostly to make it usable for other people.
I haven't seen the original author of GEAR in many years, which is why I started working on it. I did some work on GEAR to try and improve the tool for others to use, and my belief is that any contribution you can make which enriches the Propeller community would be well appreciated.
It's just a pity I've not had much time for "Propellering" lately, although I still keep an eye on the forum.
@mirror:That's really cool that you've contributed to GEAR. It's not often I use software where I'm not finding myself hoping for more features, GEAR had everything I could hope for in helping find mistakes that I made along the way.
Ver 2.2 [noparse][[/noparse]10-21-2009]:
•Added bass, tenor, alto, and soprano versions of noise wave
•Added alto and soprano versions of sine wave
•Added bass, tenor, alto, and soprano versions of square wave. I know, I know, I finally broke down and added these. I did
this to support higher level functions like DownNote that don't take quality as a parameter.
•Added DownNote function, documentation is included in function
•Added UpNote function, documentation is included in function
I included the new driver and it's corresponding demo file in the zip file in the original post.
I will add an mp3 sample later today.
I also included a sequencer program that uses my driver as an object, it gives the ability to play songs at a certain tempo based off of bar by bar note information in a DAT section. So I did the whole mario song this time. MP3 file is included, I tried to play with a couple of the new special effects I added to the driver, enjoy! (hopefully).