CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

mix signed wav files

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
georpo



Joined: 18 Nov 2008
Posts: 278
Location: Athens, Greece.

View user's profile Send private message

mix signed wav files
PostPosted: Sun Jul 31, 2011 4:37 am     Reply with quote

Hello,

I need a code example to mix 2 or more signed wav files.

Thanks!
temtronic



Joined: 01 Jul 2010
Posts: 9163
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Jul 31, 2011 5:20 am     Reply with quote

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'?
georpo



Joined: 18 Nov 2008
Posts: 278
Location: Athens, Greece.

View user's profile Send private message

PostPosted: Sun Jul 31, 2011 7:35 am     Reply with quote

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.
temtronic



Joined: 01 Jul 2010
Posts: 9163
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Jul 31, 2011 12:28 pm     Reply with quote

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?
georpo



Joined: 18 Nov 2008
Posts: 278
Location: Athens, Greece.

View user's profile Send private message

PostPosted: Sun Jul 31, 2011 12:43 pm     Reply with quote

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
georpo



Joined: 18 Nov 2008
Posts: 278
Location: Athens, Greece.

View user's profile Send private message

PostPosted: Sun Jul 31, 2011 2:22 pm     Reply with quote

P.S.

I do not even know what proteus is.
Ttelmah



Joined: 11 Mar 2010
Posts: 19337

View user's profile Send private message

PostPosted: Sun Jul 31, 2011 2:33 pm     Reply with quote

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
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jul 31, 2011 2:35 pm     Reply with quote

For questions like this, use Google instead of this board.
I typed in this search string, and got a little bit of an explanation:
Quote:
mix two wav files example code

http://www.gidforums.com/t-21029.html

Try other search strings:
Quote:
How to mix wav files in C ?

More threads:
http://cboard.cprogramming.com/c-programming/100808-mixing-wav-files-using-ansi-c.html
http://www.cfanatic.com/topic428/
temtronic



Joined: 01 Jul 2010
Posts: 9163
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Jul 31, 2011 2:59 pm     Reply with quote

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...
georpo



Joined: 18 Nov 2008
Posts: 278
Location: Athens, Greece.

View user's profile Send private message

PostPosted: Sun Jul 31, 2011 10:44 pm     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group