csound Re: [gentoo-user] tone generator
It's surprising how few people have heard about the most flexible tone generator (=synth) out there: csound http://www.csounds.com The latest package has a Gentoo ebuild, too, which is not in the repository, however. You can do *everything* with it, and it's so fast you can use it as MIDI player, too. Regards ralf -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] tone generator
Not sure if that's what you want, but speaker-test from alsa-utils can generate sine waves, pink and white noise. [EMAIL PROTECTED] ~ $ speaker-test -t 2 speaker-test 0.0.8 Playback device is plughw:0,0 Stream parameters are 48000Hz, S16_LE, 1 channels Sine wave rate is 440.Hz But it's silent. Doesn't even say /dev/dsp already in use or something like that. I use alsa and my audio works OK otherwise. More mysteries to unravel. mw Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] tone generator
On Fri, 25 Jan 2008 10:59:25 -0800 (PST) maxim wexler [EMAIL PROTECTED] wrote: Not sure if that's what you want, but speaker-test from alsa-utils can generate sine waves, pink and white noise. [EMAIL PROTECTED] ~ $ speaker-test -t 2 speaker-test 0.0.8 Playback device is plughw:0,0 Stream parameters are 48000Hz, S16_LE, 1 channels Sine wave rate is 440.Hz But it's silent. Doesn't even say /dev/dsp already in use or something like that. I use alsa and my audio works OK otherwise. More mysteries to unravel. speaker-test -D default -r 44100 -c 2 -f 880 -t sine Worked for me. Cheers, -- |\ /|| | ~ ~ | \/ ||---| `|` ? ||ichael | |iggins\^ / michael.higgins[at]evolone[dot]org -- gentoo-user@lists.gentoo.org mailing list
[gentoo-user] tone generator
Hi group, Anybody know of a gentoo/linux tone generator that will output test tones, sine waves, triangle waves and the like. Prefer command line/ncurses. Maxim Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] tone generator
On Thursday 24 January 2008, maxim wexler wrote: Hi group, Anybody know of a gentoo/linux tone generator that will output test tones, sine waves, triangle waves and the like. Prefer command line/ncurses. Maybe audacity can do that? (I don't use it so I don't know). However, a bit of googling found this (apparently not command line, but seemingly quite simple): http://www.aa6e.net/aa6e/software/tone/index.html No idea whether it will work under gentoo, hope this helps anyway. -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] tone generator
On Thu, Jan 24, 2008 at 11:41:04AM -0800, maxim wexler wrote: Anybody know of a gentoo/linux tone generator that will output test tones, sine waves, triangle waves and the like. Prefer command line/ncurses. One of my friends coded something like this once as a plug-in for XMMS. Can't seem to find it now. Perhaps you'd have better luck than I. On the other hand, a little bit of C++ should be fairly easy. First you need the 'play' program from sox. 'play' can play files in the 'raw' format, which is just a stream of words that gives the amplitude of the waveform. For example play -t raw -s l -f s -c 1 -r 3 - takes as input stdin, plays mono channel sound from a stream that is signed-linear, 30 hertz sample rate, and with amplitude described by 32 bit long word. Next you just need a waveform generator. A C++ snipplet from something I cobbled together several years ago (yes yes, my coding practice can stand much improvement, so sue me) #include stdio.h #include unistd.h #include math.h int main() { int rate = 3; int coramp = 0xCEF; int tempamp=0; float totalamp=0; int f_count; while(1) for(f_count=0; f_count rate; f_count++) { totalamp=sinf( ((float)f_count) * 440 / rate * 2 * M_PI); tempamp = (int) (coramp * totalamp); printf(%c%c%c%c%c%c%c%c, (char) (tempamp), (char) (tempamp 8), (char) (tempamp 16), (char) (tempamp 24), (char) (tempamp), (char) (tempamp 8), (char) (tempamp 16), (char) (tempamp 24)); } return 0; } Yes, it is an infinite loop. The sinf makes it a sine wave. You can code your own triangle wave. THe 440 makes it output A-440. It is the frequency. coramp is an amplifying factor. compile it, run it like ./a.out | play -t raw -s l -f s -c 1 -r 3 - And you should get A-440 out of your speakers. W -- Willie W. Wong [EMAIL PROTECTED] 408 Fine Hall, Department of Mathematics, Princeton University, Princeton A mathematician's reputation rests on the number of bad proofs he has given. -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] tone generator
You might be interseted in rezound; it is graphical, however. Liviu On 1/24/08, maxim wexler [EMAIL PROTECTED] wrote: Hi group, Anybody know of a gentoo/linux tone generator that will output test tones, sine waves, triangle waves and the like. Prefer command line/ncurses. -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] tone generator
./a.out | play -t raw -s l -f s -c 1 -r 3 - And you should get A-440 out of your speakers. [EMAIL PROTECTED] ~/docs/c-prog $ ./a.out |play -t raw -s l -f s -c 1 -r 3000 - play soxio: Failed reading `-': unknown file type and without the hyphen [EMAIL PROTECTED] ~/docs/c-prog $ ./play |play -t raw -s l -f s -c 1 -r 3000 play soxio: Can't open input file `s': No such file or directory doesn't like swapping 'l' for '1' either Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] tone generator
compile it, run it like ./a.out | play -t raw -s l -f s -c 1 -r 3 - This works, sort of. Sounds like a dentist drill going in an out. [EMAIL PROTECTED] ~/docs/c-prog $ ./a.out | aplay -t raw -f cdr Playing raw data 'stdin' : Signed 16 bit Big Endian, Rate 44100 Hz, Stereo [EMAIL PROTECTED] by signal Interrupt... [EMAIL PROTECTED] ~/docs/c-prog $ ./a.out | aplay -t raw -f dat Playing raw data 'stdin' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo Aborted by signal Interrupt... [EMAIL PROTECTED] ~/docs/c-prog $ ./a.out | aplay -t raw -f cd Playing raw data 'stdin' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo Aborted by signal Interrupt... And there are a bunch of other formats under aplay --help but nothing like a pure tone. -mw Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] tone generator
On Thu, Jan 24, 2008 at 02:27:24PM -0800, maxim wexler wrote: ./a.out | play -t raw -s l -f s -c 1 -r 3 - And you should get A-440 out of your speakers. [EMAIL PROTECTED] ~/docs/c-prog $ ./a.out |play -t raw -s l -f s -c 1 -r 3000 - play soxio: Failed reading `-': unknown file type rate really wants to be 3, or your note will have a frequency off by a factor of 10. But that is not the problem here. Perhaps revdep-rebuild or rebuilding sox by hand? Usually when sox is having problems after you explicitly specify the file format (by -t raw) that means you have some sort of linking error with your libraries. Hum, by any chance you are using sox-14.0.0? My desktop is still on 12.17.9 and has no problems, and a quick search suggests that the unknown file type problem also affects Debian and other distros. I will take a look using my laptop later tonight to see if it is a problem with sox-14.0.0. W -- Willie W. Wong [EMAIL PROTECTED] 408 Fine Hall, Department of Mathematics, Princeton University, Princeton A mathematician's reputation rests on the number of bad proofs he has given. -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] tone generator
On Donnerstag, 24. Januar 2008, maxim wexler wrote: http://www.linux.org/apps/AppId_2452.html -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] tone generator
compile it, run it like ./a.out | play -t raw -s l -f s -c 1 -r 3 - And you should get A-440 out of your speakers. OK, got it: [EMAIL PROTECTED] ~/docs/c-prog $ sox -t nul /dev/null sine.wav synth 10.0 sine 440.0 | aplay sine.wav Playing WAVE 'sine.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono Sox Rox Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] tone generator
Hi, On Thu, 2008-01-24 at 11:41 -0800, maxim wexler wrote: Hi group, Anybody know of a gentoo/linux tone generator that will output test tones, sine waves, triangle waves and the like. Prefer command line/ncurses. I used to do this quite easily from XMMS to tune my guitar - never tried it with it's spinoffs though (bmp, etc) To do it was quite simple, you get the frequencies you want and stick them in a file like so: #EXTM3U #EXTINF:-1,Tone Generator: 82.4 Hz;164.8 Hz;247.2 Hz;329.6 Hz tone://82.407;164.814;247.221;329.628 #EXTINF:-1,Tone Generator: 110.0 Hz;220.0 Hz;330.0 Hz;440.0 Hz tone://110.000;220.000;330.000;440.000 #EXTINF:-1,Tone Generator: 146.8 Hz;293.7 Hz;440.5 Hz;587.3 Hz tone://146.832;293.665;440.497;587.330 #EXTINF:-1,Tone Generator: 196.0 Hz;392.0 Hz;588.0 Hz;784.0 Hz tone://195.998;391.995;587.993;783.991 #EXTINF:-1,Tone Generator: 246.9 Hz;493.9 Hz;740.8 Hz;987.8 Hz tone://246.942;493.883;740.825;987.767 #EXTINF:-1,Tone Generator: 329.6 Hz;659.3 Hz;988.9 Hz;1318.5 Hz tone://329.628;659.255;988.883;1318.510 these are base frequencies and harmonics for E, A, D, G, B and E strings. Then I just open the file in xmms and play! However, I'm sure there was some plugin I needed... It was called tone generator or something... sorry for being vague, but it's been a while since I used this method :) If you want me to do some more digging, then let me know! HTH, -- Iain Buchanan iaindb at netspace dot net dot au A father doesn't destroy his children. -- Lt. Carolyn Palamas, Who Mourns for Adonais?, stardate 3468.1. -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] tone generator
--- Hemmann, Volker Armin [EMAIL PROTECTED] wrote: On Donnerstag, 24. Januar 2008, maxim wexler wrote: http://www.linux.org/apps/AppId_2452.html -- Yeah, I found that. It's going into the queue. gentoo-user@lists.gentoo.org mailing list Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] tone generator
On Thu, Jan 24, 2008 at 03:06:38PM -0800, Penguin Lover maxim wexler squawked: compile it, run it like ./a.out | play -t raw -s l -f s -c 1 -r 3 - This works, sort of. Sounds like a dentist drill going in an out. [EMAIL PROTECTED] ~/docs/c-prog $ ./a.out | aplay -t raw -f cdr Playing raw data 'stdin' : Signed 16 bit Big Endian, Rate 44100 Hz, Stereo This is because the code outputs it as 32 bit signed with 3 Hz rate. The defaults of aplay is sampling it incorrectly, which is why the file sounds off. Now, I think I know what the problem is with sox: 1) the commandline syntax changed between 12.* and 14.0, the switches I need should be play -t raw -s -4 -c 1 -r 3 (c.f. man play). 2) Despite what the man pages say, the '-' switch for reading from stdin seems to be broken. Probably a bug. I'll test more and possibly file a bug report. On the other hand, since you have aplay installed, the right syntax should be ./a.out | aplay -t raw -f S32_LE -c 1 -r 3 Which says to use 32 bit little endian with 1 channel at a sample rate of 3. Unfortunately, if you do that, you won't hear a thing. Why? I got my multiplier wrong in the testing program that I send you. I missed half a byte. Change the definition for coramp (which controls the amplification) to int coramp = 0xCFFF; (The reason that I missed half a byte was that I was messing around with harmonics and multiple voicing... so each harmonic needs to be suitably rescaled in amplitude.) Hope that helps, W -- When my cats aren't happy, I'm not happy. Not because I care about their mood but because I know they're just sitting there thinking up ways to get even. ~Penny Ward Moser Sortir en Pantoufles: up 412 days, 22:00 -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] tone generator
#EXTM3U #EXTINF:-1,Tone Generator: 82.4 Hz;164.8 Hz;247.2 Hz;329.6 Hz tone://82.407;164.814;247.221;329.628 #EXTINF:-1,Tone Generator: 110.0 Hz;220.0 Hz;330.0 Hz;440.0 Hz tone://110.000;220.000;330.000;440.000 #EXTINF:-1,Tone Generator: 146.8 Hz;293.7 Hz;440.5 Hz;587.3 Hz tone://146.832;293.665;440.497;587.330 #EXTINF:-1,Tone Generator: 196.0 Hz;392.0 Hz;588.0 Hz;784.0 Hz tone://195.998;391.995;587.993;783.991 #EXTINF:-1,Tone Generator: 246.9 Hz;493.9 Hz;740.8 Hz;987.8 Hz tone://246.942;493.883;740.825;987.767 #EXTINF:-1,Tone Generator: 329.6 Hz;659.3 Hz;988.9 Hz;1318.5 Hz tone://329.628;659.255;988.883;1318.510 these are base frequencies and harmonics for E, A, D, G, B and E strings. Then I just open the file in xmms and play! However, I'm sure there was some plugin I needed... It was called tone generator or something... sorry for being vague, but it's been a while Played right off the bat in audacious! Thanks! How is that 'Tone Generator' formatted. Is there a HOWTO for it? Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] tone generator
On Thu, Jan 24, 2008 at 03:22:00PM -0800, Penguin Lover maxim wexler squawked OK, got it: [EMAIL PROTECTED] ~/docs/c-prog $ sox -t nul /dev/null sine.wav synth 10.0 sine 440.0 | aplay sine.wav Playing WAVE 'sine.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono Better yet (I didn't know that play can do it itself... sox needs better documentation) play -n -c1 synth 10.0 waveform waveforms that I've tried: saw, sine, square Have fun. W -- The last time anybody made a list of the top hundred character attributes of New Yorkers, common sense snuck in at number 79. When it's fall in New York, the air smells as if someone's been frying goats in it, and if you are keen to breathe the best plan is to open a window and stick your head in a building. - Nuff said?? Sortir en Pantoufles: up 412 days, 22:23 -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] tone generator
On Thu, 2008-01-24 at 15:45 -0800, maxim wexler wrote: #EXTM3U #EXTINF:-1,Tone Generator: 82.4 Hz;164.8 Hz;247.2 Hz;329.6 Hz tone://82.407;164.814;247.221;329.628 [snip] Played right off the bat in audacious! Thanks! How is that 'Tone Generator' formatted. I could only guess what you could - # starts a comment, otherwise a line is: tone://freq1;freq2... Is there a HOWTO for it? I've been searching ever since I wrote that email, but I can't find any info anywhere. I think this tone generator function was borrowed from beep, which was in turn borrowed from xmms, so the documentation no doubt got lost in the many transitions... all I can find is a vague xmms reference to Tonegen. You might try looking for a tonegen.c file in audacious... If I find more, I'll let you know. cya, -- Iain Buchanan iaindb at netspace dot net dot au Never look a gift horse in the mouth. -- Saint Jerome -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] tone generator
On Fri, 2008-01-25 at 10:28 +0930, Iain Buchanan wrote: all I can find is a vague xmms reference to Tonegen. You might try looking for a tonegen.c file in audacious... If I find more, I'll let you know. all I can find is the file src/tonegen/tonegen.c in audacious-plugins which has this comment: _(About Tone Generator), _(Sinus tone generator by Haavard Kvaalen [EMAIL PROTECTED]\n Modified by Daniel J. Peng [EMAIL PROTECTED]\n\n To use it, add a URL: tone://frequency1;frequency2;frequency3;...\n e.g. tone://2000;2005 to play a 2000Hz tone and a 2005Hz tone), so I think that's it... unless you feel like editing the source to play other waves ;) -- Iain Buchanan iaindb at netspace dot net dot au algorithm, n.: Trendy dance for hip programmers. -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] tone generator
looking for a tonegen.c file in audacious... If I http://www.lns.com/papers/tonegen/tonegen.c [EMAIL PROTECTED] ~/docs/elex $ gcc -lm -o tonegen tonegen.c tonegen.c:56:31: machine/soundcard.h: No such file or directory tonegen.c: In function `main': tonegen.c:172: error: `SNDCTL_DSP_GETFMTS' undeclared (first use in this function) tonegen.c:172: error: (Each undeclared identifier is reported only once tonegen.c:172: error: for each function it appears in.) tonegen.c:181: error: `SNDCTL_DSP_STEREO' undeclared (first use in this function) tonegen.c:196: error: `SNDCTL_DSP_SPEED' undeclared (first use in this function) tonegen wants a machine/soundcard.h which doesn't exist on my system. Although: $ slocate soundcard.h /usr/src/linux-2.6.12-gentoo-r6/include/linux/soundcard.h /usr/src/linux-2.6.20-gentoo-r6/include/linux/soundcard.h /usr/src/linux-2.6.16-gentoo-r3/include/linux/soundcard.h /usr/include/sys/soundcard.h /usr/include/linux/soundcard.h The only 'machine/' on my system is under arch/arm26/. -mw Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] tone generator
On Thu, 2008-01-24 at 18:00 -0800, maxim wexler wrote: looking for a tonegen.c file in audacious... If I http://www.lns.com/papers/tonegen/tonegen.c [EMAIL PROTECTED] ~/docs/elex $ gcc -lm -o tonegen tonegen.c tonegen.c:56:31: machine/soundcard.h: No such file or directory [snip] tonegen wants a machine/soundcard.h which doesn't exist on my system. [snip] probably because it's made to go with audacious, which is why the file I supplied played out of the box. It's already compiled into audacious. Looking at the file, it doesn't make much sense to compile it alone. -- Iain Buchanan iaindb at netspace dot net dot au Machine Always Crashes, If Not, The Operating System Hangs (MACINTOSH) -- Topic on #Linux -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] tone generator
all I can find is the file src/tonegen/tonegen.c in audacious-plugins Seems to be a different file than www.lns.com/papers/tonegen/tonegen.c -mw Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] tone generator
On Thu, 2008-01-24 at 18:13 -0800, maxim wexler wrote: all I can find is the file src/tonegen/tonegen.c in audacious-plugins Seems to be a different file than www.lns.com/papers/tonegen/tonegen.c ah, then your previous Q. is easy. Looking at the above c file, it says #ifdef LINUX #include linux/soundcard.h #define DSP /dev/dsp #else #include machine/soundcard.h #define DSP /dev/dspW #endif so you have to define LINUX. There are a few other things too, something like this should do it: gcc -D LINUX -include string.h -lm -o tonegen tonegen.c -- Iain Buchanan iaindb at netspace dot net dot au The ends justify the means. -- after Matthew Prior -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] tone generator
something like this should do it: gcc -D LINUX -include string.h -lm -o tonegen tonegen.c Yup. Thanks Iain. Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] tone generator
On Thu, 24 Jan 2008 20:15:14 -0800 (PST) maxim wexler [EMAIL PROTECTED] wrote: something like this should do it: gcc -D LINUX -include string.h -lm -o tonegen tonegen.c Yup. Thanks Iain. ++ Very handy. ;-) -- |\ /|| | ~ ~ | \/ ||---| `|` ? ||ichael | |iggins\^ / michael.higgins[at]evolone[dot]org -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] tone generator
On Thu, 24. Jan, maxim wexler spammed my inbox with Hi group, Anybody know of a gentoo/linux tone generator that will output test tones, sine waves, triangle waves and the like. Prefer command line/ncurses. Not sure if that's what you want, but speaker-test from alsa-utils can generate sine waves, pink and white noise. Regards, Jan Seeger -- gentoo-user@lists.gentoo.org mailing list