[PD] [writesf~] sample rate problem?
Roman Haefeli
reduzierer at yahoo.de
Tue Jul 3 00:49:18 CEST 2007
i hacked around a bit in aiff-files. here the flag '-rate 96000' didn't
have any effect on the resulting aiff-files as well. it seems like it is
hardcoded to 44100 for aiff-files. can anyone confirm this by reading
the source of [writesf~]?
anyway, i found out, how to fix aiff-files. the interesting bytes are
28-31, resp. 0x0000001C -> 0x0000001F
you'll find this:
40 0E AC 44
change this to:
40 0F BB 80
aiff-files are big endian, that is why the ordering is different here.
the way you set a sampling rate is a bit strange in aiff-files, i just
discovered by accident. you need actually to set it to 48000 (BB 80) and
then set the previous bit to one (E -> F), so that the value gets
doubled -> 96000. at least mplayer -identify recognizes it now as a
96000Hz-audiofile.
roman
On Tue, 2007-07-03 at 00:13 +0200, Roman Haefeli wrote:
> hi tim again
>
> i just noticed, that we have been talking off-list during this thread. i
> post that to the list again (it might be interesting for others as
> well).
>
> what you describe, shouldn't happen. if you use '-rate 96000', as
> mentioned in the help file of [writesf~], and the files still have
> '44100' in their headers, then it is definitely a bug of pd,
> respectively [writesf~]. i'm too lazy to test it now and here with
> aiff-files (you are writing to aiff-files, right?).
>
> yo, i only know how to fix the sampling rate header field in wav-files,
> not in aiff-files unfortunately. the rate is written in the bytes 24-27
> (when counting from 0) or in hex 0x00000018 -> 0x0000001B:
>
> you will find there:
>
> 44 AC 00 00
>
> (0x0000AC44 = 44100)
>
> change this to:
>
> 00 77 01 00
>
> (0x00017700 = 96000)
>
> maybe it works similar for aiff-files, but i don't know.
>
> roman
>
>
>
>
>
> On Mon, 2007-07-02 at 16:44 -0400, Tim Flood wrote:
> > Hi Roman-
> >
> > Yes, that is it: the audio files sound pitched/slowed down. When I
> > open them in another application (soundhack, quicktime, etc.), they
> > are always listed at 44.1k. So maybe PD is in fact RECORDING at 96kHz
> > but for some reason the header has the wrong sr, as you suggested. I
> > haven't used hex editors in the past, but will look into it as a means
> > of fixing this problem.
> >
> > Thanks again,
> >
> > -Tim
> >
> >
> >
> >
> >
> >
> > ______________________________________________________________
> >
> > From: Roman Haefeli <romanhaefeli at yahoo.de>
> > Reply-To: romanhaefeli at yahoo.de
> > To: Tim Flood <timflood23 at hotmail.com>
> > Subject: Re: [PD] [writesf~] sample rate problem?
> > Date: Mon, 02 Jul 2007 02:37:14 +0200
> > >hm.......wierd.... i don't have a solution at hand for this.
> > but you
> > >could do some checks. to make sure, that pd _really_ runs at
> > 96kHz,
> > >check that with the object [samplerate~]. it should output
> > '96000' on
> > >'bang', when pd runs at this rate. if so, than i would
> > assume, that the
> > >resulting files _are_ recorded with 96kHz, since it is pretty
> > sure, that
> > >[writesf~] does not do any conversion.
> > >if pd runs at 96kHz and the resulting files don't sound
> > pitched down,
> > >then i really wonder, what makes you think, they have a
> > sampling rate of
> > >44.1kHz.
> > >if the resulting files sound pitched down, then it probably
> > is a header
> > >issue (wrong sr tag in the header). this could be easily
> > fixed with the
> > >help of a hexeditor.
> > >
> > >yo, i hope that can help you isolate your problem a bit.
> > >
> > >roman
> > >
> > >
> > >
> > >On Sun, 2007-07-01 at 20:13 -0400, Tim Flood wrote:
> > > > Hello Roman-
> > > >
> > > > Thank you for your quick response. Yes, my soundcard (a
> > MOTU Ultralite
> > > > firewire interface) is set up to use a sampling rate of
> > 96kHz. The "clock
> > > > source" is set to internal. I have included a "-r 96000"
> > flag in my startup
> > > > preferences. Still, every file is written at 44.1kHz. I
> > am running
> > > > Hans-Christoph Steiner's latest version of Pd-extended on
> > Mac OS 10.4. If
> > > > you think of any other possible causes for this problem,
> > please drop me a
> > > > line....
> > > >
> > > > Best Regards,
> > > >
> > > > -Tim
> > > >
> > > >
> > > >
> > > > >From: Roman Haefeli <romanhaefeli at yahoo.de>
> > > > >Reply-To: romanhaefeli at yahoo.de
> > > > >To: Tim Flood <timflood23 at hotmail.com>
> > > > >CC: pd-list at iem.at
> > > > >Subject: Re: [PD] [writesf~] sample rate problem?
> > > > >Date: Mon, 02 Jul 2007 00:49:55 +0200
> > > > >
> > > > >sorry, i was inaccurate. there *is* a '-rate' flag, but
> > it doesn't cause
> > > > >any conversion. as the help file states, it just affects
> > the samplerate
> > > > >entry in the header of the soundfile. this is probably
> > not what you
> > > > >want. therefore it is still worth reading my previous
> > mail.
> > > > >
> > > > >roman
> > > > >
> > > > >
> > > > >On Mon, 2007-07-02 at 00:40 +0200, Roman Haefeli wrote:
> > > > > > hello tim
> > > > > >
> > > > > > there is no '-rate' flag for [writesf~], since it
> > doesn't do any
> > > > > > sampling rate conversion. it just uses the sampling
> > rate of pd. it
> > > > > > wouldn't make much sense to upsample for recording
> > (e.g. 44100 ->
> > > > > > 96000Hz) anyway.
> > > > > >
> > > > > > in other words: you need to run pd at the desired
> > samplerate. if you
> > > > > > want to record with 96000Hz, run pd with '-r
> > 96000'. BUT this still
> > > > > > doesn't always guarantee, that pd will effectively run
> > with the desired
> > > > > > sampling rate. sometimes it is needed to set the clock
> > of the audio card
> > > > > > to the desired rate by the preferences menu of the
> > soundcard (sometimes
> > > > > > the application just changes the samplingrate setting
> > of the card on the
> > > > > > fly).
> > > > > > for example on my system, when i want to record at
> > 96kHz, i need to set
> > > > > > my hdsp-card to 96kHz, so that jackd runs at 96kHz, so
> > that pd runs at
> > > > > > 96kHz, so that i can record in pd with 96kHz. got it?
> > > > > >
> > > > > > if that doesn't help you already, please tell us, on
> > what os you work
> > > > > > and which soundcard/driver you use.
> > > > > >
> > > > > > roman
> > > > > >
> > > > > >
> > > > > > On Sun, 2007-07-01 at 17:42 -0400, Tim Flood wrote:
> > > > > > > Hello Everyone-
> > > > > > >
> > > > > > > I have written a simple patch (see below) designed
> > for hard disk
> > > > >recording
> > > > > > > at 24-bit/96kHz. The -bytes flag sets the bit depth
> > correctly, but no
> > > > > > > matter what value I use to set the -rate flag, the
> > file is always
> > > > >created
> > > > > > > with a sampling rate of 44.1kHz. (My soundcard is
> > set up to work at
> > > > >96kHz).
> > > > > > > Is this a bug, or am I just missing
> > something? Any help would be
> > > > >greatly
> > > > > > > appreciated!
> > > > > > >
> > > > > > > Best Regards,
> > > > > > >
> > > > > > > -Tim
> > > > > > >
> > > > > > > #N canvas 224 44 449 382 10;
> > > > > > > #X msg 129 286 start;
> > > > > > > #X msg 198 286 stop;
> > > > > > > #X obj 43 336 writesf~ 2;
> > > > > > > #X obj 153 71 time;
> > > > > > > #X obj 16 173 pack s s s s s s;
> > > > > > > #X obj 16 96 makefilename %u;
> > > > > > > #X obj 26 147 makefilename %u;
> > > > > > > #X obj 153 96 makefilename %u;
> > > > > > > #X obj 161 122 makefilename %u;
> > > > > > > #X obj 169 147 makefilename %u;
> > > > > > > #X obj 16 71 date;
> > > > > > > #X obj 21 122 makefilename %u;
> > > > > > > #X obj 43 260 inlet~;
> > > > > > > #X obj 100 260 inlet~;
> > > > > > > #X obj 129 336 print record;
> > > > > > > #X text 123 173 time & date stamp;
> > > > > > > #X text 10 4 [diskRecorder~];
> > > > > > > #X text 13 18 writes an audio file to disk.;
> > > > > > > #X text 43 244 main-l;
> > > > > > > #X text 101 244 main-r;
> > > > > > > #X obj 16 50 bng 15 250 50 0 empty empty empty 0 -6
> > 0 10 -262144 -1
> > > > > > > -1;
> > > > > > > #X text 231 223 open 24-bit/96kHz file;
> > > > > > > #X msg 16 224 open -rate 96000 -bytes 3 -aiff \$1;
> > > > > > > #X obj 16 198 makesymbol %s-%s-%s_%s-%s-%s;
> > > > > > > #X text 36 48 push me;
> > > > > > > #X connect 0 0 2 0;
> > > > > > > #X connect 0 0 14 0;
> > > > > > > #X connect 1 0 2 0;
> > > > > > > #X connect 1 0 14 0;
> > > > > > > #X connect 3 0 7 0;
> > > > > > > #X connect 3 1 8 0;
> > > > > > > #X connect 3 2 9 0;
> > > > > > > #X connect 4 0 23 0;
> > > > > > > #X connect 5 0 4 0;
> > > > > > > #X connect 6 0 4 2;
> > > > > > > #X connect 7 0 4 3;
> > > > > > > #X connect 8 0 4 4;
> > > > > > > #X connect 9 0 4 5;
> > > > > > > #X connect 10 0 5 0;
> > > > > > > #X connect 10 1 11 0;
> > > > > > > #X connect 10 2 6 0;
> > > > > > > #X connect 11 0 4 1;
> > > > > > > #X connect 12 0 2 0;
> > > > > > > #X connect 13 0 2 1;
> > > > > > > #X connect 20 0 3 0;
> > > > > > > #X connect 20 0 10 0;
> > > > > > > #X connect 22 0 2 0;
> > > > > > > #X connect 23 0 22 0;
> > > > > > > #X connect 23 0 14 0;
> > > > > > >
> > > > > > >
> > _________________________________________________________________
> > > > > > > Get a preview of Live Earth, the hottest event this
> > summer - only on
> > > > >MSN
> > > > > > >
> > http://liveearth.msn.com?source=msntaglineliveearthhm
> > > > > > >
> > > > > > >
> > > > > > > _______________________________________________
> > > > > > > PD-list at iem.at mailing list
> > > > > > > UNSUBSCRIBE and account-management ->
> > > > >http://lists.puredata.info/listinfo/pd-list
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > >___________________________________________________________
> > > > >Der frhe Vogel fngt den Wurm. Hier gelangen Sie zum neuen
> > Yahoo! Mail:
> > > > >http://mail.yahoo.de
> > > >
> > > >
> > _________________________________________________________________
> > > > Make every IM count. Download Messenger and join the im
> > Initiative now.
> > > > Its free.
> > http://im.live.com/messenger/im/home/?source=TAGHM_June07
> > > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >___________________________________________________________
> > >Der frhe Vogel fngt den Wurm. Hier gelangen Sie zum neuen
> > Yahoo! Mail: http://mail.yahoo.de
> >
> >
> > ______________________________________________________________________
> > Need a brain boost? Recharge with a stimulating game. Play now!
>
>
>
>
>
>
> ___________________________________________________________
> Der frhe Vogel fngt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de
>
>
> _______________________________________________
> PD-list at iem.at mailing list
> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
___________________________________________________________
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de
More information about the Pd-list
mailing list