View previous topic :: View next topic |
Author |
Message |
georpo
Joined: 18 Nov 2008 Posts: 278 Location: Athens, Greece.
|
mix signed wav files |
Posted: Sun Jul 31, 2011 4:37 am |
|
|
Hello,
I need a code example to mix 2 or more signed wav files.
Thanks! |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9174 Location: Greensville,Ontario
|
|
Posted: Sun Jul 31, 2011 5:20 am |
|
|
You'll probably get help if you say which PIC type, compiler version and how you want to 'mix' the data of the files.
Simple question, have you got your PIC to play the files?,
Have you 'googled' to see the code already 'out there'? |
|
![](templates/subSilver/images/spacer.gif) |
georpo
Joined: 18 Nov 2008 Posts: 278 Location: Athens, Greece.
|
|
Posted: Sun Jul 31, 2011 7:35 am |
|
|
It does not matter which PIC I use compiler version etc. The question is very simple.
Anyway. The files are stored in a microSD card and a DSPIC33FJ64GP802 handles all the SPI and DAC work. Surely I have the pic playing the signed wav files though its 16bit audio dac. Now, I want to mix 2 or more signed wav files stored in my microSD card. When I say "MIX" I mean that I want to "sum" the data of the files somehow and feed them in one ADC.
Consider an audio mixer. You feed in 2 or more analog signals and you get one out.
Any help appreciated. |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9174 Location: Greensville,Ontario
|
|
Posted: Sun Jul 31, 2011 12:28 pm |
|
|
Considering the number of 'first timers','homework' and 'term' assignments that are posted here all my questions are valid.
Type of PIC is important as code cut for one is not necessarily compatible with another. Memory layout, peripherals, etc. vary from PIC to PIC.
Compiler is important as not all of us have all current versions. Example my code cut under PCM will not work under PCH.
I'm impressed you have working code as there are tons of 'help me' that try to use Proteus and not real hardware...making it impossible to really help them...
As for 'mixing' have you tried just a simple 'ANDing' for the bits of the bytes of the files data? |
|
![](templates/subSilver/images/spacer.gif) |
georpo
Joined: 18 Nov 2008 Posts: 278 Location: Athens, Greece.
|
|
Posted: Sun Jul 31, 2011 12:43 pm |
|
|
The working code and hardware is the result of hours of study and soldering.
Anyway I thought ANDing or just summing the values from the files but before doing anything I thought I should just ask to save some time.
Maybe someone knows exactly what is needs to get the correct "mixed" result.
Thanks |
|
![](templates/subSilver/images/spacer.gif) |
georpo
Joined: 18 Nov 2008 Posts: 278 Location: Athens, Greece.
|
|
Posted: Sun Jul 31, 2011 2:22 pm |
|
|
P.S.
I do not even know what proteus is. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19369
|
|
Posted: Sun Jul 31, 2011 2:33 pm |
|
|
Obvious suggestion, since audio DAC's are generally not linear, and the channels will probably be scaled to have the peak value at the peak of the DAC, would be to add the values, and divide by two.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9174 Location: Greensville,Ontario
|
|
Posted: Sun Jul 31, 2011 2:59 pm |
|
|
FYI Proteus is a 'simulator' that a lot of people on this forum use instead of real chips.
It's full of bugs,errors and very faulty 'logic' wrt DRC !
Unfortunately when a question is asked they don't mention they're using Proteus...so 'why' the program doesn't work is horribly compounded by the 'simulator'.....
I've never met a simulator in 30+ years that actually worked properly... |
|
![](templates/subSilver/images/spacer.gif) |
georpo
Joined: 18 Nov 2008 Posts: 278 Location: Athens, Greece.
|
|
Posted: Sun Jul 31, 2011 10:44 pm |
|
|
I cannot see and understand how a simulator can replace real hardware. No way. I always like to see my code running in real time in hardware.
Thanks everybody. I will try these later today. |
|
![](templates/subSilver/images/spacer.gif) |
|