|
Post by rikky on Jun 25, 2018 8:20:34 GMT 1
I have a wav string to include zeros are swapped to one's If you keep the header on, it plays, I do not hear the difference. length = FILELEN("oink.wav") PRINT STR$(length) binary_string = BLOAD("oink.wav")
FOR i = 44 TO length - 1 PRINT PEEK(binary_string + i) IF PEEK(binary_string + i) = 0 THEN POKE binary_string + i -44 ,1 ELSE POKE binary_string + i -44 , PEEK(binary_string + i) END IF NEXT i
BSAVE binary_string TO "altered_oink.str" SIZE length - 44
FREE binary_string
string$ = CHOP$(LOAD$("altered_oink.str")) PRINT LEN(string$)
string$ = "this_wav$ = " & CHR$(34) & string$ & CHR$(34) & NL$ PRINT LEN(string$) 'string$ = REPLACE$(string$,CHR$(0),CHR$(1)) SAVE string$ TO "include_wav.bac"
But now play the include string this_wav$ is another matter. INCLUDE "include_wav.bac"
PRAGMA INCLUDE <linux/soundcard.h>
ALIAS ioctl TO IOCTL ALIAS open TO SYSOPEN ALIAS close TO SYSCLOSE ALIAS write TO SYSWRITE ALIAS memset TO MEMSET ALIAS fread TO FREAD
fd = SYSOPEN("/dev/dsp", O_RDWR) status = IOCTL(fd, SOUND_PCM_WRITE_BITS, 8) status = IOCTL(fd, SOUND_PCM_WRITE_CHANNELS, 1) status = IOCTL(fd, SOUND_PCM_WRITE_RATE, 8000) buf_size = 8000
And then? EDIT: P.S. Oh, crossposted, sorry. Oh, It doesn't work.
|
|
|
Post by vovchik on Jun 25, 2018 9:22:55 GMT 1
Dear all, I figured out what was wrong. Rik's code on the previous page works fine - as does my earlier bwplay if we use PRAGMA INCLUDE <linux/soundcard.h.oss3> rather than PRAGMA INCLUDE <linux/soundcard.h>. There was obviously some change made in the header files and the old one is <linux/soundcard.h.oss3>, which works fine! With kind regards, vovchik Attachments:bwplay_src.tar.gz (254.04 KB)
|
|
|
Post by vovchik on Jun 26, 2018 10:01:42 GMT 1
Dear all, Here is a tone generator for BaCon (simple, dual and touch tones). I ported and modded some c code by Joseph Battaglia done originally in 2004. It works for me. Let me know whether it works on your platforms. You may have to change the soundcard header include if you get compile errors (the required mod - one line at the top - is in the BaCon source, just commented out). The newer header works in Mint 17.3, while the older one works on my RPI3. Have fun. With kind regards, vovchik Attachments:btonegen-src.tar.gz (5.57 KB)
|
|
|
Post by rikky on Jun 26, 2018 15:18:35 GMT 1
Ja, well,.. I have to change soundcard.h.oss back to normal soundcard.h, but then it works. Nice these telephone tones. Makes me see a use for this program, for I cannot get VOIP (Skype) on the raspi to work. But then, nobody can, so I suppose , I'd better not even start to think in that direction. Rik.
|
|