Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 9 of 9

Thread: Combining 3 wav files and saving to SD card

  1. #1

    Combining 3 wav files and saving to SD card

    Hi all,

    I wanted to combine 3 wav files into a single wav file and write that combined wav file to the SD card. By combine I mean, the wav files will be played in order. Can anyone suggest me a way to go about this? The wav files are very short in length ~1 sec.

    Also, I am using the audio adapter shield and teensy 3.0.


    Thanks in advance!

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,844
    Maybe use a sound editor program, like Audacity, to load the 3 files. Then copy and paste their audio into a larger file and save it?

    Or perhaps you want this to be done on Teensy? But why, I can't understand.

  3. #3
    Hi Paul,

    Thank you for your response. Basically, the project is a drum glove with sensors attached to the fingertips. Every time you tap your finger on a table it plays a sound effect from a wav file. What I am trying to do is record the wav file associated with each fingertip sensor press and combine them into one wav file and store it as a wav file on the SD card.

    Do you know of a better way to implement this? Let me know, please.

    Thanks again!

  4. #4
    Still open to any suggestions.

  5. #5
    Member
    Join Date
    Nov 2012
    Location
    Olympia, WA
    Posts
    54
    Quote Originally Posted by generic_username View Post
    Thank you for your response. Basically, the project is a drum glove with sensors attached to the fingertips. Every time you tap your finger on a table it plays a sound effect from a wav file. What I am trying to do is record the wav file associated with each fingertip sensor press and combine them into one wav file and store it as a wav file on the SD card.
    It sounds like a fun project, but...It's still a little unclear what you want to do.

    Are trying to make a recording of a whole drumming performance for playback? (combine them into one wav file)

    Are you trying to stack sounds so you can fatten a sound or reduce the number of voices needed for playback?

    It is confusing because you say record the wav file associated with each fingertip sensor press like you don't already have the source WAV files. Are you reverse engineering something and need to record those WAVs?

    My questions are all over the map, I realize...please clarify a little so we can help. Maybe describe a use case?

    I haven't used Audacity in a decade, but I expect it could concatenate the sounds, combine the sounds using multitrack mixing, or whatever else you might want to do with them, including bitrate/depth/pitch changes and trimming them to get super snappy percussive sounds.

  6. #6
    Sorry, I realize I was a little unclear! So I am trying to make a recording of the whole drumming performance (combine them all to one wav file).

    For example,

    I start recording:

    I press: sensor1, it plays Drum sound
    I press: sensor3, it plays Kick sound
    I press: sensor2, it plays Snare sound

    I stop the recording:

    It creates a final wav file which is the combination of Drum, Kick, Snare (in that order because it was pressed in that order)

    Let me know if that makes sense!

    Thanks again.

  7. #7
    Junior Member
    Join Date
    Feb 2015
    Posts
    12
    Sounds an interesting project!

    I'm not able to help much regarding how to achieve what you want, but hopefully I can clarify the question a little.

    So, as I understand it, you want the teensy connected to the audio shield, to play samples when you activate different sensors. Presumably you don't want to be limited to one sound at a time, so if you press sensors 2 and 3 at the same time you'll get the two sounds together. The audio shield should make it easy to play multichannel sound and handle the mixing of sounds going to the speaker.

    Ideally, if you could take the mixed sound from the audio shield and record it to your WAV file, it should be much easier than having your code do the mixing. I've no idea if you can get that from the audio shield, though.

    If that isn't possible, I would try to avoid generating the WAV file in real time, as I suspect the data throughput of both playing sounds and generating the WAV would cause the system to stutter. I would track timestamps and sound activations, and generate the WAV when the recording ends.

    Hope these suggestions help you to figure it out.

    James

  8. #8
    Junior Member
    Join Date
    Feb 2015
    Posts
    9
    You basically want the teensy to act as a sequencer. A three channel one.

    Google 'Arduino Sequencer' and see what direction that takes your idea.

    I would suggest recording the actions with MIDI, and final rendering (' wanted to combine 3 wav files into a single wav file') to audio file format.

    Hope there are terms in this post that will steer you in the right direction.

  9. #9
    Thank you all for your suggestions. It definitely helps a lot!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •