Editing audio in tables!


#1

Hello :slight_smile:

I have lately been using Axoloti for sampling and resampling and I was curious about if it is possible to edit the audio content of a table and save it, all internally in Axoloti?

For example if I have sampled a kick drum. I would like to "hard" reverse the audiofile and save it again to sd-card. By hard reset I mean not just putting an inverter after the table but actaully reversing the content of the table and saving it.

Maybe also reverse and invert would be nice.

It is really a lot of work having to first copy all the files to computer and then import to audicaity and then do what you want and then convert back in to raw files and then copyt it back to axoloti... Just to normalise a file or reversing it.

@thetechnobear @johannes

What do you think?


#2

well you can play the table inverse it and record it again in Axoloti, no? i.e. write the output of your playback into a new table. why do you want to save the reversed table? just make it a toggle and have it be playable forward or in reverse...


#3

Yes true. But that was what I was trying to avoid doing. First of all, for that to work you would have to use the table/read not the table/play. I was aiming at a simple sample player, using the tabe/play where you have better pitch control than in the table/read objects. And it would be really nice to be able to do those kind of edits to the files itself instead of always have to patch it or do it in Audacity.

On the table/play pitch is just right form the beginning and seems like the best choice for. And for example to be able to play something back in reverse with the table/play object, you would have to reverse the audio in the table, since it doest work well with reversing audio in the table/play object. If you want to have something reverse sounding you would have to go into granular domain and in this case this is not wanted.

Now that I think of it maybe it is possible to just edit the code of the table play object, so the content of it is reversed, so when you trigger the start inlet it triggers the reverses audio. That might work. I guess I need to look into the hacking the table/play for that.

Does anyone have an idea how to reverse audiocontent of a table? following last idea above, it doesnt necesarilly have to be able to be saved to sd card?

Thanks


#4

@jaffasplaffa can you post a short raw file for me? i will attempt to hack a reversed table edition for you...


#5

Here is a mono raw file to play with :slight_smile:

I am thinking maybe it can be done by simply adding a - (minus) somewhere in the code..... A bit busy with another thing right now, but will try later in the after noon. Let me know what yu come up with :wink:


#6

it's not that simple, but i think i have a solution. i am also busy right now, but will try later on my train ride to a gig :slight_smile:


#7

Saving tables on sdcard is pretty hardcore.. I'd leave that part to specific objects. (Not saying it's impossible to adapt code from table/save, but that would produce no benefit other than adding a huge number of lines of code)
However, you can write some code to perform "bulk" operations on tables.
Reversing a table can be done in two ways (one is more clever than the other):
The dumb way is simply to create an empty array the same size of the table, scanning the table from start to finish and copying in the reverse order inside the "temporary" table.
Then you can copy all the samples from the temporary table to the original one.
This is the dumb way because if you have a N size table to reverse, you'll need at least 2N "spaces" inside memory.

The clever way is to scan the table from start to half and process "opposite" samples.. Like first sample and last sample, second sample and second-last sample... and so on.
You just store one of the two samples inside a temporary variable, then copy the other into the first sample's location and copy the first sample (which you stored in the temporary variable) into the second sample's location.
This method allows you to use only N+1 spaces in memory if you want to flip a N sized table.. That's a big difference.

You can do this with for loops (it's a pretty exercise you can do if you want).
One issue i can see is: the audio file you loaded inside a table may not be the exact size of the table. If you flip the sample this way you'll very likely get silence at the beginning of the saved file.
You can avoid this by counting how many zero samples there are, starting from the last one, but at this point another problem comes up: your file might have an odd size of samples. I suspect this would produce issues if not properly implemented.


#8

as sputnki pointed out correctly, the problem with simply reversing the playback is, that your table (if not fully filled by the sound file) will start with silence. find attached a version that simply reverses playback, it's still very messy but it works.

it would be nice to have a mode, where the reverse toggle reverses from the current position. right now it is a bit buggy when you hit it while playing back a sample.

tablereverse.axp (4.4 KB)


#9

Hey :slight_smile:

Nice :slight_smile: Will definatly take a look at it. Yes would indeed be nice with a reverse current position.

Yeah table would have to be filled. Welll for short one shots this is not an issue. But for longer it is.