Does anyone know if it is possible to open a 22050Hz audio file with [soundfiler] and convert 44100Hz ? Regardless of the current sample rate.
-
Convert audio file from 22050Hz to 44100Hz with soundfiler ?
-
I guess you would have to repeat each sample twice. There's not enough information in a 22050Hz file for a 44100Hz sampling rate. Or maybe you could use some interpolation method after every sample.
Probably you would have to first write your file to an array and from there copy it to another array with double the size and do this copying or interpolating. -
Yes the simpest way would be to open it into an array with soundfiler, then play it whilst simultaneously recording into another array with PD running at 44.1.
-
Or you can just run a loop in which the writing array will be writing in two indexes for each index of the reading array.
-
Thanks for the answers. I'll try to repeat each sample twice to see how it sounds. Maybe I'll have to do some interpolation. I'll keep the thread informed.
-
... I would put an anti-aliasing filter on that.. your dac will only filter down to 22050 if running at 44.1 k so if you still have audio at a 22050 sample rate I believe there'd be aliasing (down to 11025)
-
How do you add an anti-aliasing filter?
-
The design of anti-aliasing filters is a whole topic in itself, but basically you want to low-pass filter out everything above the (in this case old) nyquist frequency. The ideal brick wall lowpass filter is a sinc function and I think windowed sinc FIR filters are sometimes used.. If going from 22050 to 44100 you will need something to get everything above 11025 out. I'm not sure if objects exist for this in pd, though and i don't know much about the subject in general, sorry. I think your best bet would be to use another program like sox
http://www.earlevel.com/main/2010/12/05/sample-rate-conversion-up/
EDIT: or you could use another interpolation method (like tabread4) as alexandros mentions, though the results are not likely to be too great.
-
Thanks for your reply. This is already a very useful for me. I'll give it a go.
-
Depending on what you are doing, you might not need to worry about aliasing.
I would try it without before I spent a lot of time on filtering.
Even though an audio engineer might say "you should filter," you might find you like the sound anyway. -
That's my intention. Thanks.
-
I have worked out a patch to convert my array from 22050HZ to 44100Hz by copying the value to the next index :
new_array[2x] =new_array[2x+1] = old_array[x]
The new array displays correct datas.Unfortunately I have been trying to use this converter patch with libpd and some audio I am recording with an ipad. It failed to work. Somehow the iteration through the audio array jumps some values and I just couldn't figure it out why. I'll try to do the conversion using some Core Audio ressources.