Prev: Debian iceape browser does not appear using preferences from/etc
Next: options for ffmpeg to make DVD that allows scan-forward/reverse
From: unruh on 24 Dec 2009 12:42 On 2009-12-24, despen(a)verizon.net <despen(a)verizon.net> wrote: > The Natural Philosopher <tnp(a)invalid.invalid> writes: > >> For a debian linux system. >> >> I don't want the syntesizer bit..can take care of all that..just how >> to hook C or indeed any other language into making a noise come out of >> the speakers. > > For C: > > system("aplay sound.wav"); Which of course means that sound.wav has to already exist. This would be pretty useless for playing, in real time, a sound that you had synthesised. Synthesise the sound. Write it out to a .wav file, then run aplay on it. > > similar facilities exist for most other languages.
From: despen on 24 Dec 2009 12:49 The Natural Philosopher <tnp(a)invalid.invalid> writes: > despen(a)verizon.net wrote: >> The Natural Philosopher <tnp(a)invalid.invalid> writes: >> >>> For a debian linux system. >>> >>> I don't want the syntesizer bit..can take care of all that..just how >>> to hook C or indeed any other language into making a noise come out of >>> the speakers. >> >> For C: >> >> system("aplay sound.wav"); >> >> similar facilities exist for most other languages. > > I dont have a wav. > > I want to MAKE one perhaps. Wavs are raw audio. I don't think you've done a good job of describing what you want to do. You asked for the simplest way to make noise. What I posted is about as simple as it gets. There are APIs for OSS, ALSA, etc. Why don't you try to explain what you really want?
From: despen on 24 Dec 2009 12:54 unruh <unruh(a)wormhole.physics.ubc.ca> writes: > On 2009-12-24, despen(a)verizon.net <despen(a)verizon.net> wrote: >> The Natural Philosopher <tnp(a)invalid.invalid> writes: >> >>> For a debian linux system. >>> >>> I don't want the syntesizer bit..can take care of all that..just how >>> to hook C or indeed any other language into making a noise come out of >>> the speakers. >> >> For C: >> >> system("aplay sound.wav"); > > Which of course means that sound.wav has to already exist. This would be > pretty useless for playing, in real time, a sound that you had > synthesised. Synthesise the sound. Write it out to a .wav file, then run > aplay on it. Is that a requirement? From the aplay man page: If filename is not specified, the standard output or input is used. The aplay utility accepts multiple filenames. So it looks like aplay would be happy at the receiving end of a pipe.
From: Robert Riches on 24 Dec 2009 16:31 On 2009-12-24, The Natural Philosopher <tnp(a)invalid.invalid> wrote: > For a debian linux system. > > I don't want the syntesizer bit..can take care of all that..just how to > hook C or indeed any other language into making a noise come out of the > speakers. > > Ideally would be a fragment of code that simply makes any noise on my > ALSA based sound system. > > The only bit I found segfaults when it opens device 'default' Here are a few snippets of a program I wrote several years ago. It uses the OSS layer. #include <sys/soundcard.h> const char *dspnam; // name of DSP device int dspfd; // DSP device file descriptor int dspformat; // DSP format (AFMT_S16_LE) int dspsamplebytes; // bytes per DSP sample int dspstereo; // 1 for stereo (0 for mono) int dspsamplerate; // data sample rate ///////////////////////////////////////////////////////////////////////////// // // The initdsp function initializes the DSP device. If there is a problem, // this function does not return. // ///////////////////////////////////////////////////////////////////////////// void initdsp() { int sr; #if DEBUG printf("DEBUG: starting initdsp\n"); #endif // DEBUG if (-1 == (dspfd = open( dspnam, O_WRONLY))) { fprintf( stderr, "rrplay: cannot open DSP device %s\n", dspnam); exit(1); } if (-1 == ioctl( dspfd, SNDCTL_DSP_SETFMT, &dspformat)) { fprintf( stderr, "rrplay: cannot set sample format for DSP device %s\n", dspnam ); exit(1); } if (-1 == ioctl( dspfd, SNDCTL_DSP_STEREO, &dspstereo)) { fprintf( stderr, "rrplay: cannot set sample channels for DSP device %s\n", dspnam ); exit(1); } sr = dspsamplerate; // save it if (-1 == ioctl( dspfd, SNDCTL_DSP_SPEED, &dspsamplerate)) { fprintf( stderr, "rrplay: cannot set sample rate for DSP device %s\n", dspnam ); exit(1); } dspsamplerate = sr; // restore it #if DEBUG printf("DEBUG: finished initdsp\n"); #endif // DEBUG } void closeall() { #if DEBUG printf("DEBUG: starting closeall\n"); #endif // DEBUG if (-1 == close(dspfd)) { fprintf( stderr, "rrplay: error closing DSP device.\n"); exit(1); } .... // In the main loop: if (curbytes != write( dspfd, samplebuf, curbytes)) { fprintf( stderr, "rrplay: error writing to DSP device.\n"); exit(1); } HTH -- Robert Riches spamtrap42(a)verizon.net (Yes, that is one of my email addresses.)
From: Bud on 24 Dec 2009 23:38
To the OP OK, you want to write code or a program that will write the music for you and save it? I'm confused like everyone else.:) In KDE there is arts builder and in Gnome there are more available. HTH -- Bud |