# Scramble/Unscramble Audio File

**URL:** <https://discourse.processing.org/t/scramble-unscramble-audio-file/44637>\
**Category:** Libraries\
**Created:** [June 24, 2024, 8:32pm UTC](https://discourse.processing.org/t/scramble-unscramble-audio-file/44637 "2024-06-24T20:32:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dheld](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/dheld/32/125_2.png) [@dheld](https://discourse.processing.org/u/dheld)\
**Post date:** [June 24, 2024, 8:32pm UTC](https://discourse.processing.org/t/scramble-unscramble-audio-file/44637/1 "2024-06-24T20:32:21Z")

</div>

I’m creating a sound installation and I’m a novice Processing programmer. There will be 2 audio files. I’d like to scramble the 2 files to create a mashup of the 2 sounds, then I’d like to reverse the process and unscramble the sound files. I know how to scramble the files but not sure how to keep track of the mashup to unscramble them. Any help would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [June 26, 2024, 12:13pm UTC](https://discourse.processing.org/t/scramble-unscramble-audio-file/44637/2 "2024-06-26T12:13:24Z")

</div>

Hello @dheld,

> [@dheld](#):
>
> I know how to scramble the files

Please elaborate on what scramble is in the context of your project.

I was making breakfast and scrambling 2 eggs this morning and thought about how to unscramble them and get the eggs back.

`:)`

---

<div class="post-metadata">

**Author:** ![dheld](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/dheld/32/125_2.png) [@dheld](https://discourse.processing.org/u/dheld)\
**Post date:** [June 26, 2024, 8:34pm UTC](https://discourse.processing.org/t/scramble-unscramble-audio-file/44637/3 "2024-06-26T20:34:21Z")

</div>

The 2 audio files would be equal length. Then for example, I will randomly take segments from one audio file and swap them with equal segment the other file. So each file would have segments from the other file.

I thing that I need to create an array that contains, [frame, length], so I could scan the array and put the original segments back together in their proper place.

 ![File0165](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/4/3/43024d639e4844a5903896e3b9681c81b7865779.jpeg)
