[PD] strange wave

Hans Roels hans.roels at versateladsl.be
Tue Mar 3 12:17:58 CET 2009


I think/hope that I managed to isolate the problem with writesf~ and 
readsf~. There are two patches in attach that print out every step 
that you take so one can't forget to click 'open' for example, it 
also measures the time between the 'open' and 'start' command. Copy 
these 2 patches in the same folder.

Try this test a few times:

1. start Pd
2. open main.pd
3. create abstraction 'rec' in main.pd
(test writesf~)
4. open a file (comment 1 in 'rec')
5. start recording (comment 2 in 'rec')
6. stop the recording (comment 3 in 'rec')
7. send 'print' to writesf~ (comment 4 in 'rec')
(test readsf~)
8. open a file (comment 5 in 'rec')
9. play a file (comment 6 in 'rec')
10. answer question (comment 7 in 'rec')
11. send 'print' to readsf~ (comment 8 in 'rec')
12.close Pd & don't save any changes

I tried this 10 times on Windows XP (Pd 0-42-4) and 10 times in Mac 
Os X 10.3.9 (Pd 0-40-2) and readsf~ and writesf~ never worked and Pd 
only created a wav file with the right name but without sample data. 
Be sure to do exactly the required steps and nothing more. If for 
example you open 'test audio and midi' in de Media menu (or you 
delete and restore an audio cable within the abstraction 'rec') 
before step 12, the opened file will start playing, even if it was 30 
seconds ago that you opened and tried to play the sound file.  If you 
try recording (step 4 - 7) everything will work now n this case.

This is what Pd prints (print commands in abstraction 'rec') when 
readsf and writesf don't work:

print: open C:/Program Files/pd042-4/bin/aa.wav
print: start
time_beween_open_and_start: 2774.78
print: stop
time_beween_start_and_stop: 3297.23
state 0
fifo head 0
fifo tail 0
fifo size 262144
fd -1
eof 0
print: open C:/Documents and Settings/Bureaublad/pianob7.wav
print: 1
time_beween_open_and_start: 3668.75
readsf_sound?: no
state 2
fifo head 70496
fifo tail 0
fifo size 262144
fd -1
eof 1

This what Pd prints when writesf and readsf do work after 'test audio 
and midi' was opened after step 11
print: open /elektromuziek/extra.wav
print: start
time_beween_open_and_start: 1364.17
print: stop
time_beween_start_and_stop: 1834.38
state 0
fifo head 161792
fifo tail 161792
fifo size 262144
fd -1
eof 0
print: open /elektromuziek/PIANOB7.WAV
print: 1
time_beween_open_and_start: 1428.03
readsf_sound?: yes
state 0
fifo head 70496
fifo tail 70400
fifo size 262144
fd -1
eof 1

I hope someone can solve this problem...

Hans r

At 19:32 2/03/2009, IOhannes m zmoelnig wrote:
>Hans Roels wrote:
>>Hello,
>
>hi.
>
>how does this relate to "Arduino/SRF05" to which thread it references?
>
>>Sometimes when I record audio in Pd, a wave file is created that Pd
>[...]
>>problem yet but I'm trying... (I think it has something to do with 
>>using 'writesf' in an abstraction).
>>I 'm working on Windows XP and this problem occured in Pd 0.40.3 
>>and in 0.42-4.
>
>
>your problem is most likely related to not properly closing the 
>soundfile. you MUST send a [stop( message to [writesf~] in order to 
>"finalize" the wav (that is: replace the dummy length in the header 
>with the proper one, which is only known at closing time)
>
>fgmasdr
>IOhannes
>
>
-------------- next part --------------
#N canvas 719 338 458 308 12;
#X msg 31 232 \; pd dsp 1;
#X obj 32 198 loadbang;
#X connect 1 0 0 0;
-------------- next part --------------
#N canvas 498 19 630 639 12;
#X msg 409 45 print;
#X msg 176 58 start;
#X msg 283 67 stop;
#X obj 130 136 osc~ 440;
#X msg 51 88 open \$1.wav;
#X obj 52 31 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X obj 53 60 savepanel;
#X text 53 7 1;
#X text 171 11 2;
#X obj 41 438 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X obj 40 467 openpanel;
#X msg 140 436 1;
#X obj 98 581 dac~;
#X obj 132 165 *~ 0.1;
#X msg 40 495 open \$1;
#X obj 176 33 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X obj 281 43 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X text 281 12 3;
#X obj 143 216 writesf~ 1;
#X obj 458 170 print;
#X obj 102 547 readsf~ 1;
#X obj 112 315 timer;
#X obj 112 339 print time_beween_open_and_start;
#X obj 343 269 print time_beween_start_and_stop;
#X obj 78 290 bang;
#X obj 175 290 bang;
#X obj 386 235 timer;
#X obj 368 206 bang;
#X obj 417 207 bang;
#X text 424 19 4;
#X msg 206 461 yes;
#X msg 300 464 no;
#X obj 250 530 print readsf_sound?;
#X msg 443 448 print;
#X text 250 464 or;
#X obj 34 606 print;
#X text 205 435 did you hear sound?;
#X text 42 404 5;
#X text 144 405 6;
#X text 260 408 7;
#X text 441 411 8;
#X obj 182 615 timer;
#X obj 182 639 print time_beween_open_and_start;
#X obj 148 590 bang;
#X obj 245 590 bang;
#X connect 0 0 18 0;
#X connect 1 0 18 0;
#X connect 1 0 19 0;
#X connect 1 0 25 0;
#X connect 1 0 27 0;
#X connect 2 0 18 0;
#X connect 2 0 19 0;
#X connect 2 0 28 0;
#X connect 3 0 13 0;
#X connect 4 0 18 0;
#X connect 4 0 19 0;
#X connect 4 0 24 0;
#X connect 5 0 6 0;
#X connect 6 0 4 0;
#X connect 9 0 10 0;
#X connect 10 0 14 0;
#X connect 11 0 20 0;
#X connect 11 0 35 0;
#X connect 11 0 44 0;
#X connect 13 0 18 0;
#X connect 14 0 20 0;
#X connect 14 0 35 0;
#X connect 14 0 43 0;
#X connect 15 0 1 0;
#X connect 16 0 2 0;
#X connect 20 0 12 0;
#X connect 20 0 12 1;
#X connect 21 0 22 0;
#X connect 24 0 21 0;
#X connect 25 0 21 1;
#X connect 26 0 23 0;
#X connect 27 0 26 0;
#X connect 28 0 26 1;
#X connect 30 0 32 0;
#X connect 31 0 32 0;
#X connect 33 0 20 0;
#X connect 41 0 42 0;
#X connect 43 0 41 0;
#X connect 44 0 41 1;


More information about the Pd-list mailing list